Re: [PATCH] PCI PM: Restore standard config registers of all devices early (was: Re: EeePC resume failure - timers)

Rafael J. Wysocki
2009-01-16T20:48:40Z

On Friday 16 January 2009, Linus Torvalds wrote:
>
> On Fri, 16 Jan 2009, Rafael J. Wysocki wrote:
> >
> > So, does it mean the patch looks reasonable? ;-)
>
> I haven't tested it myself, and I probably won't have time to before I
> leave for LCA, but it looks reasonable. I'd suggest replacing this:
>
> + if (pci_dev->current_state != PCI_D0) {
> + /*
> + * Warn users if the driver puts the device into a low
> + * power state, but doesn't bother to save its config
> + * registers.
> + */
> + WARN_ON(true);
> + goto Fixup;
>
> with the much simpler
>
> if (WARN_ON_ONCE(pci_dev->current_state != PCI_D0))
> goto Fixup;
>
> instead, because we don't want to get millions of warnings, and it's kind
> of silly to have WARN_ON(true) inside a conditional code-sequence.

I'll do that, thanks.

Somehow, I didn't realize that WARN_ON_ONCE() returned !!(its argument).

Rafael