diff options
Diffstat (limited to 'sys/dev/usb/usb_device.c')
-rw-r--r-- | sys/dev/usb/usb_device.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/sys/dev/usb/usb_device.c b/sys/dev/usb/usb_device.c index 635a9b1..d286db0 100644 --- a/sys/dev/usb/usb_device.c +++ b/sys/dev/usb/usb_device.c @@ -478,7 +478,7 @@ usbd_set_config_index(struct usb_device *udev, uint8_t index) usbd_enum_lock(udev); } - usb_unconfigure(udev, USB_UNCFG_FLAG_FREE_SUBDEV); + usb_unconfigure(udev, 0); if (index == USB_UNCONFIG_INDEX) { /* @@ -582,7 +582,7 @@ usbd_set_config_index(struct usb_device *udev, uint8_t index) done: DPRINTF("error=%s\n", usbd_errstr(err)); if (err) { - usb_unconfigure(udev, USB_UNCFG_FLAG_FREE_SUBDEV); + usb_unconfigure(udev, 0); } if (do_unlock) usbd_enum_unlock(udev); @@ -989,18 +989,13 @@ usb_detach_device_sub(struct usb_device *udev, device_t *ppdev, device_t dev; int err; - if (!(flag & USB_UNCFG_FLAG_FREE_SUBDEV)) { - - *ppdev = NULL; - - } else if (*ppdev) { - + dev = *ppdev; + if (dev) { /* * NOTE: It is important to clear "*ppdev" before deleting * the child due to some device methods being called late * during the delete process ! */ - dev = *ppdev; *ppdev = NULL; device_printf(dev, "at %s, port %d, addr %d " @@ -1778,7 +1773,7 @@ repeat_set_config: } else if (usb_test_huawei_autoinst_p(udev, &uaa) == 0) { DPRINTFN(0, "Found Huawei auto-install disk!\n"); /* leave device unconfigured */ - usb_unconfigure(udev, USB_UNCFG_FLAG_FREE_SUBDEV); + usb_unconfigure(udev, 0); } } else { err = 0; /* set success */ @@ -1803,10 +1798,10 @@ repeat_set_config: #endif done: if (err) { - /* free device */ - usb_free_device(udev, - USB_UNCFG_FLAG_FREE_SUBDEV | - USB_UNCFG_FLAG_FREE_EP0); + /* + * Free USB device and all subdevices, if any. + */ + usb_free_device(udev, 0); udev = NULL; } return (udev); @@ -1926,9 +1921,10 @@ usb_cdev_cleanup(void* arg) /*------------------------------------------------------------------------* * usb_free_device * - * This function is NULL safe and will free an USB device. + * This function is NULL safe and will free an USB device and its + * children devices, if any. * - * Flag values, see "USB_UNCFG_FLAG_XXX". + * Flag values: Reserved, set to zero. *------------------------------------------------------------------------*/ void usb_free_device(struct usb_device *udev, uint8_t flag) @@ -1982,7 +1978,7 @@ usb_free_device(struct usb_device *udev, uint8_t flag) } /* the following will get the device unconfigured in software */ - usb_unconfigure(udev, flag); + usb_unconfigure(udev, USB_UNCFG_FLAG_FREE_EP0); /* unsetup any leftover default USB transfers */ usbd_transfer_unsetup(udev->default_xfer, USB_DEFAULT_XFER_MAX); |