Re: Autosuspend and unbound interfaces

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 7 May 2010, Rob Duncan wrote:

> 
> On May 7, 2010, at 10:42 AM, Alan Stern wrote:
> 
> > Ah -- this is because my patch is buggy.  When a probe fails it always
> > calls pm_runtime_disable(), even if it didn't call pm_runtime_enable()
> > earlier.  Thus the disable count gets incremented, and it never works
> > right thereafter.  In fact, this bug is present in the current code as
> > well as in the patch.
> >
> > Try this revised version of the patch instead.
> 
> It works!  Thank you very much for all your help (again).

After looking more closely, it appears that some of the changes in the
patch aren't needed.  In particular, the driver core attempts to 
suspend things after probing them, so it should be okay to leave 
interfaces in the active state during probe.

Please try out this new version of the patch and see if it does the 
right thing.

Alan Stern


Index: usb-2.6/drivers/usb/core/driver.c
===================================================================
--- usb-2.6.orig/drivers/usb/core/driver.c
+++ usb-2.6/drivers/usb/core/driver.c
@@ -334,7 +334,8 @@ static int usb_probe_interface(struct de
 	usb_cancel_queued_reset(intf);
 
 	/* Unbound interfaces are always runtime-PM-disabled and -suspended */
-	pm_runtime_disable(dev);
+	if (driver->supports_autosuspend)
+		pm_runtime_disable(dev);
 	pm_runtime_set_suspended(dev);
 
 	usb_autosuspend_device(udev);
@@ -389,7 +390,8 @@ static int usb_unbind_interface(struct d
 	intf->needs_remote_wakeup = 0;
 
 	/* Unbound interfaces are always runtime-PM-disabled and -suspended */
-	pm_runtime_disable(dev);
+	if (driver->supports_autosuspend)
+		pm_runtime_disable(dev);
 	pm_runtime_set_suspended(dev);
 
 	/* Undo any residual pm_autopm_get_interface_* calls */
@@ -442,9 +444,10 @@ int usb_driver_claim_interface(struct us
 	 * runtime-PM-enabled only if the driver has autosuspend support.
 	 * They are sensitive to their children's power states.
 	 */
-	pm_runtime_set_suspended(dev);
 	pm_suspend_ignore_children(dev, false);
-	if (driver->supports_autosuspend)
+	if (!driver->supports_autosuspend)
+		pm_runtime_set_active(dev);
+	else
 		pm_runtime_enable(dev);
 
 	/* if interface was already added, bind now; else let

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux