diff options
| author | Fabio M. De Francesco <[email protected]> | 2021-09-24 14:27:03 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2021-09-27 17:37:12 +0200 |
| commit | 46f0b1ad5be8dfebce62a2187bf25f6b4811be95 (patch) | |
| tree | 23aeefa2a860898aeb2eb6f1c7226b5972cdf31c /tools/perf/scripts/python/Perf-Trace-Util | |
| parent | 27ed9834bc661b45779ffdb379eb19679c1297d0 (diff) | |
staging: r8188eu: call new usb_write() from rtw_write{8,16,32,N}()
Create and call new usb_write() instead of usbctrl_vendorreq() from
inside rtw_write{8,16,32,N}().
In old code, rtw_write{8,16,32,N}() called usbctrl_vendorreq() which in
turn uses usb_control_msg() from within a "while" loop to build a control
URB, send it off and wait for completion. usbctrl_vendorreq() was used
for both receiving and sending messages, depending on the "requesttype"
argument which is passed by callers.
Compared to usbctrl_vendorreq(), which manages both reads and writes
from and to the USB endpoint, the new usb_write() manages only writes.
For this purpose it uses the newer USB Core usb_control_msg_send() API.
The latter is preferred according both to suggestions by Greg Kroah-Hartman
and also to its actual design.
A noteworthy feature of usb_control_msg_send() is that the data pointer
can be made to a reference on the stack because it does not have the
restriction that usb_control_msg() has where the data pointer must be to
dynamically allocated memory.
usbctrl_vendorreq() used a "while" loop that we considered unnecessary
so that it is not in the new usb_write(). Furthermore, the latter has no
redundant checking, less obvious comments, no debug prints, and it manages
errors before success case. All in all, usb_write() is simpler than
usbctrl_vendorreq() and uses less lines of code.
Suggested-by: Greg Kroah-Hartman <[email protected]>
Co-developed-by: Pavel Skripkin <[email protected]>
Signed-off-by: Pavel Skripkin <[email protected]>
Signed-off-by: Fabio M. De Francesco <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/Perf-Trace-Util')
0 files changed, 0 insertions, 0 deletions