From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: David Brownell <david-b@pacbell.net>
Cc: lenb@kernel.org, trenn@suse.de,
linux-pm@lists.linux-foundation.org, linux-acpi@vger.kernel.org
Subject: Re: [patch 2.6.25-rc6 3/7] pci_choose_state() cleanup and fixes
Date: Fri, 21 Mar 2008 01:22:43 +0100 [thread overview]
Message-ID: <200803210122.44188.rjw@sisk.pl> (raw)
In-Reply-To: <20080320230301.8EFB235F4AF@adsl-69-226-248-13.dsl.pltn13.pacbell.net>
On Friday, 21 of March 2008, David Brownell wrote:
> > > + switch (mesg.event) {
> > > case PM_EVENT_SUSPEND:
> > > + /* NOTE: platform_pci_choose_state() should only return
> > > + * states where wakeup won't work if
> > > + * - !device_may_wakeup(&dev->dev), or
> > > + * - dev can't wake from the target system state
> > > + */
> > > + if (platform_pci_choose_state) {
> > > + ret = platform_pci_choose_state(dev, mesg);
> > > + if (ret == PCI_POWER_ERROR)
> > > + ret = PCI_D3hot;
> > > + else if ((ret == PCI_D1 || ret == PCI_D2)
> > > + && pci_no_d1d2(dev))
> > > + ret = PCI_D3hot;
> > > + break;
> > > + }
> > > + /* FALLTHROUGH ... D3hot works, but may be suboptimal */
> > > case PM_EVENT_HIBERNATE:
> > > - return PCI_D3hot;
> > > + ret = PCI_D3hot;
> >
> > This is clearly wrong. It should do the same as for suspend here (_S4D may be
> > defined and we should take it into account if it is).
>
> So you're saying the original code was wrong, and this patch should
> change that behavior too?
The original code executed platform_pci_choose_state() first, if defined, and
if that succeeded, it just returned the result. You put
platform_pci_choose_state() under the switch(). :-)
In fact the entire switch() in pci_choose_state() is just confusing. I'd make
it return PCI_D3hot if platform_pci_choose_state() is undefined or fails (I
wonder if pci_choose_state() is ever called with PMSG_ON). That at least
would be consistent with the behavior of acpi_pm_device_sleep_state().
Consequently, the 'state' argument would simply be unnecessary (and in fact
it's ignored if platform_pci_choose_state() is defined).
> > > + break;
> > > default:
> > > - printk("Unrecognized suspend event %d\n", state.event);
> > > - BUG();
> > > + ret = PCI_D0;
> > > + break;
> > > }
> > > - return PCI_D0;
> > > + return ret;
> > > }
> > >
> > > EXPORT_SYMBOL(pci_choose_state);
> >
> > I really don't think pci_choose_state() should take the state argument at all.
>
> There is no "state" argument. It's a pm_message_t, which does
> not package the target state.
Correct, but the pm_message_t argument is called 'state', confusingly so.
> A patch to change the calling syntax for this would necessarily
> be a different patch... and would need to change the callers too.
Agreed.
Thanks,
Rafael
next prev parent reply other threads:[~2008-03-21 0:23 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-20 21:08 [patch 2.6.25-rc6 0/7] misc pm wake patches David Brownell
2008-03-20 21:09 ` [patch 2.6.25-rc6 1/7] crosslink ACPI and "real" device nodes David Brownell
2008-03-21 6:43 ` Zhao Yakui
2008-03-21 7:31 ` David Brownell
2008-03-21 8:34 ` Zhao Yakui
2008-03-21 9:04 ` David Brownell
2008-03-20 21:10 ` [patch 2.6.25-rc6 2/7] acpi_pm_device_sleep_state() cleanup David Brownell
2008-03-24 16:30 ` [linux-pm] " Pavel Machek
2008-04-19 4:11 ` [RESEND patch 2.6.25] " David Brownell
2008-04-29 20:33 ` [RE-RESEND patch 2.6.25-git] " David Brownell
2008-04-29 21:49 ` Rafael J. Wysocki
2008-04-29 22:12 ` David Brownell
2008-04-30 12:07 ` Rafael J. Wysocki
2008-03-20 21:12 ` [patch 2.6.25-rc6 3/7] pci_choose_state() cleanup and fixes David Brownell
2008-03-20 22:37 ` Rafael J. Wysocki
2008-03-20 23:03 ` David Brownell
2008-03-21 0:22 ` Rafael J. Wysocki [this message]
2008-03-21 0:55 ` [linux-pm] " Alan Stern
2008-03-21 1:47 ` Rafael J. Wysocki
2008-03-21 8:15 ` David Brownell
2008-03-21 16:23 ` Rafael J. Wysocki
2008-03-22 17:55 ` David Brownell
2008-03-22 18:11 ` Rafael J. Wysocki
2008-03-22 18:29 ` David Brownell
2008-03-21 7:53 ` David Brownell
2008-03-21 16:38 ` Rafael J. Wysocki
2008-03-22 17:49 ` David Brownell
2008-03-22 18:34 ` Rafael J. Wysocki
2008-04-14 4:59 ` David Brownell
2008-03-20 21:15 ` [patch 2.6.25-rc6 4/7] USB uses pci_choose_state() David Brownell
2008-03-20 21:20 ` [patch 2.6.25-rc6 5/7] ACPI sets up device.power.can_wakeup flags David Brownell
2008-03-21 7:43 ` Zhao Yakui
2008-04-19 4:14 ` [RESEND patch 2.6.25] " David Brownell
2008-04-22 2:48 ` Zhang Rui
2008-03-20 21:22 ` [patch 2.6.25-rc6 6/7] ACPI uses device_may_wakeup() policy inputs David Brownell
2008-04-19 4:18 ` [RESEND patch 2.6.25] " David Brownell
2008-04-22 2:42 ` Zhang Rui
2008-04-26 19:29 ` David Brownell
2008-04-22 13:30 ` Zhao Yakui
2008-04-26 19:37 ` David Brownell
2008-04-28 12:48 ` Zhao Yakui
2008-04-28 8:50 ` Zhang Rui
2008-04-28 13:43 ` [linux-pm] " Alan Stern
2008-04-29 23:38 ` David Brownell
2008-04-30 13:58 ` Alan Stern
2008-05-14 14:56 ` Pavel Machek
2008-04-28 22:28 ` David Brownell
2008-04-28 21:35 ` Henrique de Moraes Holschuh
2008-04-28 22:20 ` David Brownell
2008-04-28 22:54 ` Henrique de Moraes Holschuh
2008-04-29 0:20 ` David Brownell
2008-04-29 20:32 ` David Brownell
2008-04-28 22:24 ` David Brownell
2008-04-28 22:26 ` David Brownell
2008-03-20 21:25 ` [patch 2.6.25-rc6 7/7] PCI set up device.power.can_wakeup flags David Brownell
2008-03-20 21:53 ` [linux-pm] " Alan Stern
2008-03-20 22:22 ` David Brownell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200803210122.44188.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=david-b@pacbell.net \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=trenn@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox