diff options
| author | Alan Stern <stern@rowland.harvard.edu> | 2023-08-04 15:12:21 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-08-08 10:45:32 +0200 |
| commit | de28e469da75359a2bb8cd8778b78aa64b1be1f4 (patch) | |
| tree | 7bb3ea32ca3bb69414eb43633ec50529b347f087 /drivers/usb/core/usb.h | |
| parent | USB: core: Unite old scheme and new scheme descriptor reads (diff) | |
| download | linux-de28e469da75359a2bb8cd8778b78aa64b1be1f4.tar.gz linux-de28e469da75359a2bb8cd8778b78aa64b1be1f4.zip | |
USB: core: Change usb_get_device_descriptor() API
The usb_get_device_descriptor() routine reads the device descriptor
from the udev device and stores it directly in udev->descriptor. This
interface is error prone, because the USB subsystem expects in-memory
copies of a device's descriptors to be immutable once the device has
been initialized.
The interface is changed so that the device descriptor is left in a
kmalloc-ed buffer, not copied into the usb_device structure. A
pointer to the buffer is returned to the caller, who is then
responsible for kfree-ing it. The corresponding changes needed in the
various callers are fairly small.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/d0111bb6-56c1-4f90-adf2-6cfe152f6561@rowland.harvard.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core/usb.h')
| -rw-r--r-- | drivers/usb/core/usb.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h index 69ca59841083..60363153fc3f 100644 --- a/drivers/usb/core/usb.h +++ b/drivers/usb/core/usb.h @@ -43,8 +43,8 @@ extern bool usb_endpoint_is_ignored(struct usb_device *udev, struct usb_endpoint_descriptor *epd); extern int usb_remove_device(struct usb_device *udev); -extern int usb_get_device_descriptor(struct usb_device *dev, - unsigned int size); +extern struct usb_device_descriptor *usb_get_device_descriptor( + struct usb_device *udev); extern int usb_set_isoch_delay(struct usb_device *dev); extern int usb_get_bos_descriptor(struct usb_device *dev); extern void usb_release_bos_descriptor(struct usb_device *dev); |
