Re: [PATCH 5/5] PCI: PM: Fold __pci_complete_power_transition() into its caller

From: Rafael J. Wysocki
Date: Tue Nov 05 2019 - 11:15:15 EST


On Tue, Nov 5, 2019 at 5:09 PM Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:
>
> On Tue, Nov 05, 2019 at 11:32:02AM +0100, Rafael J. Wysocki wrote:
> > if (state > PCI_D3cold)
> > @@ -1132,10 +1112,12 @@ int pci_set_power_state(struct pci_dev *
> > error = pci_raw_set_power_state(dev, state > PCI_D3hot ?
> > PCI_D3hot : state);
> >
> > - if (!__pci_complete_power_transition(dev, state))
> > - error = 0;
> > + ret = pci_platform_power_transition(dev, state);
> > + /* Powering off a bridge may power off the whole hierarchy */
> > + if (!ret && state == PCI_D3cold)
> > + pci_bus_set_current_state(dev->subordinate, PCI_D3cold);
> >
> > - return error;
> > + return ret ? error : 0;
>
> Total nitpick, but why not:
>
> if (pci_platform_power_transition(dev, state))
> return error;
>
> /* Powering off a bridge may power off the whole hierarchy */
> if (state == PCI_D3cold)
> pci_bus_set_current_state(dev->subordinate, PCI_D3cold);
> return 0;

Yes, that looks better, thanks!

I'll send an update of this patch.