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: Fri, 26 Feb 2010 22:24:02 +0100 [thread overview]
Message-ID: <201002262224.02694.rjw@sisk.pl> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1002261130440.2029-100000@iolanthe.rowland.org>
On Friday 26 February 2010, Alan Stern wrote:
...
> Index: usb-2.6/drivers/base/power/power.h
> ===================================================================
> --- usb-2.6.orig/drivers/base/power/power.h
> +++ usb-2.6/drivers/base/power/power.h
> @@ -72,3 +72,14 @@ static inline void dpm_sysfs_remove(stru
> }
>
> #endif
> +
> +#if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_RUNTIME)
CONFIG_PM_OPS can be used for that, it means exactly the above.
> +/*
> + * invoke_runtime.c
> + */
> +extern void dpm_invoke_runtime_idle(struct device *dev);
> +extern int dpm_invoke_runtime_suspend(struct device *dev);
> +extern int dpm_invoke_runtime_resume(struct device *dev);
> +
> +#endif
> Index: usb-2.6/drivers/base/power/Makefile
> ===================================================================
> --- usb-2.6.orig/drivers/base/power/Makefile
> +++ usb-2.6/drivers/base/power/Makefile
> @@ -1,6 +1,6 @@
> obj-$(CONFIG_PM) += sysfs.o
> -obj-$(CONFIG_PM_SLEEP) += main.o
> -obj-$(CONFIG_PM_RUNTIME) += runtime.o
> +obj-$(CONFIG_PM_SLEEP) += main.o invoke_runtime.o
> +obj-$(CONFIG_PM_RUNTIME) += runtime.o invoke_runtime.o
And here I think.
There seem to be a few more places where the comment applies.
> obj-$(CONFIG_PM_TRACE_RTC) += trace.o
>
> ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG
> Index: usb-2.6/drivers/base/power/main.c
> ===================================================================
> --- usb-2.6.orig/drivers/base/power/main.c
> +++ usb-2.6/drivers/base/power/main.c
> @@ -936,3 +936,51 @@ void __suspend_report_result(const char
> printk(KERN_ERR "%s(): %pF returns %d\n", function, fn, ret);
> }
> EXPORT_SYMBOL_GPL(__suspend_report_result);
> +
> +#if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_RUNTIME)
> +
> +/* Convenience routines for drivers that want to use the same functions
> + * for system suspend/resume and runtime suspend/resume:
> + * Set driver->pm_ops->suspend = dpm_use_runtime_suspend and
> + * driver->pm_ops->resume = dpm_use_runtime_resume.
> + */
I have one problem with the design. Namely, dpm_invoke_runtime_*() can
run a callback from another subsystem. Say you are a device class and you
decide to use dpm_invoke_runtime_*(), but the device's bus type implements
the runtime PM callbacks, so they will be run as device class suspend and
resume callbacks. That doesn't look particularly clean to me.
Rafael
next prev parent reply other threads:[~2010-02-26 21:24 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 [this message]
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
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=201002262224.02694.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