From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Linux-pm mailing list <linux-pm@lists.linux-foundation.org>
Subject: Re: [PATCH] PM: add dpm_use_runtime_{suspend, resume} helper functions
Date: Wed, 3 Mar 2010 22:33:14 +0100 [thread overview]
Message-ID: <201003032233.14971.rjw@sisk.pl> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1003031140210.2821-100000@iolanthe.rowland.org>
On Wednesday 03 March 2010, Alan Stern wrote:
> On Tue, 2 Mar 2010, Rafael J. Wysocki wrote:
>
> > +/**
> > + * __pm_generic_call - Generic suspend/freeze/poweroff/thaw subsystem callback.
> > + * @dev: Device to handle.
> > + * @event: PM transition of the system under way.
> > + *
> > + * If the device has not been suspended at run time, execute the
> > + * suspend/freeze/poweroff/thaw callback provided by its driver, if defined, and
> > + * return the error code returned by it. Otherwise, return zero.
> > + */
> > +static int __pm_generic_call(struct device *dev, int event)
> > +{
> > + const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
> > + int (*callback)(struct device *);
> > +
> > + if (!pm || pm_runtime_suspended(dev))
> > + return 0;
> > +
> > + switch (event) {
> > + case PM_EVENT_SUSPEND:
> > + callback = pm->suspend;
> > + break;
> > + case PM_EVENT_FREEZE:
> > + callback = pm->freeze;
> > + break;
> > + case PM_EVENT_HIBERNATE:
> > + callback = pm->poweroff;
> > + break;
> > + case PM_EVENT_THAW:
> > + callback = pm->thaw;
> > + break;
> > + default:
> > + callback = NULL;
> > + break;
> > + }
> > +
> > + return callback ? callback(dev) : 0;
> > +}
>
> Are you sure you want to avoid calling pm->thaw if the device is
> runtime-suspended? Maybe it would be better to treat thaw like resume
> or restore.
In .freeze() we check if the device is runtime suspended and skip the driver's
.freeze() in that case, so the device is still suspended. I don't think
.thaw() should call the driver's .thaw() in that case and change the runtime
suspended status (that won't serve any practical purpose IMO).
> > --- linux-2.6.orig/include/linux/pm_runtime.h
> > +++ linux-2.6/include/linux/pm_runtime.h
> > @@ -62,6 +62,11 @@ static inline void device_set_run_wake(s
> > dev->power.run_wake = enable;
> > }
> >
> > +static inline bool pm_runtime_suspended(struct device *dev)
> > +{
> > + return dev->power.runtime_status == RPM_SUSPENDED;
> > +}
> > +
>
> You didn't add this to the documentation file.
Yes, I realized that after sending the patch, sorry.
Rafael
next prev parent reply other threads:[~2010-03-03 21:33 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-26 16:46 [PATCH] PM: add dpm_use_runtime_{suspend, resume} helper functions Alan Stern
2010-02-26 21:24 ` Rafael J. Wysocki
2010-02-26 22:06 ` Alan Stern
2010-02-27 10:43 ` Mark Brown
2010-02-27 22:50 ` Rafael J. Wysocki
2010-03-01 13:31 ` Mark Brown
2010-03-01 18:40 ` Alan Stern
2010-03-01 22:06 ` Rafael J. Wysocki
2010-03-02 16:12 ` Alan Stern
2010-03-02 22:51 ` Rafael J. Wysocki
2010-03-03 16:46 ` Alan Stern
2010-03-03 21:33 ` Rafael J. Wysocki [this message]
2010-03-04 0:56 ` Rafael J. Wysocki
2010-03-01 22:25 ` Kevin Hilman
2010-03-02 0:12 ` Rafael J. Wysocki
[not found] <201003040156.58763.rjw@sisk.pl>
2010-03-04 3:11 ` Alan Stern
[not found] <Pine.LNX.4.44L0.1003032151581.6963-100000@netrider.rowland.org>
2010-03-04 21:19 ` Rafael J. Wysocki
2010-03-05 14:55 ` Alan Stern
[not found] <Pine.LNX.4.44L0.1003050954160.1677-100000@iolanthe.rowland.org>
2010-03-05 20:40 ` Rafael J. Wysocki
[not found] <201003052140.16948.rjw@sisk.pl>
2010-03-05 21:00 ` Alan Stern
[not found] <Pine.LNX.4.44L0.1003051559410.1384-100000@iolanthe.rowland.org>
2010-03-05 21:09 ` 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=201003032233.14971.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