LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 1/2] staging: r8188eu: ctrl vendor req value is always 0x05
@ 2021-08-18 20:00 Martin Kaiser
  2021-08-18 20:00 ` [PATCH 2/2] staging: r8188eu: ctrl vendor req index is not used Martin Kaiser
  2021-08-18 20:33 ` [PATCH 1/2] staging: r8188eu: ctrl vendor req value is always 0x05 Phillip Potter
  0 siblings, 2 replies; 4+ messages in thread
From: Martin Kaiser @ 2021-08-18 20:00 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Dan Carpenter, Michael Straube,
	linux-staging, linux-kernel, Martin Kaiser

The bRequest value for the vendor specific control requests sent by this
driver is always 0x05. Replace the function parameter with the define from
usb_ops.h.

This patch is an adaptation of commit eeb4661560ff ("staging: rtl8188eu:
ctrl vendor req value is always 0x05") for the new r8188eu driver.

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

diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c
index b4edbfda9a18..2583e3a941fd 100644
--- a/drivers/staging/r8188eu/hal/usb_ops_linux.c
+++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c
@@ -10,7 +10,7 @@
 #include "../include/recv_osdep.h"
 #include "../include/rtl8188e_hal.h"
 
-static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u16 index, void *pdata, u16 len, u8 requesttype)
+static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u16 value, u16 index, void *pdata, u16 len, u8 requesttype)
 {
 	struct adapter	*adapt = pintfhdl->padapter;
 	struct dvobj_priv  *dvobjpriv = adapter_to_dvobj(adapt);
@@ -55,7 +55,8 @@ static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u
 			memcpy(pIo_buf, pdata, len);
 		}
 
-		status = usb_control_msg(udev, pipe, request, reqtype, value, index, pIo_buf, len, RTW_USB_CONTROL_MSG_TIMEOUT);
+		status = usb_control_msg(udev, pipe, REALTEK_USB_VENQT_CMD_REQ,
+					 reqtype, value, index, pIo_buf, len, RTW_USB_CONTROL_MSG_TIMEOUT);
 
 		if (status == len) {   /*  Success this control transfer. */
 			rtw_reset_continual_urb_error(dvobjpriv);
@@ -101,7 +102,6 @@ static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u
 
 static u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr)
 {
-	u8 request;
 	u8 requesttype;
 	u16 wvalue;
 	u16 index;
@@ -110,14 +110,13 @@ static u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr)
 
 
 
-	request = 0x05;
 	requesttype = 0x01;/* read_in */
 	index = 0;/* n/a */
 
 	wvalue = (u16)(addr & 0x0000ffff);
 	len = 1;
 
-	usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype);
+	usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype);
 
 
 
@@ -127,47 +126,42 @@ static u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr)
 
 static u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr)
 {
-	u8 request;
 	u8 requesttype;
 	u16 wvalue;
 	u16 index;
 	u16 len;
 	__le32 data;
 
-	request = 0x05;
 	requesttype = 0x01;/* read_in */
 	index = 0;/* n/a */
 	wvalue = (u16)(addr & 0x0000ffff);
 	len = 2;
-	usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype);
+	usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype);
 
 	return (u16)(le32_to_cpu(data) & 0xffff);
 }
 
 static u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr)
 {
-	u8 request;
 	u8 requesttype;
 	u16 wvalue;
 	u16 index;
 	u16 len;
 	__le32 data;
 
-	request = 0x05;
 	requesttype = 0x01;/* read_in */
 	index = 0;/* n/a */
 
 	wvalue = (u16)(addr & 0x0000ffff);
 	len = 4;
 
-	usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype);
+	usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype);
 
 	return le32_to_cpu(data);
 }
 
 static int usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val)
 {
-	u8 request;
 	u8 requesttype;
 	u16 wvalue;
 	u16 index;
@@ -176,20 +170,18 @@ static int usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val)
 	int ret;
 
 
-	request = 0x05;
 	requesttype = 0x00;/* write_out */
 	index = 0;/* n/a */
 	wvalue = (u16)(addr & 0x0000ffff);
 	len = 1;
 	data = val;
-	ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype);
+	ret = usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype);
 
 	return ret;
 }
 
 static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
 {
-	u8 request;
 	u8 requesttype;
 	u16 wvalue;
 	u16 index;
@@ -199,7 +191,6 @@ static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
 
 
 
-	request = 0x05;
 	requesttype = 0x00;/* write_out */
 	index = 0;/* n/a */
 
@@ -208,7 +199,7 @@ static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
 
 	data = cpu_to_le32(val & 0x0000ffff);
 
-	ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype);
+	ret = usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype);
 
 
 
@@ -217,7 +208,6 @@ static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
 
 static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
 {
-	u8 request;
 	u8 requesttype;
 	u16 wvalue;
 	u16 index;
@@ -227,7 +217,6 @@ static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
 
 
 
-	request = 0x05;
 	requesttype = 0x00;/* write_out */
 	index = 0;/* n/a */
 
@@ -235,7 +224,7 @@ static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
 	len = 4;
 	data = cpu_to_le32(val);
 
-	ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype);
+	ret = usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype);
 
 
 
@@ -244,7 +233,6 @@ static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
 
 static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata)
 {
-	u8 request;
 	u8 requesttype;
 	u16 wvalue;
 	u16 index;
@@ -254,7 +242,6 @@ static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata
 
 
 
-	request = 0x05;
 	requesttype = 0x00;/* write_out */
 	index = 0;/* n/a */
 
@@ -262,7 +249,7 @@ static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata
 	len = length;
 	memcpy(buf, pdata, len);
 
-	ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index, buf, len, requesttype);
+	ret = usbctrl_vendorreq(pintfhdl, wvalue, index, buf, len, requesttype);
 
 	return ret;
 }
-- 
2.20.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] staging: r8188eu: ctrl vendor req index is not used
  2021-08-18 20:00 [PATCH 1/2] staging: r8188eu: ctrl vendor req value is always 0x05 Martin Kaiser
@ 2021-08-18 20:00 ` Martin Kaiser
  2021-08-18 20:34   ` Phillip Potter
  2021-08-18 20:33 ` [PATCH 1/2] staging: r8188eu: ctrl vendor req value is always 0x05 Phillip Potter
  1 sibling, 1 reply; 4+ messages in thread
From: Martin Kaiser @ 2021-08-18 20:00 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Dan Carpenter, Michael Straube,
	linux-staging, linux-kernel, Martin Kaiser

The index for r8188eu's vendor-specific control requests is not used.
Remove the index parameter from usbctrl_vendorreq and pass index 0 to
usb_control_msg.

This patch is an adaptation of commit 3d0be94f62fd ("staging: rtl8188eu:
ctrl vendor req index is not used") for the new r8188eu driver.

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

diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c
index 2583e3a941fd..953fa05dc30c 100644
--- a/drivers/staging/r8188eu/hal/usb_ops_linux.c
+++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c
@@ -10,7 +10,7 @@
 #include "../include/recv_osdep.h"
 #include "../include/rtl8188e_hal.h"
 
-static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u16 value, u16 index, void *pdata, u16 len, u8 requesttype)
+static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u16 value, void *pdata, u16 len, u8 requesttype)
 {
 	struct adapter	*adapt = pintfhdl->padapter;
 	struct dvobj_priv  *dvobjpriv = adapter_to_dvobj(adapt);
@@ -56,7 +56,8 @@ static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u16 value, u16 index, vo
 		}
 
 		status = usb_control_msg(udev, pipe, REALTEK_USB_VENQT_CMD_REQ,
-					 reqtype, value, index, pIo_buf, len, RTW_USB_CONTROL_MSG_TIMEOUT);
+					 reqtype, value, REALTEK_USB_VENQT_CMD_IDX,
+					 pIo_buf, len, RTW_USB_CONTROL_MSG_TIMEOUT);
 
 		if (status == len) {   /*  Success this control transfer. */
 			rtw_reset_continual_urb_error(dvobjpriv);
@@ -104,19 +105,17 @@ static u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr)
 {
 	u8 requesttype;
 	u16 wvalue;
-	u16 index;
 	u16 len;
 	u8 data = 0;
 
 
 
 	requesttype = 0x01;/* read_in */
-	index = 0;/* n/a */
 
 	wvalue = (u16)(addr & 0x0000ffff);
 	len = 1;
 
-	usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype);
+	usbctrl_vendorreq(pintfhdl, wvalue, &data, len, requesttype);
 
 
 
@@ -128,15 +127,13 @@ static u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr)
 {
 	u8 requesttype;
 	u16 wvalue;
-	u16 index;
 	u16 len;
 	__le32 data;
 
 	requesttype = 0x01;/* read_in */
-	index = 0;/* n/a */
 	wvalue = (u16)(addr & 0x0000ffff);
 	len = 2;
-	usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype);
+	usbctrl_vendorreq(pintfhdl, wvalue, &data, len, requesttype);
 
 	return (u16)(le32_to_cpu(data) & 0xffff);
 }
@@ -145,17 +142,15 @@ static u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr)
 {
 	u8 requesttype;
 	u16 wvalue;
-	u16 index;
 	u16 len;
 	__le32 data;
 
 	requesttype = 0x01;/* read_in */
-	index = 0;/* n/a */
 
 	wvalue = (u16)(addr & 0x0000ffff);
 	len = 4;
 
-	usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype);
+	usbctrl_vendorreq(pintfhdl, wvalue, &data, len, requesttype);
 
 	return le32_to_cpu(data);
 }
@@ -164,18 +159,16 @@ static int usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val)
 {
 	u8 requesttype;
 	u16 wvalue;
-	u16 index;
 	u16 len;
 	u8 data;
 	int ret;
 
 
 	requesttype = 0x00;/* write_out */
-	index = 0;/* n/a */
 	wvalue = (u16)(addr & 0x0000ffff);
 	len = 1;
 	data = val;
-	ret = usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype);
+	ret = usbctrl_vendorreq(pintfhdl, wvalue, &data, len, requesttype);
 
 	return ret;
 }
@@ -184,7 +177,6 @@ static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
 {
 	u8 requesttype;
 	u16 wvalue;
-	u16 index;
 	u16 len;
 	__le32 data;
 	int ret;
@@ -192,14 +184,13 @@ static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
 
 
 	requesttype = 0x00;/* write_out */
-	index = 0;/* n/a */
 
 	wvalue = (u16)(addr & 0x0000ffff);
 	len = 2;
 
 	data = cpu_to_le32(val & 0x0000ffff);
 
-	ret = usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype);
+	ret = usbctrl_vendorreq(pintfhdl, wvalue, &data, len, requesttype);
 
 
 
@@ -210,7 +201,6 @@ static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
 {
 	u8 requesttype;
 	u16 wvalue;
-	u16 index;
 	u16 len;
 	__le32 data;
 	int ret;
@@ -218,13 +208,12 @@ static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
 
 
 	requesttype = 0x00;/* write_out */
-	index = 0;/* n/a */
 
 	wvalue = (u16)(addr & 0x0000ffff);
 	len = 4;
 	data = cpu_to_le32(val);
 
-	ret = usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype);
+	ret = usbctrl_vendorreq(pintfhdl, wvalue, &data, len, requesttype);
 
 
 
@@ -235,7 +224,6 @@ static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata
 {
 	u8 requesttype;
 	u16 wvalue;
-	u16 index;
 	u16 len;
 	u8 buf[VENDOR_CMD_MAX_DATA_LEN] = {0};
 	int ret;
@@ -243,13 +231,12 @@ static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata
 
 
 	requesttype = 0x00;/* write_out */
-	index = 0;/* n/a */
 
 	wvalue = (u16)(addr & 0x0000ffff);
 	len = length;
 	memcpy(buf, pdata, len);
 
-	ret = usbctrl_vendorreq(pintfhdl, wvalue, index, buf, len, requesttype);
+	ret = usbctrl_vendorreq(pintfhdl, wvalue, buf, len, requesttype);
 
 	return ret;
 }
-- 
2.20.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] staging: r8188eu: ctrl vendor req value is always 0x05
  2021-08-18 20:00 [PATCH 1/2] staging: r8188eu: ctrl vendor req value is always 0x05 Martin Kaiser
  2021-08-18 20:00 ` [PATCH 2/2] staging: r8188eu: ctrl vendor req index is not used Martin Kaiser
@ 2021-08-18 20:33 ` Phillip Potter
  1 sibling, 0 replies; 4+ messages in thread
From: Phillip Potter @ 2021-08-18 20:33 UTC (permalink / raw)
  To: Martin Kaiser
  Cc: Greg Kroah-Hartman, Larry Finger, Dan Carpenter, Michael Straube,
	linux-staging, Linux Kernel Mailing List

On Wed, 18 Aug 2021 at 21:00, Martin Kaiser <martin@kaiser.cx> wrote:
>
> The bRequest value for the vendor specific control requests sent by this
> driver is always 0x05. Replace the function parameter with the define from
> usb_ops.h.
>
> This patch is an adaptation of commit eeb4661560ff ("staging: rtl8188eu:
> ctrl vendor req value is always 0x05") for the new r8188eu driver.
>
> Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> ---
>  drivers/staging/r8188eu/hal/usb_ops_linux.c | 33 +++++++--------------
>  1 file changed, 10 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c
> index b4edbfda9a18..2583e3a941fd 100644
> --- a/drivers/staging/r8188eu/hal/usb_ops_linux.c
> +++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c
> @@ -10,7 +10,7 @@
>  #include "../include/recv_osdep.h"
>  #include "../include/rtl8188e_hal.h"
>
> -static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u16 index, void *pdata, u16 len, u8 requesttype)
> +static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u16 value, u16 index, void *pdata, u16 len, u8 requesttype)
>  {
>         struct adapter  *adapt = pintfhdl->padapter;
>         struct dvobj_priv  *dvobjpriv = adapter_to_dvobj(adapt);
> @@ -55,7 +55,8 @@ static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u
>                         memcpy(pIo_buf, pdata, len);
>                 }
>
> -               status = usb_control_msg(udev, pipe, request, reqtype, value, index, pIo_buf, len, RTW_USB_CONTROL_MSG_TIMEOUT);
> +               status = usb_control_msg(udev, pipe, REALTEK_USB_VENQT_CMD_REQ,
> +                                        reqtype, value, index, pIo_buf, len, RTW_USB_CONTROL_MSG_TIMEOUT);
>
>                 if (status == len) {   /*  Success this control transfer. */
>                         rtw_reset_continual_urb_error(dvobjpriv);
> @@ -101,7 +102,6 @@ static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u8 request, u16 value, u
>
>  static u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr)
>  {
> -       u8 request;
>         u8 requesttype;
>         u16 wvalue;
>         u16 index;
> @@ -110,14 +110,13 @@ static u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr)
>
>
>
> -       request = 0x05;
>         requesttype = 0x01;/* read_in */
>         index = 0;/* n/a */
>
>         wvalue = (u16)(addr & 0x0000ffff);
>         len = 1;
>
> -       usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype);
> +       usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype);
>
>
>
> @@ -127,47 +126,42 @@ static u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr)
>
>  static u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr)
>  {
> -       u8 request;
>         u8 requesttype;
>         u16 wvalue;
>         u16 index;
>         u16 len;
>         __le32 data;
>
> -       request = 0x05;
>         requesttype = 0x01;/* read_in */
>         index = 0;/* n/a */
>         wvalue = (u16)(addr & 0x0000ffff);
>         len = 2;
> -       usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype);
> +       usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype);
>
>         return (u16)(le32_to_cpu(data) & 0xffff);
>  }
>
>  static u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr)
>  {
> -       u8 request;
>         u8 requesttype;
>         u16 wvalue;
>         u16 index;
>         u16 len;
>         __le32 data;
>
> -       request = 0x05;
>         requesttype = 0x01;/* read_in */
>         index = 0;/* n/a */
>
>         wvalue = (u16)(addr & 0x0000ffff);
>         len = 4;
>
> -       usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype);
> +       usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype);
>
>         return le32_to_cpu(data);
>  }
>
>  static int usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val)
>  {
> -       u8 request;
>         u8 requesttype;
>         u16 wvalue;
>         u16 index;
> @@ -176,20 +170,18 @@ static int usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val)
>         int ret;
>
>
> -       request = 0x05;
>         requesttype = 0x00;/* write_out */
>         index = 0;/* n/a */
>         wvalue = (u16)(addr & 0x0000ffff);
>         len = 1;
>         data = val;
> -       ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype);
> +       ret = usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype);
>
>         return ret;
>  }
>
>  static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
>  {
> -       u8 request;
>         u8 requesttype;
>         u16 wvalue;
>         u16 index;
> @@ -199,7 +191,6 @@ static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
>
>
>
> -       request = 0x05;
>         requesttype = 0x00;/* write_out */
>         index = 0;/* n/a */
>
> @@ -208,7 +199,7 @@ static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
>
>         data = cpu_to_le32(val & 0x0000ffff);
>
> -       ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype);
> +       ret = usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype);
>
>
>
> @@ -217,7 +208,6 @@ static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
>
>  static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
>  {
> -       u8 request;
>         u8 requesttype;
>         u16 wvalue;
>         u16 index;
> @@ -227,7 +217,6 @@ static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
>
>
>
> -       request = 0x05;
>         requesttype = 0x00;/* write_out */
>         index = 0;/* n/a */
>
> @@ -235,7 +224,7 @@ static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
>         len = 4;
>         data = cpu_to_le32(val);
>
> -       ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype);
> +       ret = usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype);
>
>
>
> @@ -244,7 +233,6 @@ static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
>
>  static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata)
>  {
> -       u8 request;
>         u8 requesttype;
>         u16 wvalue;
>         u16 index;
> @@ -254,7 +242,6 @@ static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata
>
>
>
> -       request = 0x05;
>         requesttype = 0x00;/* write_out */
>         index = 0;/* n/a */
>
> @@ -262,7 +249,7 @@ static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata
>         len = length;
>         memcpy(buf, pdata, len);
>
> -       ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index, buf, len, requesttype);
> +       ret = usbctrl_vendorreq(pintfhdl, wvalue, index, buf, len, requesttype);
>
>         return ret;
>  }
> --
> 2.20.1
>

Looks good.

Acked-by: Phillip Potter <phil@philpotter.co.uk>

Regards,
Phil

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] staging: r8188eu: ctrl vendor req index is not used
  2021-08-18 20:00 ` [PATCH 2/2] staging: r8188eu: ctrl vendor req index is not used Martin Kaiser
@ 2021-08-18 20:34   ` Phillip Potter
  0 siblings, 0 replies; 4+ messages in thread
From: Phillip Potter @ 2021-08-18 20:34 UTC (permalink / raw)
  To: Martin Kaiser
  Cc: Greg Kroah-Hartman, Larry Finger, Dan Carpenter, Michael Straube,
	linux-staging, Linux Kernel Mailing List

On Wed, 18 Aug 2021 at 21:01, Martin Kaiser <martin@kaiser.cx> wrote:
>
> The index for r8188eu's vendor-specific control requests is not used.
> Remove the index parameter from usbctrl_vendorreq and pass index 0 to
> usb_control_msg.
>
> This patch is an adaptation of commit 3d0be94f62fd ("staging: rtl8188eu:
> ctrl vendor req index is not used") for the new r8188eu driver.
>
> Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> ---
>  drivers/staging/r8188eu/hal/usb_ops_linux.c | 33 +++++++--------------
>  1 file changed, 10 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c
> index 2583e3a941fd..953fa05dc30c 100644
> --- a/drivers/staging/r8188eu/hal/usb_ops_linux.c
> +++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c
> @@ -10,7 +10,7 @@
>  #include "../include/recv_osdep.h"
>  #include "../include/rtl8188e_hal.h"
>
> -static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u16 value, u16 index, void *pdata, u16 len, u8 requesttype)
> +static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u16 value, void *pdata, u16 len, u8 requesttype)
>  {
>         struct adapter  *adapt = pintfhdl->padapter;
>         struct dvobj_priv  *dvobjpriv = adapter_to_dvobj(adapt);
> @@ -56,7 +56,8 @@ static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u16 value, u16 index, vo
>                 }
>
>                 status = usb_control_msg(udev, pipe, REALTEK_USB_VENQT_CMD_REQ,
> -                                        reqtype, value, index, pIo_buf, len, RTW_USB_CONTROL_MSG_TIMEOUT);
> +                                        reqtype, value, REALTEK_USB_VENQT_CMD_IDX,
> +                                        pIo_buf, len, RTW_USB_CONTROL_MSG_TIMEOUT);
>
>                 if (status == len) {   /*  Success this control transfer. */
>                         rtw_reset_continual_urb_error(dvobjpriv);
> @@ -104,19 +105,17 @@ static u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr)
>  {
>         u8 requesttype;
>         u16 wvalue;
> -       u16 index;
>         u16 len;
>         u8 data = 0;
>
>
>
>         requesttype = 0x01;/* read_in */
> -       index = 0;/* n/a */
>
>         wvalue = (u16)(addr & 0x0000ffff);
>         len = 1;
>
> -       usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype);
> +       usbctrl_vendorreq(pintfhdl, wvalue, &data, len, requesttype);
>
>
>
> @@ -128,15 +127,13 @@ static u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr)
>  {
>         u8 requesttype;
>         u16 wvalue;
> -       u16 index;
>         u16 len;
>         __le32 data;
>
>         requesttype = 0x01;/* read_in */
> -       index = 0;/* n/a */
>         wvalue = (u16)(addr & 0x0000ffff);
>         len = 2;
> -       usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype);
> +       usbctrl_vendorreq(pintfhdl, wvalue, &data, len, requesttype);
>
>         return (u16)(le32_to_cpu(data) & 0xffff);
>  }
> @@ -145,17 +142,15 @@ static u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr)
>  {
>         u8 requesttype;
>         u16 wvalue;
> -       u16 index;
>         u16 len;
>         __le32 data;
>
>         requesttype = 0x01;/* read_in */
> -       index = 0;/* n/a */
>
>         wvalue = (u16)(addr & 0x0000ffff);
>         len = 4;
>
> -       usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype);
> +       usbctrl_vendorreq(pintfhdl, wvalue, &data, len, requesttype);
>
>         return le32_to_cpu(data);
>  }
> @@ -164,18 +159,16 @@ static int usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val)
>  {
>         u8 requesttype;
>         u16 wvalue;
> -       u16 index;
>         u16 len;
>         u8 data;
>         int ret;
>
>
>         requesttype = 0x00;/* write_out */
> -       index = 0;/* n/a */
>         wvalue = (u16)(addr & 0x0000ffff);
>         len = 1;
>         data = val;
> -       ret = usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype);
> +       ret = usbctrl_vendorreq(pintfhdl, wvalue, &data, len, requesttype);
>
>         return ret;
>  }
> @@ -184,7 +177,6 @@ static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
>  {
>         u8 requesttype;
>         u16 wvalue;
> -       u16 index;
>         u16 len;
>         __le32 data;
>         int ret;
> @@ -192,14 +184,13 @@ static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
>
>
>         requesttype = 0x00;/* write_out */
> -       index = 0;/* n/a */
>
>         wvalue = (u16)(addr & 0x0000ffff);
>         len = 2;
>
>         data = cpu_to_le32(val & 0x0000ffff);
>
> -       ret = usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype);
> +       ret = usbctrl_vendorreq(pintfhdl, wvalue, &data, len, requesttype);
>
>
>
> @@ -210,7 +201,6 @@ static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
>  {
>         u8 requesttype;
>         u16 wvalue;
> -       u16 index;
>         u16 len;
>         __le32 data;
>         int ret;
> @@ -218,13 +208,12 @@ static int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
>
>
>         requesttype = 0x00;/* write_out */
> -       index = 0;/* n/a */
>
>         wvalue = (u16)(addr & 0x0000ffff);
>         len = 4;
>         data = cpu_to_le32(val);
>
> -       ret = usbctrl_vendorreq(pintfhdl, wvalue, index, &data, len, requesttype);
> +       ret = usbctrl_vendorreq(pintfhdl, wvalue, &data, len, requesttype);
>
>
>
> @@ -235,7 +224,6 @@ static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata
>  {
>         u8 requesttype;
>         u16 wvalue;
> -       u16 index;
>         u16 len;
>         u8 buf[VENDOR_CMD_MAX_DATA_LEN] = {0};
>         int ret;
> @@ -243,13 +231,12 @@ static int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata
>
>
>         requesttype = 0x00;/* write_out */
> -       index = 0;/* n/a */
>
>         wvalue = (u16)(addr & 0x0000ffff);
>         len = length;
>         memcpy(buf, pdata, len);
>
> -       ret = usbctrl_vendorreq(pintfhdl, wvalue, index, buf, len, requesttype);
> +       ret = usbctrl_vendorreq(pintfhdl, wvalue, buf, len, requesttype);
>
>         return ret;
>  }
> --
> 2.20.1
>

Looks good.

Acked-by: Phillip Potter <phil@philpotter.co.uk>

Regards,
Phil

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-18 20:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-18 20:00 [PATCH 1/2] staging: r8188eu: ctrl vendor req value is always 0x05 Martin Kaiser
2021-08-18 20:00 ` [PATCH 2/2] staging: r8188eu: ctrl vendor req index is not used Martin Kaiser
2021-08-18 20:34   ` Phillip Potter
2021-08-18 20:33 ` [PATCH 1/2] staging: r8188eu: ctrl vendor req value is always 0x05 Phillip Potter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).