From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Linux PM mailing list <linux-pm@lists.linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Paul Mundt <lethal@linux-sh.org>,
Magnus Damm <magnus.damm@gmail.com>,
linux-sh@vger.kernel.org
Subject: [RFC][PATCH] PM / Platform: Remove __weak definitions of runtime PM callbacks
Date: Sat, 26 Mar 2011 23:58:41 +0000 [thread overview]
Message-ID: <201103270058.41632.rjw@sisk.pl> (raw)
From: Rafael J. Wysocki <rjw@sisk.pl>
Remove the __weak definitions of platform bus type runtime PM
callbacks, make platform_dev_pm_ops point to the generic routines
as appropriate and allow architectures using platform_dev_pm_ops to
replace the runtime PM callbacks in that structure with their own
set.
Convert architectures providing its own definitions of the platform
runtime PM callbacks to use the new mechanism.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
arch/arm/mach-shmobile/pm_runtime.c | 3 ++
arch/sh/kernel/cpu/shmobile/pm_runtime.c | 3 ++
drivers/base/platform.c | 43 ++++++++++---------------------
include/linux/platform_device.h | 4 ++
4 files changed, 24 insertions(+), 29 deletions(-)
Index: linux-2.6/drivers/base/platform.c
=================================--- linux-2.6.orig/drivers/base/platform.c
+++ linux-2.6/drivers/base/platform.c
@@ -922,32 +922,7 @@ static int platform_pm_restore_noirq(str
#endif /* !CONFIG_HIBERNATION */
-#ifdef CONFIG_PM_RUNTIME
-
-int __weak platform_pm_runtime_suspend(struct device *dev)
-{
- return pm_generic_runtime_suspend(dev);
-};
-
-int __weak platform_pm_runtime_resume(struct device *dev)
-{
- return pm_generic_runtime_resume(dev);
-};
-
-int __weak platform_pm_runtime_idle(struct device *dev)
-{
- return pm_generic_runtime_idle(dev);
-};
-
-#else /* !CONFIG_PM_RUNTIME */
-
-#define platform_pm_runtime_suspend NULL
-#define platform_pm_runtime_resume NULL
-#define platform_pm_runtime_idle NULL
-
-#endif /* !CONFIG_PM_RUNTIME */
-
-static const struct dev_pm_ops platform_dev_pm_ops = {
+static struct dev_pm_ops platform_dev_pm_ops = {
.prepare = platform_pm_prepare,
.complete = platform_pm_complete,
.suspend = platform_pm_suspend,
@@ -962,9 +937,9 @@ static const struct dev_pm_ops platform_
.thaw_noirq = platform_pm_thaw_noirq,
.poweroff_noirq = platform_pm_poweroff_noirq,
.restore_noirq = platform_pm_restore_noirq,
- .runtime_suspend = platform_pm_runtime_suspend,
- .runtime_resume = platform_pm_runtime_resume,
- .runtime_idle = platform_pm_runtime_idle,
+ SET_RUNTIME_PM_OPS(pm_generic_runtime_suspend,
+ pm_generic_runtime_resume,
+ pm_generic_runtime_idle)
};
struct bus_type platform_bus_type = {
@@ -976,6 +951,16 @@ struct bus_type platform_bus_type = {
};
EXPORT_SYMBOL_GPL(platform_bus_type);
+void platform_set_runtime_pm_ops(int (*suspend)(struct device *dev),
+ int (*resume)(struct device *dev),
+ int (*idle)(struct device *dev))
+{
+ platform_dev_pm_ops.runtime_suspend = suspend;
+ platform_dev_pm_ops.runtime_resume = resume;
+ platform_dev_pm_ops.runtime_idle = idle;
+}
+EXPORT_SYMBOL_GPL(platform_set_runtime_pm_ops);
+
/**
* platform_bus_get_pm_ops() - return pointer to busses dev_pm_ops
*
Index: linux-2.6/include/linux/platform_device.h
=================================--- linux-2.6.orig/include/linux/platform_device.h
+++ linux-2.6/include/linux/platform_device.h
@@ -200,4 +200,8 @@ static inline char *early_platform_drive
}
#endif /* MODULE */
+extern void platform_set_runtime_pm_ops(int (*suspend)(struct device *dev),
+ int (*resume)(struct device *dev),
+ int (*idle)(struct device *dev));
+
#endif /* _PLATFORM_DEVICE_H_ */
Index: linux-2.6/arch/arm/mach-shmobile/pm_runtime.c
=================================--- linux-2.6.orig/arch/arm/mach-shmobile/pm_runtime.c
+++ linux-2.6/arch/arm/mach-shmobile/pm_runtime.c
@@ -163,6 +163,9 @@ static struct notifier_block platform_bu
static int __init sh_pm_runtime_init(void)
{
+ platform_set_runtime_pm_ops(platform_pm_runtime_suspend,
+ platform_pm_runtime_resume,
+ platform_pm_runtime_idle);
bus_register_notifier(&platform_bus_type, &platform_bus_notifier);
return 0;
}
Index: linux-2.6/arch/sh/kernel/cpu/shmobile/pm_runtime.c
=================================--- linux-2.6.orig/arch/sh/kernel/cpu/shmobile/pm_runtime.c
+++ linux-2.6/arch/sh/kernel/cpu/shmobile/pm_runtime.c
@@ -302,6 +302,9 @@ static int __init sh_pm_runtime_init(voi
{
INIT_WORK(&hwblk_work, platform_pm_runtime_work);
+ platform_set_runtime_pm_ops(platform_pm_runtime_suspend,
+ platform_pm_runtime_resume,
+ platform_pm_runtime_idle);
bus_register_notifier(&platform_bus_type, &platform_bus_notifier);
return 0;
}
next reply other threads:[~2011-03-26 23:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-26 23:58 Rafael J. Wysocki [this message]
2011-03-28 11:05 ` [RFC][PATCH] PM / Platform: Remove __weak definitions of runtime Magnus Damm
2011-03-28 19:43 ` [RFC][PATCH] PM / Platform: Remove __weak definitions of runtime PM callbacks Rafael J. Wysocki
2011-04-05 7:17 ` [RFC][PATCH] PM / Platform: Remove __weak definitions of runtime Magnus Damm
2011-04-06 4:24 ` [RFC][PATCH] PM / Platform: Remove __weak definitions of runtime PM callbacks Rafael J. Wysocki
2011-03-29 3:13 ` Paul Mundt
2011-04-06 22:35 ` Kevin Hilman
2011-04-07 5:29 ` Rafael J. Wysocki
2011-04-07 5:48 ` [RFC][PATCH] PM / Platform: Remove __weak definitions of runtime Grant Likely
2011-04-07 6:15 ` [RFC][PATCH] PM / Platform: Remove __weak definitions of runtime PM callbacks Rafael J. Wysocki
2011-04-07 7:09 ` [RFC][PATCH] PM / Platform: Remove __weak definitions of runtime Grant Likely
2011-04-07 5:44 ` Grant Likely
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=201103270058.41632.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=linux-sh@vger.kernel.org \
--cc=magnus.damm@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).