[linux-pm] [RFC][PATCH 6/10] PCI PM: Rearrange code in pci-driver.c

Rafael J. Wysocki rjw at sisk.pl
Mon Jan 5 05:32:27 PST 2009


On Monday 05 January 2009, Pavel Machek wrote:
> Hi!
> 
> > Rename two functions and rearrange code in drivers/pci/pci-driver.c
> > so that it's easier to follow.  In particular, separate invocations
> > of the legacy callbacks from the rest of the new callbacks' code.
> > 
> > No functional changes should result from this.
> > 
> > Signed-off-by: Rafael J. Wysocki <rjw at sisk.pl>
> > ---
> >  drivers/pci/pci-driver.c |  104 +++++++++++++++++++++++++++++------------------
> >  1 file changed, 65 insertions(+), 39 deletions(-)
> >
> 
> > @@ -504,17 +504,21 @@ static int pci_pm_suspend(struct device 
> >  	struct device_driver *drv = dev->driver;
> >  	int error = 0;
> >  
> > +	if (pci_has_legacy_pm_support(pci_dev)) {
> > +		error = pci_legacy_suspend(dev, PMSG_SUSPEND);
> > +		goto Exit;
> > +	}
> > +
> >  	if (drv && drv->pm) {
> >  		if (drv->pm->suspend) {
> >  			error = drv->pm->suspend(dev);
> >  			suspend_report_result(drv->pm->suspend, error);
> >  		}
> > -	} else if (pci_has_legacy_pm_support(pci_dev)) {
> > -		error = pci_legacy_suspend(dev, PMSG_SUSPEND);
> >  	} else {
> >  		pci_pm_default_suspend(pci_dev);
> >  	}
> >
> 
> Does this mean that pci_has_legacy_pm_support() => !(drv && drv->pm) ?

Yes, it does.

> Should pci_has_legacy_pm_support() check for that and WARN() in case
> both sets of callbacks are set?

Yes, I think I can add a WARN_ON() in there.

Thanks,
Rafael


More information about the linux-pm mailing list