aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/event_analyzing_sample.py
diff options
context:
space:
mode:
authorFabio M. De Francesco <[email protected]>2021-09-24 14:27:02 +0200
committerGreg Kroah-Hartman <[email protected]>2021-09-27 17:37:12 +0200
commit27ed9834bc661b45779ffdb379eb19679c1297d0 (patch)
tree2016dbdebfe49216c14de1838b6fc944eb688d14 /tools/perf/scripts/python/event_analyzing_sample.py
parenta6db0cd3d414c981fcf992026b75358f7ce23dd5 (diff)
staging: r8188eu: call new usb_read() from rtw_read{8,16,32}()
Create and call new usb_read() instead of usbctrl_vendorreq() from inside rtw_read{8,16,32}(). In old code, rtw_read{8,16,32}() 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 was passed by callers. Compared to usbctrl_vendorreq(), which managed both reads and writes from and to the USB endpoint, the new usb_read() manages only reads. For this purpose it uses the newer USB Core usb_control_msg_recv() API. The latter is preferred according both to a suggestion by Greg Kroah-Hartman and also to its actual design. Two noteworthy features of usb_control_msg_recv() are that (1) 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, and that (2) the whole message must be properly received from the device in order for this function to be successfuli (if a device returns less than the expected amount of data, then the function will fail). usbctrl_vendorreq() uses a "while" loop that we considered unnecessary so that it is not in the new usb_read(). Furthermore, the latter has no redundant checking, less obvious comments, and it manages errors before success cases. All in all, usb_read() 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/event_analyzing_sample.py')
0 files changed, 0 insertions, 0 deletions