Re: [PATCH v2 3/6] USB: serial: f81232: use usb_control_msg_recv() and usb_control_msg_send()
From: Johan Hovold
Date: Tue Sep 21 2021 - 08:06:44 EST
On Mon, Aug 02, 2021 at 02:01:19AM +0530, Himadri Pandya wrote:
> New wrapper functions usb_control_msg_send/recv accept stack variables
> for usb message buffer and eliminate the need of creating temporary dma
> buffers. The wrappers also have proper error checks for short
> read/writes. Hence use the wrappers instead of using usb_control_msg()
> directly.
>
> Signed-off-by: Himadri Pandya <himadrispandya@xxxxxxxxx>
I amended the commit message as follows when applying this one:
USB: serial: f81232: use usb_control_msg_recv() and usb_control_msg_send()
The new wrapper functions usb_control_msg_send/recv accept stack
variables for USB message buffers and eliminate the need of manually
allocating temporary DMA buffers. The read wrapper also treats short
reads as errors. Hence use the wrappers instead of using
usb_control_msg() directly.
Note that the conversion of f81534a_ctrl_set_register() adds an extra an
extra allocation and memcpy for every retry. Since this function is
called rarely and retries are hopefully rare, the overhead should be
acceptable.
Also note that short reads are now logged as -EREMOTEIO instead of
indicating the amount of data read.
Johan