2021-10-25 18:07:04

by Johan Hovold

[permalink] [raw]
Subject: [PATCH 0/2] staging: fix control-message timeouts

A number of drivers throughout the tree were incorrectly specifying USB
message timeout values in jiffies instead of milliseconds.

This series fixes the staging drivers that got it wrong.

Johan


Johan Hovold (2):
staging: rtl8192u: fix control-message timeouts
staging: r8712u: fix control-message timeout

drivers/staging/rtl8192u/r8192U_core.c | 18 +++++++++---------
drivers/staging/rtl8712/usb_ops_linux.c | 2 +-
2 files changed, 10 insertions(+), 10 deletions(-)

--
2.32.0


2021-10-25 18:07:04

by Johan Hovold

[permalink] [raw]
Subject: [PATCH 1/2] staging: rtl8192u: fix control-message timeouts

USB control-message timeouts are specified in milliseconds and should
specifically not vary with CONFIG_HZ.

Fixes: 8fc8598e61f6 ("Staging: Added Realtek rtl8192u driver to staging")
Cc: [email protected] # 2.6.33
Signed-off-by: Johan Hovold <[email protected]>
---
drivers/staging/rtl8192u/r8192U_core.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
index b6698656fc01..cf5cfee2936f 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -229,7 +229,7 @@ int write_nic_byte_E(struct net_device *dev, int indx, u8 data)

status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
- indx | 0xfe00, 0, usbdata, 1, HZ / 2);
+ indx | 0xfe00, 0, usbdata, 1, 500);
kfree(usbdata);

if (status < 0) {
@@ -251,7 +251,7 @@ int read_nic_byte_E(struct net_device *dev, int indx, u8 *data)

status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
- indx | 0xfe00, 0, usbdata, 1, HZ / 2);
+ indx | 0xfe00, 0, usbdata, 1, 500);
*data = *usbdata;
kfree(usbdata);

@@ -279,7 +279,7 @@ int write_nic_byte(struct net_device *dev, int indx, u8 data)
status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
(indx & 0xff) | 0xff00, (indx >> 8) & 0x0f,
- usbdata, 1, HZ / 2);
+ usbdata, 1, 500);
kfree(usbdata);

if (status < 0) {
@@ -305,7 +305,7 @@ int write_nic_word(struct net_device *dev, int indx, u16 data)
status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
(indx & 0xff) | 0xff00, (indx >> 8) & 0x0f,
- usbdata, 2, HZ / 2);
+ usbdata, 2, 500);
kfree(usbdata);

if (status < 0) {
@@ -331,7 +331,7 @@ int write_nic_dword(struct net_device *dev, int indx, u32 data)
status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
(indx & 0xff) | 0xff00, (indx >> 8) & 0x0f,
- usbdata, 4, HZ / 2);
+ usbdata, 4, 500);
kfree(usbdata);

if (status < 0) {
@@ -355,7 +355,7 @@ int read_nic_byte(struct net_device *dev, int indx, u8 *data)
status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
(indx & 0xff) | 0xff00, (indx >> 8) & 0x0f,
- usbdata, 1, HZ / 2);
+ usbdata, 1, 500);
*data = *usbdata;
kfree(usbdata);

@@ -380,7 +380,7 @@ int read_nic_word(struct net_device *dev, int indx, u16 *data)
status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
(indx & 0xff) | 0xff00, (indx >> 8) & 0x0f,
- usbdata, 2, HZ / 2);
+ usbdata, 2, 500);
*data = *usbdata;
kfree(usbdata);

@@ -404,7 +404,7 @@ static int read_nic_word_E(struct net_device *dev, int indx, u16 *data)

status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
- indx | 0xfe00, 0, usbdata, 2, HZ / 2);
+ indx | 0xfe00, 0, usbdata, 2, 500);
*data = *usbdata;
kfree(usbdata);

@@ -430,7 +430,7 @@ int read_nic_dword(struct net_device *dev, int indx, u32 *data)
status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
(indx & 0xff) | 0xff00, (indx >> 8) & 0x0f,
- usbdata, 4, HZ / 2);
+ usbdata, 4, 500);
*data = *usbdata;
kfree(usbdata);

--
2.32.0

2021-10-25 19:03:43

by Larry Finger

[permalink] [raw]
Subject: Re: [PATCH 1/2] staging: rtl8192u: fix control-message timeouts

On 10/25/21 07:09, Johan Hovold wrote:
> USB control-message timeouts are specified in milliseconds and should
> specifically not vary with CONFIG_HZ.
>
> Fixes: 8fc8598e61f6 ("Staging: Added Realtek rtl8192u driver to staging")
> Cc: [email protected] # 2.6.33
> Signed-off-by: Johan Hovold <[email protected]>
> ---
> drivers/staging/rtl8192u/r8192U_core.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)

I would have preferred that you not use the magic number "500", but the patch is OK.

Acked-by: Larry Finger <[email protected]>

Larry

>
> diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
> index b6698656fc01..cf5cfee2936f 100644
> --- a/drivers/staging/rtl8192u/r8192U_core.c
> +++ b/drivers/staging/rtl8192u/r8192U_core.c
> @@ -229,7 +229,7 @@ int write_nic_byte_E(struct net_device *dev, int indx, u8 data)
>
> status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
> RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
> - indx | 0xfe00, 0, usbdata, 1, HZ / 2);
> + indx | 0xfe00, 0, usbdata, 1, 500);
> kfree(usbdata);
>
> if (status < 0) {
> @@ -251,7 +251,7 @@ int read_nic_byte_E(struct net_device *dev, int indx, u8 *data)
>
> status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
> RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
> - indx | 0xfe00, 0, usbdata, 1, HZ / 2);
> + indx | 0xfe00, 0, usbdata, 1, 500);
> *data = *usbdata;
> kfree(usbdata);
>
> @@ -279,7 +279,7 @@ int write_nic_byte(struct net_device *dev, int indx, u8 data)
> status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
> RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
> (indx & 0xff) | 0xff00, (indx >> 8) & 0x0f,
> - usbdata, 1, HZ / 2);
> + usbdata, 1, 500);
> kfree(usbdata);
>
> if (status < 0) {
> @@ -305,7 +305,7 @@ int write_nic_word(struct net_device *dev, int indx, u16 data)
> status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
> RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
> (indx & 0xff) | 0xff00, (indx >> 8) & 0x0f,
> - usbdata, 2, HZ / 2);
> + usbdata, 2, 500);
> kfree(usbdata);
>
> if (status < 0) {
> @@ -331,7 +331,7 @@ int write_nic_dword(struct net_device *dev, int indx, u32 data)
> status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
> RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
> (indx & 0xff) | 0xff00, (indx >> 8) & 0x0f,
> - usbdata, 4, HZ / 2);
> + usbdata, 4, 500);
> kfree(usbdata);
>
> if (status < 0) {
> @@ -355,7 +355,7 @@ int read_nic_byte(struct net_device *dev, int indx, u8 *data)
> status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
> RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
> (indx & 0xff) | 0xff00, (indx >> 8) & 0x0f,
> - usbdata, 1, HZ / 2);
> + usbdata, 1, 500);
> *data = *usbdata;
> kfree(usbdata);
>
> @@ -380,7 +380,7 @@ int read_nic_word(struct net_device *dev, int indx, u16 *data)
> status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
> RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
> (indx & 0xff) | 0xff00, (indx >> 8) & 0x0f,
> - usbdata, 2, HZ / 2);
> + usbdata, 2, 500);
> *data = *usbdata;
> kfree(usbdata);
>
> @@ -404,7 +404,7 @@ static int read_nic_word_E(struct net_device *dev, int indx, u16 *data)
>
> status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
> RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
> - indx | 0xfe00, 0, usbdata, 2, HZ / 2);
> + indx | 0xfe00, 0, usbdata, 2, 500);
> *data = *usbdata;
> kfree(usbdata);
>
> @@ -430,7 +430,7 @@ int read_nic_dword(struct net_device *dev, int indx, u32 *data)
> status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
> RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
> (indx & 0xff) | 0xff00, (indx >> 8) & 0x0f,
> - usbdata, 4, HZ / 2);
> + usbdata, 4, 500);
> *data = *usbdata;
> kfree(usbdata);
>
>