Re: [PATCH RFC] staging: r8188eu: Use usb_control_msg_recv/send() in usbctrl_vendorreq()
From: Pavel Skripkin <hidden>
Date: 2021-08-23 11:05:25
Also in:
lkml
On 8/23/21 1:47 PM, Fabio M. De Francesco wrote:
On Monday, August 23, 2021 10:11:52 AM CEST Pavel Skripkin wrote:quoted
On 8/23/21 2:02 AM, Fabio M. De Francesco wrote:quoted
Replace usb_control_msg() with the new usb_control_msg_recv() and usb_control_msg_send() API of USB Core. This patch is an RFC for different reasons: 1) I'm not sure if it is needed: while Greg Kroah-Hartman suggested to use the new API in a message to a thread that was about a series of patches submitted by Pavel Skripkin (who decided to not use it), I cannot explain if and why the driver would benefit from this patch. 2) I have doubts about the semantic of the API I use here, so I'd like to know whether or not I'm using them properly. 3) At the moment I cannot test the driver because I don't have my device with me. 4) This patch could probably lead to a slight change in some lines of Pavel's series (for sure in usb_read*()). I'd like to hear from the Maintainers and other interested people if this patch is worth to be considered and, in this case, if there are suggestions for the purpose to improve it. Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Fabio M. De Francesco <redacted> --- drivers/staging/r8188eu/hal/usb_ops_linux.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)diff --git a/drivers/staging/r8188eu/hal/usb_ops_linux.c b/drivers/staging/r8188eu/hal/usb_ops_linux.c index 6a0a24acf292..9e290c1cc449 100644 --- a/drivers/staging/r8188eu/hal/usb_ops_linux.c +++ b/drivers/staging/r8188eu/hal/usb_ops_linux.c@@ -15,7 +15,7 @@ static int usbctrl_vendorreq(struct intf_hdl *pintfhdl, u16 value, void *pdata, struct adapter *adapt = pintfhdl->padapter; struct dvobj_priv *dvobjpriv = adapter_to_dvobj(adapt); struct usb_device *udev = dvobjpriv->pusbdev; - unsigned int pipe; + u8 pipe; int status = 0; u8 reqtype;I think, we can pass REALTEK_USB_VENQT_{READ,WRITE} directly as requesttype argument and get rid of u8 reqtype. + we can define these macros: #define usbctrl_vendor_read(...) usbctrl_vendorreq(...,REALTEK_USB_VENQT_READ) #define usbctrl_vendor_write() usbctrl_vendorreq(...,REALTEK_USB_VENQT_WRITE) This will make code more nice, IMO :)Dear Pavel, I agree in full: nicer and cleaner :) I'll do that, but please notice that I will also need to change the code of the three usb_read*() for calling usbctrl_vendor_read(). Furthermore, "else res = 0;" becomes unnecessary. Please take these changes into account when you'll send them again as "regular" patches.
It depends on which patch will go in first. There are a lot of upcoming clean ups, so I am waiting for merging my series with random clean ups :) A lot of fun... I biggest hope is that my series will go in before camel-case clean ups, because rewriting this for the 3rd time will kill my mind... With regards, Pavel Skripkin