Re: [PATCH 14/15] usb: serial: keyspan_pda: use usb_control_msg_recv() and usb_control_msg_send()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 04, 2020 at 12:17:02PM +0530, Himadri Pandya wrote:
> The new usb_control_msg_recv() and usb_control_msg_send() nicely wraps
> usb_control_msg() with proper error check. Hence use the wrappers
> instead of calling usb_control_msg() directly.
> 
> Signed-off-by: Himadri Pandya <himadrispandya@xxxxxxxxx>
> ---
>  drivers/usb/serial/keyspan_pda.c | 172 +++++++++++++------------------
>  1 file changed, 72 insertions(+), 100 deletions(-)
> 
> diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
> index c1333919716b..44e1c4490fa9 100644
> --- a/drivers/usb/serial/keyspan_pda.c
> +++ b/drivers/usb/serial/keyspan_pda.c

There were some changes done to this driver around the same time that
you submitted these so this one needs to be rebased.

> @@ -359,22 +361,11 @@ static int keyspan_pda_get_modem_info(struct usb_serial *serial,
>  				      unsigned char *value)
>  {
>  	int rc;
> -	u8 *data;
> -
> -	data = kmalloc(1, GFP_KERNEL);
> -	if (!data)
> -		return -ENOMEM;
> -
> -	rc = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
> -			     3, /* get pins */
> -			     USB_TYPE_VENDOR|USB_RECIP_INTERFACE|USB_DIR_IN,
> -			     0, 0, data, 1, 2000);
> -	if (rc == 1)
> -		*value = *data;
> -	else if (rc >= 0)
> -		rc = -EIO;
> -
> -	kfree(data);
> +	rc = usb_control_msg_recv(serial->dev, 0,
> +				  3, /* get pins */
> +				  USB_TYPE_VENDOR | USB_RECIP_INTERFACE |
> +				  USB_DIR_IN, 0, 0, value, 1, 2000,
> +				  GFP_KERNEL);
>  	return rc;
>  }

Please only change the requests with a data stage like this one, but
avoid breaking the request argument over multiple lines.

Johan



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux