aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core
diff options
context:
space:
mode:
authorSarah Sharp <sarah.a.sharp@linux.intel.com>2010-12-30 01:03:07 -0500
committerSarah Sharp <sarah.a.sharp@linux.intel.com>2011-03-13 21:07:07 -0400
commitdb7c7c0aeef51dba12d877875b8deb78d9886647 (patch)
tree09567f469abcb49861ab347ffae0685b26836db6 /drivers/usb/core
parentfbf9865c6d96f4a131092d2018056e86113e5cea (diff)
usb: Always return 0 or -EBUSY to the runtime PM core.
The PM core reacts badly when the return code from usb_runtime_suspend() is not 0, -EAGAIN, or -EBUSY. The PM core regards this as a fatal error, and refuses to run anymore PM helper functions. In particular, usbfs_open() and other usbfs functions will fail because the PM core will return an error code when usb_autoresume_device() is called. This causes libusb and/or lsusb to either hang or segfault. If a USB device cannot suspend for some reason (e.g. a hub doesn't report it has remote wakeup capabilities), we still want lsusb and other userspace programs to work. So return -EBUSY, which will fill people's log files with failed tries, but will ensure userspace still works. Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r--drivers/usb/core/driver.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index fca61720b873..38072e4e74bd 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1659,6 +1659,11 @@ static int usb_runtime_suspend(struct device *dev)
1659 return -EAGAIN; 1659 return -EAGAIN;
1660 1660
1661 status = usb_suspend_both(udev, PMSG_AUTO_SUSPEND); 1661 status = usb_suspend_both(udev, PMSG_AUTO_SUSPEND);
1662 /* The PM core reacts badly unless the return code is 0,
1663 * -EAGAIN, or -EBUSY, so always return -EBUSY on an error.
1664 */
1665 if (status != 0)
1666 return -EBUSY;
1662 return status; 1667 return status;
1663} 1668}
1664 1669