aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/core/hub.c32
1 files changed, 9 insertions, 23 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index f7c2219c800f..cc93aa9336fe 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -3125,16 +3125,12 @@ EXPORT_SYMBOL(usb_reset_device);
3125 * this from a driver probe() routine after downloading new firmware. 3125 * this from a driver probe() routine after downloading new firmware.
3126 * For calls that might not occur during probe(), drivers should lock 3126 * For calls that might not occur during probe(), drivers should lock
3127 * the device using usb_lock_device_for_reset(). 3127 * the device using usb_lock_device_for_reset().
3128 *
3129 * The interface locks are acquired during the pre_reset stage and released
3130 * during the post_reset stage. However if iface is not NULL and is
3131 * currently being probed, we assume that the caller already owns its
3132 * lock.
3133 */ 3128 */
3134int usb_reset_composite_device(struct usb_device *udev, 3129int usb_reset_composite_device(struct usb_device *udev,
3135 struct usb_interface *iface) 3130 struct usb_interface *iface)
3136{ 3131{
3137 int ret; 3132 int ret;
3133 int i;
3138 struct usb_host_config *config = udev->actconfig; 3134 struct usb_host_config *config = udev->actconfig;
3139 3135
3140 if (udev->state == USB_STATE_NOTATTACHED || 3136 if (udev->state == USB_STATE_NOTATTACHED ||
@@ -3151,16 +3147,11 @@ int usb_reset_composite_device(struct usb_device *udev,
3151 iface = NULL; 3147 iface = NULL;
3152 3148
3153 if (config) { 3149 if (config) {
3154 int i;
3155 struct usb_interface *cintf;
3156 struct usb_driver *drv;
3157
3158 for (i = 0; i < config->desc.bNumInterfaces; ++i) { 3150 for (i = 0; i < config->desc.bNumInterfaces; ++i) {
3159 cintf = config->interface[i]; 3151 struct usb_interface *cintf = config->interface[i];
3160 if (cintf != iface) 3152 struct usb_driver *drv;
3161 down(&cintf->dev.sem); 3153
3162 if (device_is_registered(&cintf->dev) && 3154 if (cintf->dev.driver) {
3163 cintf->dev.driver) {
3164 drv = to_usb_driver(cintf->dev.driver); 3155 drv = to_usb_driver(cintf->dev.driver);
3165 if (drv->pre_reset) 3156 if (drv->pre_reset)
3166 (drv->pre_reset)(cintf); 3157 (drv->pre_reset)(cintf);
@@ -3172,21 +3163,16 @@ int usb_reset_composite_device(struct usb_device *udev,
3172 ret = usb_reset_device(udev); 3163 ret = usb_reset_device(udev);
3173 3164
3174 if (config) { 3165 if (config) {
3175 int i;
3176 struct usb_interface *cintf;
3177 struct usb_driver *drv;
3178
3179 for (i = config->desc.bNumInterfaces - 1; i >= 0; --i) { 3166 for (i = config->desc.bNumInterfaces - 1; i >= 0; --i) {
3180 cintf = config->interface[i]; 3167 struct usb_interface *cintf = config->interface[i];
3181 if (device_is_registered(&cintf->dev) && 3168 struct usb_driver *drv;
3182 cintf->dev.driver) { 3169
3170 if (cintf->dev.driver) {
3183 drv = to_usb_driver(cintf->dev.driver); 3171 drv = to_usb_driver(cintf->dev.driver);
3184 if (drv->post_reset) 3172 if (drv->post_reset)
3185 (drv->post_reset)(cintf); 3173 (drv->post_reset)(cintf);
3186 /* FIXME: Unbind if post_reset returns an error or isn't defined */ 3174 /* FIXME: Unbind if post_reset returns an error or isn't defined */
3187 } 3175 }
3188 if (cintf != iface)
3189 up(&cintf->dev.sem);
3190 } 3176 }
3191 } 3177 }
3192 3178