Skip to content

Commit 9691f74

Browse files
AlanSterngregkh
authored andcommitted
USB: remove LPM management from usb_driver_claim_interface()
commit c183813 upstream. usb_driver_claim_interface() disables and re-enables Link Power Management, but it shouldn't do either one, for the reasons listed below. This patch removes the two LPM-related function calls from the routine. The reason for disabling LPM in the analogous function usb_probe_interface() is so that drivers won't have to deal with unwanted LPM transitions in their probe routine. But usb_driver_claim_interface() doesn't call the driver's probe routine (or any other callbacks), so that reason doesn't apply here. Furthermore, no driver other than usbfs will ever call usb_driver_claim_interface() unless it is already bound to another interface in the same device, which means disabling LPM here would be redundant. usbfs doesn't interact with LPM at all. Lastly, the error return from usb_unlocked_disable_lpm() isn't handled properly; the code doesn't clean up its earlier actions before returning. Signed-off-by: Alan Stern <[email protected]> Fixes: 8306095 ("USB: Disable USB 3.0 LPM in critical sections.") CC: <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent be2360e commit 9691f74

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

drivers/usb/core/driver.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,6 @@ int usb_driver_claim_interface(struct usb_driver *driver,
512512
struct device *dev;
513513
struct usb_device *udev;
514514
int retval = 0;
515-
int lpm_disable_error = -ENODEV;
516515

517516
if (!iface)
518517
return -ENODEV;
@@ -533,16 +532,6 @@ int usb_driver_claim_interface(struct usb_driver *driver,
533532

534533
iface->condition = USB_INTERFACE_BOUND;
535534

536-
/* See the comment about disabling LPM in usb_probe_interface(). */
537-
if (driver->disable_hub_initiated_lpm) {
538-
lpm_disable_error = usb_unlocked_disable_lpm(udev);
539-
if (lpm_disable_error) {
540-
dev_err(&iface->dev, "%s Failed to disable LPM for driver %s\n.",
541-
__func__, driver->name);
542-
return -ENOMEM;
543-
}
544-
}
545-
546535
/* Claimed interfaces are initially inactive (suspended) and
547536
* runtime-PM-enabled, but only if the driver has autosuspend
548537
* support. Otherwise they are marked active, to prevent the
@@ -561,10 +550,6 @@ int usb_driver_claim_interface(struct usb_driver *driver,
561550
if (device_is_registered(dev))
562551
retval = device_bind_driver(dev);
563552

564-
/* Attempt to re-enable USB3 LPM, if the disable was successful. */
565-
if (!lpm_disable_error)
566-
usb_unlocked_enable_lpm(udev);
567-
568553
if (retval) {
569554
dev->driver = NULL;
570555
usb_set_intfdata(iface, NULL);

0 commit comments

Comments
 (0)