USB: serial: f81232: use usb_control_msg_recv() and usb_control_msg_send()
authorHimadri Pandya <himadrispandya@gmail.com>
Sun, 1 Aug 2021 20:31:19 +0000 (02:01 +0530)
committerJohan Hovold <johan@kernel.org>
Tue, 21 Sep 2021 12:01:14 +0000 (14:01 +0200)
commit0d027eea8988a9d9ec2ca4df150b37d82e9e6623
tree97fde8012e3940572951bd8781ee27590851729d
parent6400b974910407cd299dc08578a6c1792b4c922a
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.

Signed-off-by: Himadri Pandya <himadrispandya@gmail.com>
Link: https://lore.kernel.org/r/20210801203122.3515-4-himadrispandya@gmail.com
[ johan: amend commit message ]
Signed-off-by: Johan Hovold <johan@kernel.org>
drivers/usb/serial/f81232.c