Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 57018
b: refs/heads/master
c: d5d4db7
h: refs/heads/master
v: v3
  • Loading branch information
Alan Stern authored and Linus Torvalds committed May 29, 2007
1 parent 7f57a6e commit 14da73e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c420bc9f09a0926b708c3edb27eacba434a4f4ba
refs/heads/master: d5d4db704b962773c03ee3beb3258b6450611e66
2 changes: 1 addition & 1 deletion trunk/drivers/usb/core/hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1681,7 +1681,7 @@ void usb_remove_hcd(struct usb_hcd *hcd)
spin_unlock_irq (&hcd_root_hub_lock);

#ifdef CONFIG_PM
flush_workqueue(ksuspend_usb_wq);
cancel_work_sync(&hcd->wakeup_work);
#endif

mutex_lock(&usb_bus_list_lock);
Expand Down
32 changes: 25 additions & 7 deletions trunk/drivers/usb/core/hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,30 @@ static void release_address(struct usb_device *udev)
}
}

#ifdef CONFIG_USB_SUSPEND

static void usb_stop_pm(struct usb_device *udev)
{
/* Synchronize with the ksuspend thread to prevent any more
* autosuspend requests from being submitted, and decrement
* the parent's count of unsuspended children.
*/
usb_pm_lock(udev);
if (udev->parent && !udev->discon_suspended)
usb_autosuspend_device(udev->parent);
usb_pm_unlock(udev);

/* Stop any autosuspend requests already submitted */
cancel_rearming_delayed_work(&udev->autosuspend);
}

#else

static inline void usb_stop_pm(struct usb_device *udev)
{ }

#endif

/**
* usb_disconnect - disconnect a device (usbcore-internal)
* @pdev: pointer to device being disconnected
Expand Down Expand Up @@ -1224,13 +1248,7 @@ void usb_disconnect(struct usb_device **pdev)
*pdev = NULL;
spin_unlock_irq(&device_state_lock);

/* Decrement the parent's count of unsuspended children */
if (udev->parent) {
usb_pm_lock(udev);
if (!udev->discon_suspended)
usb_autosuspend_device(udev->parent);
usb_pm_unlock(udev);
}
usb_stop_pm(udev);

put_device(&udev->dev);
}
Expand Down
4 changes: 0 additions & 4 deletions trunk/drivers/usb/core/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,6 @@ static void usb_release_dev(struct device *dev)

udev = to_usb_device(dev);

#ifdef CONFIG_USB_SUSPEND
cancel_delayed_work(&udev->autosuspend);
flush_workqueue(ksuspend_usb_wq);
#endif
usb_destroy_configuration(udev);
usb_put_hcd(bus_to_hcd(udev->bus));
kfree(udev->product);
Expand Down

0 comments on commit 14da73e

Please sign in to comment.