[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAA=Fs0mEiBT81ZE=NMNOw95ezsZ_omqSyGJcLDBL8fxWRfLeqQ@mail.gmail.com>
Date: Sat, 21 Aug 2021 18:46:29 +0100
From: Phillip Potter <phil@...lpotter.co.uk>
To: Martin Kaiser <martin@...ser.cx>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Larry Finger <Larry.Finger@...inger.net>,
Dan Carpenter <dan.carpenter@...cle.com>,
Michael Straube <straube.linux@...il.com>,
linux-staging@...ts.linux.dev,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 07/10] staging: r8188eu: clean up the usb_writeXY functions
On Sat, 21 Aug 2021 at 17:49, Martin Kaiser <martin@...ser.cx> wrote:
>
> Remove unnecessary variables, summarize declarations and assignments.
>
> Signed-off-by: Martin Kaiser <martin@...ser.cx>
> ---
> drivers/staging/r8188eu/hal/usb_ops_linux.c | 50 ++++-----------------
> 1 file changed, 8 insertions(+), 42 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c
> index cb969a200681..e01f1ac19596 100644
> --- a/drivers/staging/r8188eu/hal/usb_ops_linux.c
> +++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c
> @@ -128,59 +128,25 @@ static u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr)
>
> static int usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val)
> {
> - u16 wvalue;
> - u16 len;
> - u8 data;
> - int ret;
> -
> -
> - wvalue = (u16)(addr & 0x0000ffff);
> - len = 1;
> - data = val;
> - ret = usbctrl_vendorreq(pintfhdl, wvalue, &data, len, REALTEK_USB_VENQT_WRITE);
> + u16 wvalue = (u16)(addr & 0x0000ffff);
>
> - return ret;
> + return usbctrl_vendorreq(pintfhdl, wvalue, &val, 1, REALTEK_USB_VENQT_WRITE);
> }
>
> static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
> {
> - u16 wvalue;
> - u16 len;
> - __le32 data;
> - int ret;
> -
> -
> -
> - wvalue = (u16)(addr & 0x0000ffff);
> - len = 2;
> -
> - data = cpu_to_le32(val & 0x0000ffff);
> -
> - ret = usbctrl_vendorreq(pintfhdl, wvalue, &data, len, REALTEK_USB_VENQT_WRITE);
> -
> -
> + u16 wvalue = (u16)(addr & 0x0000ffff);
> + __le32 data = cpu_to_le32(val & 0x0000ffff);
>
> - return ret;
> + return usbctrl_vendorreq(pintfhdl, wvalue, &data, 2, REALTEK_USB_VENQT_WRITE);
> }
>
> static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
> {
> - u16 wvalue;
> - u16 len;
> - __le32 data;
> - int ret;
> -
> -
> -
> - wvalue = (u16)(addr & 0x0000ffff);
> - len = 4;
> - data = cpu_to_le32(val);
> -
> - ret = usbctrl_vendorreq(pintfhdl, wvalue, &data, len, REALTEK_USB_VENQT_WRITE);
> -
> -
> + u16 wvalue = (u16)(addr & 0x0000ffff);
> + __le32 data = cpu_to_le32(val);
>
> - return ret;
> + return usbctrl_vendorreq(pintfhdl, wvalue, &data, 4, REALTEK_USB_VENQT_WRITE);
> }
>
> static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata)
> --
> 2.20.1
>
Acked-by: Phillip Potter <phil@...lpotter.co.uk>
Regards,
Phil
Powered by blists - more mailing lists