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

From: Rafael J. Wysocki
Date: Mon Jan 05 2009 - 08:32:00 EST


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@xxxxxxx>
> > ---
> > 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/