From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
Pavel Machek <pavel@suse.cz>,
pm list <linux-pm@lists.linux-foundation.org>
Subject: Re: [PATCH 2/2] PCI PM: Introduce pci_preferred_state
Date: Fri, 9 May 2008 10:24:52 -0700 [thread overview]
Message-ID: <200805091024.53027.jbarnes@virtuousgeek.org> (raw)
In-Reply-To: <200805091913.40197.rjw@sisk.pl>
On Friday, May 09, 2008 10:13 am Rafael J. Wysocki wrote:
> > So why not make platform_pci_choose_state do:
> > + pci_power_t noacpi_pci_choose_state(struct pci_dev *dev, pci_message_t
> > state)
> > + {
> > + if (!pci_find_capability(dev, PCI_CAP_ID_PM))
> > + return state;
> > + }
> >
> > instead? Then in the PCI core we would assign either
> > platform_pci_choose_state to acpi_pci_choose_state or
> > noacpi_pci_choose_state
>
> Good idea.
>
> > (though that's a bad name).
>
> Does generic_pci_choose_state() sound better?
Yeah, that's better.
> > But really, since drivers should probably know what power state to put
> > their devices in for suspend & hibernate, maybe on non-ACPI systems the
> > function should just return an error and the driver can choose...
>
> That's one possibility too, but in that case many drivers will do
>
> state = pci_preferred_state(dev);
> if (state == PCI_POWER_ERROR)
> state = something;
>
> It's just shorter to write
>
> state = pci_preferred_state(dev, something);
But really that's the idea, since if the core doesn't know what state your
device should be in (and in many non-ACPI cases I'd argue that to be true)
your driver should be picking something sensible. After all, states other
than D0 and D3 are really device dependent, right?
One way to avoid some ugliness like you show above would be:
device_suspend(...)
{
...
state = PCI_D3hot;
pci_choose_state(dev, pm_state, &state);
pci_set_power_state(dev, state);
...
}
So in this case pci_choose_state would either change state or leave it
untouched if it didn't have a better idea about things. But now that I look
at it I'm not sure it's an improvement. :)
Jesse
next prev parent reply other threads:[~2008-05-09 17:24 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-06 21:42 [PATCH 0/2] Patches for 2.6.27, dependent on the other trees Rafael J. Wysocki
2008-05-06 21:44 ` [PATCH 1/2] ACPI PM: Add suspend sequence workaround Rafael J. Wysocki
2008-05-06 21:57 ` Carlos Corbacho
2008-05-06 22:09 ` Rafael J. Wysocki
2008-05-07 9:29 ` Pavel Machek
2008-05-07 12:21 ` Rafael J. Wysocki
2008-05-09 17:20 ` Rafael J. Wysocki
2008-05-09 17:21 ` [RFC][PATCH 1/2] ACPI PM: Remove obsolete Toshiba workaround Rafael J. Wysocki
2008-05-12 7:18 ` Pavel Machek
2008-05-09 17:23 ` [RFC][PATCH 2/2] ACPI PM: Add possibility to change suspend sequence Rafael J. Wysocki
2008-05-12 7:23 ` Pavel Machek
2008-05-12 22:34 ` Rafael J. Wysocki
2008-05-12 23:03 ` Rafael J. Wysocki
2008-05-19 22:36 ` Pavel Machek
2008-05-06 21:49 ` [PATCH 2/2] PCI PM: Introduce pci_preferred_state Rafael J. Wysocki
2008-05-07 9:33 ` Pavel Machek
2008-05-07 12:22 ` Rafael J. Wysocki
2008-05-07 15:45 ` [linux-pm] " Alan Stern
2008-05-07 18:32 ` Rafael J. Wysocki
2008-05-09 15:44 ` Rafael J. Wysocki
2008-05-09 16:47 ` Jesse Barnes
2008-05-09 17:13 ` [linux-pm] " Rafael J. Wysocki
2008-05-09 17:24 ` Jesse Barnes [this message]
2008-05-09 17:34 ` Rafael J. Wysocki
2008-05-09 17:37 ` Jesse Barnes
2008-05-09 21:44 ` Rafael J. Wysocki
2008-05-09 22:13 ` Jesse Barnes
2008-05-09 22:57 ` Rafael J. Wysocki
2008-05-10 18:28 ` Rafael J. Wysocki
2008-05-12 14:00 ` Pavel Machek
2008-05-12 14:52 ` Rafael J. Wysocki
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=200805091024.53027.jbarnes@virtuousgeek.org \
--to=jbarnes@virtuousgeek.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=pavel@suse.cz \
--cc=rjw@sisk.pl \
/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