Skip to contentSkip to conversation

shmobile: prepare to allow export of sh_pm_runtime_init()

RFC Ben Hutchings 1 participant 1 message Mar 17, 2014 SuperH

lore
Share & tools
lore
#0 lore raw
Quoted 18 lines · Ben Dooks

In a multi-platform kernel, we cannot simply add this as a initcall as it may be built and run on archtiectures other than the SHMOBILE so export the sh_pm_runtime_init() call to be used from the machine specific code.

---
 drivers/sh/pm_runtime.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/sh/pm_runtime.c +0 -0
index 5cfbd82..f4f8851 100644
@@ -42,16 +42,19 @@ static struct pm_clk_notifier_block platform_bus_notifier = {
 	.con_ids = { NULL, },
 };
 

drivers/sh/pm_runtime.c static struct pm_clk_notifier_block platform_bus_notifier = { · line 50

Quoted 10 lines
drivers/sh/pm_runtime.c +4 -2
-static int __init sh_pm_runtime_init(void)
+static bool default_pm_on;
+
+int __init sh_pm_runtime_init(void)
 {
+	default_pm_on = true;
 	pm_clk_add_notifier(&platform_bus_type, &platform_bus_notifier);
 	return 0;
 }
-core_initcall(sh_pm_runtime_init);

This appears to break initialisation until 4/6 "ARM: shmobile: r8a7790:
call sh_pm_runtime_init()" is applied. I think patches 2-4 must all be folded together.

Ben.

Quoted 8 lines
drivers/sh/pm_runtime.c +2 -1
 static int __init sh_pm_runtime_late_init(void)
 {
-	pm_genpd_poweroff_unused();
+	if (default_pm_on)
+		pm_genpd_poweroff_unused();
 	return 0;
 }
 late_initcall(sh_pm_runtime_late_init);