USB: add usb_control_msg_send() and usb_control_msg_recv()
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Sep 2020 15:37:47 +0000 (17:37 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Sep 2020 09:02:32 +0000 (11:02 +0200)
commit719b8f2850d3d9b863cc5e4f08e9ef0206e45b26
treea6f460edb0ff43c6a047071f2927e982b852ebe4
parentfcc2cc1f35613c016e1de25bb001bfdd9eaa25f9
USB: add usb_control_msg_send() and usb_control_msg_recv()

New core functions to make sending/receiving USB control messages easier
and saner.

In discussions, it turns out that the large majority of users of
usb_control_msg() do so in potentially incorrect ways.  The most common
issue is where a "short" message is received, yet never detected
properly due to "incorrect" error handling.

Handle all of this in the USB core with two new functions to try to make
working with USB control messages simpler.

No more need for dynamic data, messages can be on the stack, and only
"complete" send/receive will work without causing an error.

Link: https://lore.kernel.org/r/20200914153756.3412156-3-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/message.c
include/linux/usb.h