提交 db7c7c0a 编写于 作者: S Sarah Sharp

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: NSarah Sharp <sarah.a.sharp@linux.intel.com>
上级 fbf9865c
...@@ -1659,6 +1659,11 @@ static int usb_runtime_suspend(struct device *dev) ...@@ -1659,6 +1659,11 @@ static int usb_runtime_suspend(struct device *dev)
return -EAGAIN; return -EAGAIN;
status = usb_suspend_both(udev, PMSG_AUTO_SUSPEND); status = usb_suspend_both(udev, PMSG_AUTO_SUSPEND);
/* The PM core reacts badly unless the return code is 0,
* -EAGAIN, or -EBUSY, so always return -EBUSY on an error.
*/
if (status != 0)
return -EBUSY;
return status; return status;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册