On Thu, 10 Jun 2010, Rafael J. Wysocki wrote: > On Tuesday, June 08, 2010, Alan Stern wrote: > > This patch (as1388) changes the way the PCI core handles runtime PM > > settings when probing or unbinding drivers. Now the core will make > > sure the device is enabled for runtime PM, with a usage count >= 1, > > when a driver is probed. It does the same when calling a driver's > > remove method. > > > > If the driver wants to use runtime PM, all it has to do is call > > pm_runtime_pu_noidle() near the end of its probe routine (to cancel > > the core's usage increment) and pm_runtime_get_noresume() near the > > start of its remove routine (to restore the usage count). It does not > > need to mess around with setting the runtime state to enabled, > > disabled, active, or suspended. > > > > The patch updates e1000e and r8169, the only PCI drivers that already > > use the existing runtime PM interface. > > > > Signed-off-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> > > CC: Rafael J. Wysocki <rjw@xxxxxxx> > > I like the idea, but I think there's a problem with the patch. > > Namely, if there's a driver that doesn't support runtime PM and one of the > runtime PM helper functions is executed for it, whatever the reason, > the PCI bus callback run by it will return error code and runtime PM will be > disabled for the device as a result. That can't happen. Because the PCI core increments the usage count before probing the driver, if the driver doesn't support runtime PM then the usage count will never fall to 0. Hence the bus callbacks will never be invoked. > I think you need to rework the PCI bus type runtime PM callbacks to return > 0 if the driver callback is not present. I don't think that is necessary. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html