summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/usb_handle_request.c
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2013-02-10 10:56:13 +0000
committerhselasky <hselasky@FreeBSD.org>2013-02-10 10:56:13 +0000
commit07c18e4e92170f42c04651098b0a5e506e8f1efe (patch)
tree98239bf65cd74264d2ba911ccbce4a4b729fa56b /sys/dev/usb/usb_handle_request.c
parent34ac6c9a18f820e4a7bbf72e956f09cf5c153a8b (diff)
downloadFreeBSD-src-07c18e4e92170f42c04651098b0a5e506e8f1efe.zip
FreeBSD-src-07c18e4e92170f42c04651098b0a5e506e8f1efe.tar.gz
- Move scratch data from the USB bus structure to the USB device structure
so that simultaneous access cannot happen. Protect scratch area using the enumeration lock. Also reduce stack usage in usbd_transfer_setup() by moving some big stack members to the scratch area. This saves around 200 bytes of stack. - Fix a whitespace. MFC after: 1 week
Diffstat (limited to 'sys/dev/usb/usb_handle_request.c')
-rw-r--r--sys/dev/usb/usb_handle_request.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/sys/dev/usb/usb_handle_request.c b/sys/dev/usb/usb_handle_request.c
index 13fff91..a775d67 100644
--- a/sys/dev/usb/usb_handle_request.c
+++ b/sys/dev/usb/usb_handle_request.c
@@ -191,13 +191,8 @@ usb_check_alt_setting(struct usb_device *udev,
uint8_t do_unlock;
usb_error_t err = 0;
- /* automatic locking */
- if (usbd_enum_is_locked(udev)) {
- do_unlock = 0;
- } else {
- do_unlock = 1;
- usbd_enum_lock(udev);
- }
+ /* Prevent re-enumeration */
+ do_unlock = usbd_enum_lock(udev);
if (alt_index >= usbd_get_no_alts(udev->cdesc, iface->idesc))
err = USB_ERR_INVAL;
OpenPOWER on IntegriCloud