All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Kaiser <martin@kaiser.cx>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Larry Finger <Larry.Finger@lwfinger.net>,
	Phillip Potter <phil@philpotter.co.uk>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Michael Straube <straube.linux@gmail.com>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	Martin Kaiser <martin@kaiser.cx>
Subject: [PATCH 06/10] staging: r8188eu: clean up the usb_readXY functions
Date: Sat, 21 Aug 2021 18:48:55 +0200	[thread overview]
Message-ID: <20210821164859.4351-6-martin@kaiser.cx> (raw)
In-Reply-To: <20210821164859.4351-1-martin@kaiser.cx>

Remove unnecessary variables, summarize declarations and assignments.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/hal/usb_ops_linux.c | 30 +++++----------------
 1 file changed, 7 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c
index dccb9fd34777..cb969a200681 100644
--- a/drivers/staging/r8188eu/hal/usb_ops_linux.c
+++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c
@@ -98,46 +98,30 @@ static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u16 value, void *pdata,
 
 static u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr)
 {
-	u16 wvalue;
-	u16 len;
-	u8 data = 0;
-
-
-
-	wvalue = (u16)(addr & 0x0000ffff);
-	len = 1;
-
-	usbctrl_vendorreq(pintfhdl, wvalue, &data, len, REALTEK_USB_VENQT_READ);
-
+	u16 wvalue = (u16)(addr & 0x0000ffff);
+	u8 data;
 
+	usbctrl_vendorreq(pintfhdl, wvalue, &data, 1, REALTEK_USB_VENQT_READ);
 
 	return data;
-
 }
 
 static u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr)
 {
-	u16 wvalue;
-	u16 len;
+	u16 wvalue = (u16)(addr & 0x0000ffff);
 	__le32 data;
 
-	wvalue = (u16)(addr & 0x0000ffff);
-	len = 2;
-	usbctrl_vendorreq(pintfhdl, wvalue, &data, len, REALTEK_USB_VENQT_READ);
+	usbctrl_vendorreq(pintfhdl, wvalue, &data, 2, REALTEK_USB_VENQT_READ);
 
 	return (u16)(le32_to_cpu(data) & 0xffff);
 }
 
 static u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr)
 {
-	u16 wvalue;
-	u16 len;
+	u16 wvalue = (u16)(addr & 0x0000ffff);
 	__le32 data;
 
-	wvalue = (u16)(addr & 0x0000ffff);
-	len = 4;
-
-	usbctrl_vendorreq(pintfhdl, wvalue, &data, len, REALTEK_USB_VENQT_READ);
+	usbctrl_vendorreq(pintfhdl, wvalue, &data, 4, REALTEK_USB_VENQT_READ);
 
 	return le32_to_cpu(data);
 }
-- 
2.20.1


  parent reply	other threads:[~2021-08-21 16:50 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-21 16:48 [PATCH 01/10] staging: r8188eu: remove unnecessary cast Martin Kaiser
2021-08-21 16:48 ` [PATCH 02/10] staging: r8188eu: remove unused define Martin Kaiser
2021-08-21 17:27   ` Phillip Potter
2021-08-21 17:27     ` Phillip Potter
2021-08-22 11:56   ` Michael Straube
2021-08-21 16:48 ` [PATCH 03/10] staging: rtl8188eu: use actual request type as parameter Martin Kaiser
2021-08-21 17:44   ` Phillip Potter
2021-08-21 17:44     ` Phillip Potter
2021-08-22 12:08   ` Michael Straube
2021-08-21 16:48 ` [PATCH 04/10] staging: r8188eu: rewrite usb vendor request defines Martin Kaiser
2021-08-21 17:45   ` Phillip Potter
2021-08-21 17:45     ` Phillip Potter
2021-08-22 12:18   ` Michael Straube
2021-08-21 16:48 ` [PATCH 05/10] staging: r8188eu: remove an unused enum Martin Kaiser
2021-08-21 17:29   ` Phillip Potter
2021-08-21 17:29     ` Phillip Potter
2021-08-22 12:19   ` Michael Straube
2021-08-21 16:48 ` Martin Kaiser [this message]
2021-08-21 17:45   ` [PATCH 06/10] staging: r8188eu: clean up the usb_readXY functions Phillip Potter
2021-08-21 17:45     ` Phillip Potter
2021-08-22 12:25   ` Michael Straube
2021-08-21 16:48 ` [PATCH 07/10] staging: r8188eu: clean up the usb_writeXY functions Martin Kaiser
2021-08-21 17:46   ` Phillip Potter
2021-08-21 17:46     ` Phillip Potter
2021-08-22 12:27   ` Michael Straube
2021-08-21 16:48 ` [PATCH 08/10] staging: r8188eu: clean up the usb_writeN Martin Kaiser
2021-08-21 17:47   ` Phillip Potter
2021-08-21 17:47     ` Phillip Potter
2021-08-22 13:24   ` Michael Straube
2021-08-22 16:58     ` Martin Kaiser
2021-08-22 17:17       ` Michael Straube
2021-08-21 16:48 ` [PATCH 09/10] staging: r8188eu: remove unused members of struct _io_ops Martin Kaiser
2021-08-21 17:29   ` Phillip Potter
2021-08-21 17:29     ` Phillip Potter
2021-08-22 13:28   ` Michael Straube
2021-08-21 16:48 ` [PATCH 10/10] staging: r8188eu: set pipe only once Martin Kaiser
2021-08-21 17:47   ` Phillip Potter
2021-08-21 17:47     ` Phillip Potter
2021-08-22 14:05   ` Michael Straube
2021-08-21 17:27 ` [PATCH 01/10] staging: r8188eu: remove unnecessary cast Phillip Potter
2021-08-21 17:27   ` Phillip Potter
2021-08-22 17:04   ` Martin Kaiser
2021-08-22 23:49     ` Phillip Potter
2021-08-22 23:49       ` Phillip Potter
2021-08-22 11:54 ` Michael Straube

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210821164859.4351-6-martin@kaiser.cx \
    --to=martin@kaiser.cx \
    --cc=Larry.Finger@lwfinger.net \
    --cc=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=phil@philpotter.co.uk \
    --cc=straube.linux@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.