diff options
author | Frans Pop <elendil@planet.nl> | 2009-06-04 16:30:48 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-06-16 00:44:47 -0400 |
commit | 23a54e567534d4895056df558e2564114513524a (patch) | |
tree | d2a7967bc412becb9b7dce6b48f6d468a57e10e3 /drivers | |
parent | 453f77558810ffa669ed5a510a7173ec49def396 (diff) |
USB: Avoid PM error messages during resume if a device was disconnected
Currently if a laptop is suspended e.g. while docked and then resumed after
undocking it, the following errors get generated because the USB hub in the
docking station and the devices connected to it are no longer available:
pm_op(): usb_dev_resume+0x0/0x10 returns -19
PM: Device 1-2 failed to resume: error -19
pm_op(): usb_dev_resume+0x0/0x10 returns -19
PM: Device 1-2.2 failed to resume: error -19
pm_op(): usb_dev_resume+0x0/0x10 returns -19
PM: Device 1-2.3 failed to resume: error -19
As the removal of USB devices while a system is suspended is a relatively
common use case and in most cases not an error, just return success on
-ENODEV. The user gets informed anyway as the USB subsystem generates
regular disconnect messages for the devices shortly afterwards:
usb 1-2: USB disconnect, address 3
usb 1-2.2: USB disconnect, address 4
usblp0: removed
usb 1-2.3: USB disconnect, address 5
Signed-off-by: Frans Pop <elendil@planet.nl>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/core/driver.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 77de8d65862c..69e5773abfce 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
@@ -1750,6 +1750,7 @@ int usb_suspend(struct device *dev, pm_message_t msg) | |||
1750 | int usb_resume(struct device *dev, pm_message_t msg) | 1750 | int usb_resume(struct device *dev, pm_message_t msg) |
1751 | { | 1751 | { |
1752 | struct usb_device *udev; | 1752 | struct usb_device *udev; |
1753 | int status; | ||
1753 | 1754 | ||
1754 | udev = to_usb_device(dev); | 1755 | udev = to_usb_device(dev); |
1755 | 1756 | ||
@@ -1759,7 +1760,14 @@ int usb_resume(struct device *dev, pm_message_t msg) | |||
1759 | */ | 1760 | */ |
1760 | if (udev->skip_sys_resume) | 1761 | if (udev->skip_sys_resume) |
1761 | return 0; | 1762 | return 0; |
1762 | return usb_external_resume_device(udev, msg); | 1763 | status = usb_external_resume_device(udev, msg); |
1764 | |||
1765 | /* Avoid PM error messages for devices disconnected while suspended | ||
1766 | * as we'll display regular disconnect messages just a bit later. | ||
1767 | */ | ||
1768 | if (status == -ENODEV) | ||
1769 | return 0; | ||
1770 | return status; | ||
1763 | } | 1771 | } |
1764 | 1772 | ||
1765 | #endif /* CONFIG_PM */ | 1773 | #endif /* CONFIG_PM */ |