From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "linux-pm@lists.linux-foundation.org"
<linux-pm@lists.linux-foundation.org>
Subject: Re: Runtime PM: Calling Device runtime PM callbacks?
Date: Tue, 15 Dec 2009 21:30:41 +0100 [thread overview]
Message-ID: <200912152130.41272.rjw@sisk.pl> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0912150933460.3566-100000@iolanthe.rowland.org>
On Tuesday 15 December 2009, Alan Stern wrote:
> On Tue, 15 Dec 2009, Rafael J. Wysocki wrote:
>
> > > Idle is very similar to suspend. They should use the same order.
> > >
> > > I guess there's one extra thing to look out for: If one of the idle
> > > callbacks does pm_runtime_suspend() then there's no point invoking the
> > > later callbacks.
> >
> > But how do we know that?
>
> How do we know whether the callback does pm_runtime_suspend()? Because
> dev->runtime_status changes to RPM_SUSPENDED.
>
> How do we know there's no point invoking the later callbacks? Because
> an idle callback is merely supposed to decide whether or not to suspend
> the device. If the device is already suspended then the callback's job
> is already done.
>
> > I'm still not sure what actually the point executing _idle for device types and
> > device classes is. The only situation I can aticipate if when there's a device
> > without a bus type.
>
> In the USB stack we have "devices" and "interfaces", two different
> device types (both belonging to the USB bus type). They need to have
> separate callbacks. The device idle callback will do a bunch of
> testing, whereas the interface idle callback will always invoke
> pm_runtime_suspend() immediately.
>
> > Hmm. Actually, are we ever going to call two or more suspend callbacks (ie.
> > bus type one and device type one or device type one and device class one)
> > for the same device? If not, we'll be able to simplify things significantly
> > by making them mutually exclusive (ie. if there's bus type, call bus type,
> > or else if there's device type, call device type, or else if there's device
> > class, call device class).
>
> I don't plan ever to have more than one callback. But I can't speak
> for other parts of the kernel.
>
> The situation should be very much the same as with the DPM callbacks.
> They could make the same assumption. Or neither should make it -- as
> the case may be.
However, as you said before, the runtime PM interface is new so they can
adapt.
In fact, I'm not very comfortable with the current possibility to call DPM
callbacks of two or three kinds in a row for the same device, because that
means very close connection between the bus type and device type or device
class (or all three of them). Nobody does that, as far as I can tell, and I
guess nobody will.
Now, if we agree that only one callback will be called for given device
(either bus type, or device type, or device class), the code may be simpler
and there won't be an issue with the ordering in _idle.
Rafael
next prev parent reply other threads:[~2009-12-15 20:30 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-13 5:20 Runtime PM: Calling Device runtime PM callbacks? Mahalingam, Nithish
2009-12-13 12:34 ` Rafael J. Wysocki
2009-12-13 16:57 ` Alan Stern
2009-12-13 18:36 ` Rafael J. Wysocki
2009-12-13 18:49 ` Alan Stern
2009-12-14 0:03 ` Rafael J. Wysocki
2009-12-14 3:36 ` Mahalingam, Nithish
2009-12-14 4:42 ` Alan Stern
2009-12-14 21:58 ` Rafael J. Wysocki
2009-12-14 4:37 ` Alan Stern
2009-12-14 21:57 ` Rafael J. Wysocki
2009-12-14 22:08 ` Alan Stern
2009-12-14 22:28 ` Rafael J. Wysocki
2009-12-14 23:09 ` Alan Stern
2009-12-14 23:26 ` Rafael J. Wysocki
2009-12-15 3:11 ` Mahalingam, Nithish
2009-12-15 14:40 ` Alan Stern
2009-12-15 20:30 ` Rafael J. Wysocki [this message]
2009-12-15 20:51 ` Alan Stern
2009-12-15 21:04 ` Rafael J. Wysocki
2009-12-19 15:13 ` Rafael J. Wysocki
2009-12-19 16:46 ` Alan Stern
2009-12-19 21:31 ` 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=200912152130.41272.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=linux-pm@lists.linux-foundation.org \
--cc=stern@rowland.harvard.edu \
/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