]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/usb/core/driver.c
USB: Avoid runtime suspend loops for HCDs that can't handle suspend/resume
[karo-tx-linux.git] / drivers / usb / core / driver.c
index 888881e5f2926b75dfd86ce44d668adb0b7e6bf6..4aeb10034de7c0db94333d66c4e98bf4df9052f5 100644 (file)
@@ -1822,10 +1822,13 @@ int usb_runtime_suspend(struct device *dev)
        if (status == -EAGAIN || status == -EBUSY)
                usb_mark_last_busy(udev);
 
-       /* The PM core reacts badly unless the return code is 0,
-        * -EAGAIN, or -EBUSY, so always return -EBUSY on an error.
+       /*
+        * The PM core reacts badly unless the return code is 0,
+        * -EAGAIN, or -EBUSY, so always return -EBUSY on an error
+        * (except for root hubs, because they don't suspend through
+        * an upstream port like other USB devices).
         */
-       if (status != 0)
+       if (status != 0 && udev->parent)
                return -EBUSY;
        return status;
 }