Skip to contentSkip to conversation

kernel: Add support for poweroff handler call chain

PATCH In review Guenter Roeck 28 participants 271 messages Oct 7, 2014 – Jun 18, 2015 Page 2 of 2

Subsystems (59)
lore
Share & tools
lore
author maintainer
#183 lore raw

PATCH 23/44 power/reset: qnap-poweroff: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with default priority value of 128 to reflect that the original code generates an error if another poweroff handler has already been registered when the driver is loaded.

Cc Sebastian Reichel <[email protected]>
Cc Dmitry Eremin-Solenikov <[email protected]>
Cc David Woodhouse <[email protected]>
---
 drivers/power/reset/qnap-poweroff.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/power/reset/qnap-poweroff.c +14 -14
index a75db7f..c474980 100644
@@ -16,7 +16,9 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/notifier.h>
 #include <linux/platform_device.h>
+#include <linux/pm.h>
 #include <linux/serial_reg.h>
 #include <linux/kallsyms.h>
 #include <linux/of.h>
@@ -55,7 +57,8 @@ static void __iomem *base;
 static unsigned long tclk;
 static const struct power_off_cfg *cfg;
 
-static void qnap_power_off(void)
+static int qnap_power_off(struct notifier_block *this, unsigned long unused1,
+			  void *unused2)
 {
 	const unsigned divisor = ((tclk + (8 * cfg->baud)) / (16 * cfg->baud));
 
@@ -72,14 +75,20 @@ static void qnap_power_off(void)
 
 	/* send the power-off command to PIC */
 	writel(cfg->cmd, UART1_REG(TX));
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block qnap_poweroff_nb = {
+	.notifier_call = qnap_power_off,
+	.priority = 128,
+};
+
 static int qnap_power_off_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
 	struct resource *res;
 	struct clk *clk;
-	char symname[KSYM_NAME_LEN];
 
 	const struct of_device_id *match =
 		of_match_node(qnap_power_off_of_match_table, np);
@@ -106,22 +115,13 @@ static int qnap_power_off_probe(struct platform_device *pdev)
 
 	tclk = clk_get_rate(clk);
 
-	/* Check that nothing else has already setup a handler */
-	if (pm_power_off) {
-		lookup_symbol_name((ulong)pm_power_off, symname);
-		dev_err(&pdev->dev,
-			"pm_power_off already claimed %p %s",
-			pm_power_off, symname);
-		return -EBUSY;
-	}
-	pm_power_off = qnap_power_off;
-
-	return 0;
+	return register_poweroff_handler(&qnap_poweroff_nb);
 }
 
 static int qnap_power_off_remove(struct platform_device *pdev)
 {
-	pm_power_off = NULL;
+	unregister_poweroff_handler(&qnap_poweroff_nb);
+
 	return 0;
 }
 
Signature · 1 line
1.9.1
maintainer Acked-by on v1 23/44
#184 lore raw

Re: [PATCH 23/44] power/reset: qnap-poweroff: Register with kernel poweroff handler

Quoted 9 lines · Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with default priority value of 128 to reflect that the original code generates an error if another poweroff handler has already been registered when the driver is loaded.

Cc Sebastian Reichel <[email protected]>
Cc Dmitry Eremin-Solenikov <[email protected]>
Cc David Woodhouse <[email protected]>

Thanks
Andrew

Quoted 84 lines
---
 drivers/power/reset/qnap-poweroff.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/power/reset/qnap-poweroff.c +14 -14
index a75db7f..c474980 100644
@@ -16,7 +16,9 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/notifier.h>
 #include <linux/platform_device.h>
+#include <linux/pm.h>
 #include <linux/serial_reg.h>
 #include <linux/kallsyms.h>
 #include <linux/of.h>
@@ -55,7 +57,8 @@ static void __iomem *base;
 static unsigned long tclk;
 static const struct power_off_cfg *cfg;
 
-static void qnap_power_off(void)
+static int qnap_power_off(struct notifier_block *this, unsigned long unused1,
+			  void *unused2)
 {
 	const unsigned divisor = ((tclk + (8 * cfg->baud)) / (16 * cfg->baud));
 
@@ -72,14 +75,20 @@ static void qnap_power_off(void)
 
 	/* send the power-off command to PIC */
 	writel(cfg->cmd, UART1_REG(TX));
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block qnap_poweroff_nb = {
+	.notifier_call = qnap_power_off,
+	.priority = 128,
+};
+
 static int qnap_power_off_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
 	struct resource *res;
 	struct clk *clk;
-	char symname[KSYM_NAME_LEN];
 
 	const struct of_device_id *match =
 		of_match_node(qnap_power_off_of_match_table, np);
@@ -106,22 +115,13 @@ static int qnap_power_off_probe(struct platform_device *pdev)
 
 	tclk = clk_get_rate(clk);
 
-	/* Check that nothing else has already setup a handler */
-	if (pm_power_off) {
-		lookup_symbol_name((ulong)pm_power_off, symname);
-		dev_err(&pdev->dev,
-			"pm_power_off already claimed %p %s",
-			pm_power_off, symname);
-		return -EBUSY;
-	}
-	pm_power_off = qnap_power_off;
-
-	return 0;
+	return register_poweroff_handler(&qnap_poweroff_nb);
 }
 
 static int qnap_power_off_remove(struct platform_device *pdev)
 {
-	pm_power_off = NULL;
+	unregister_poweroff_handler(&qnap_poweroff_nb);
+
 	return 0;
 }
 
Signature · 7 lines
1.9.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer Acked-by on v1 23/44
#185 lore raw

Re: [PATCH 23/44] power/reset: qnap-poweroff: Register with kernel poweroff handler

In reply to Guenter Roeck
Quoted 9 lines · Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with default priority value of 128 to reflect that the original code generates an error if another poweroff handler has already been registered when the driver is loaded.

Cc Sebastian Reichel <[email protected]>
Cc Dmitry Eremin-Solenikov <[email protected]>
Cc David Woodhouse <[email protected]>

Thanks
Andrew

Quoted 84 lines
---
 drivers/power/reset/qnap-poweroff.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/power/reset/qnap-poweroff.c +14 -14
index a75db7f..c474980 100644
@@ -16,7 +16,9 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/notifier.h>
 #include <linux/platform_device.h>
+#include <linux/pm.h>
 #include <linux/serial_reg.h>
 #include <linux/kallsyms.h>
 #include <linux/of.h>
@@ -55,7 +57,8 @@ static void __iomem *base;
 static unsigned long tclk;
 static const struct power_off_cfg *cfg;
 
-static void qnap_power_off(void)
+static int qnap_power_off(struct notifier_block *this, unsigned long unused1,
+			  void *unused2)
 {
 	const unsigned divisor = ((tclk + (8 * cfg->baud)) / (16 * cfg->baud));
 
@@ -72,14 +75,20 @@ static void qnap_power_off(void)
 
 	/* send the power-off command to PIC */
 	writel(cfg->cmd, UART1_REG(TX));
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block qnap_poweroff_nb = {
+	.notifier_call = qnap_power_off,
+	.priority = 128,
+};
+
 static int qnap_power_off_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
 	struct resource *res;
 	struct clk *clk;
-	char symname[KSYM_NAME_LEN];
 
 	const struct of_device_id *match =
 		of_match_node(qnap_power_off_of_match_table, np);
@@ -106,22 +115,13 @@ static int qnap_power_off_probe(struct platform_device *pdev)
 
 	tclk = clk_get_rate(clk);
 
-	/* Check that nothing else has already setup a handler */
-	if (pm_power_off) {
-		lookup_symbol_name((ulong)pm_power_off, symname);
-		dev_err(&pdev->dev,
-			"pm_power_off already claimed %p %s",
-			pm_power_off, symname);
-		return -EBUSY;
-	}
-	pm_power_off = qnap_power_off;
-
-	return 0;
+	return register_poweroff_handler(&qnap_poweroff_nb);
 }
 
 static int qnap_power_off_remove(struct platform_device *pdev)
 {
-	pm_power_off = NULL;
+	unregister_poweroff_handler(&qnap_poweroff_nb);
+
 	return 0;
 }
 
Signature · 7 lines
1.9.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer Acked-by on v1 23/44
#186 lore raw

Re: [PATCH 23/44] power/reset: qnap-poweroff: Register with kernel poweroff handler

In reply to Guenter Roeck
Quoted 9 lines · Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with default priority value of 128 to reflect that the original code generates an error if another poweroff handler has already been registered when the driver is loaded.

Cc Sebastian Reichel <[email protected]>
Cc Dmitry Eremin-Solenikov <[email protected]>
Cc David Woodhouse <[email protected]>

Thanks
Andrew

Quoted 84 lines
---
 drivers/power/reset/qnap-poweroff.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/power/reset/qnap-poweroff.c +14 -14
index a75db7f..c474980 100644
@@ -16,7 +16,9 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/notifier.h>
 #include <linux/platform_device.h>
+#include <linux/pm.h>
 #include <linux/serial_reg.h>
 #include <linux/kallsyms.h>
 #include <linux/of.h>
@@ -55,7 +57,8 @@ static void __iomem *base;
 static unsigned long tclk;
 static const struct power_off_cfg *cfg;
 
-static void qnap_power_off(void)
+static int qnap_power_off(struct notifier_block *this, unsigned long unused1,
+			  void *unused2)
 {
 	const unsigned divisor = ((tclk + (8 * cfg->baud)) / (16 * cfg->baud));
 
@@ -72,14 +75,20 @@ static void qnap_power_off(void)
 
 	/* send the power-off command to PIC */
 	writel(cfg->cmd, UART1_REG(TX));
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block qnap_poweroff_nb = {
+	.notifier_call = qnap_power_off,
+	.priority = 128,
+};
+
 static int qnap_power_off_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
 	struct resource *res;
 	struct clk *clk;
-	char symname[KSYM_NAME_LEN];
 
 	const struct of_device_id *match =
 		of_match_node(qnap_power_off_of_match_table, np);
@@ -106,22 +115,13 @@ static int qnap_power_off_probe(struct platform_device *pdev)
 
 	tclk = clk_get_rate(clk);
 
-	/* Check that nothing else has already setup a handler */
-	if (pm_power_off) {
-		lookup_symbol_name((ulong)pm_power_off, symname);
-		dev_err(&pdev->dev,
-			"pm_power_off already claimed %p %s",
-			pm_power_off, symname);
-		return -EBUSY;
-	}
-	pm_power_off = qnap_power_off;
-
-	return 0;
+	return register_poweroff_handler(&qnap_poweroff_nb);
 }
 
 static int qnap_power_off_remove(struct platform_device *pdev)
 {
-	pm_power_off = NULL;
+	unregister_poweroff_handler(&qnap_poweroff_nb);
+
 	return 0;
 }
 
Signature · 7 lines
1.9.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author maintainer
#187 lore raw

PATCH 23/44 power/reset: qnap-poweroff: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with default priority value of 128 to reflect that the original code generates an error if another poweroff handler has already been registered when the driver is loaded.

Cc Sebastian Reichel <[email protected]>
Cc Dmitry Eremin-Solenikov <[email protected]>
Cc David Woodhouse <[email protected]>
---
 drivers/power/reset/qnap-poweroff.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/power/reset/qnap-poweroff.c +14 -14
index a75db7f..c474980 100644
@@ -16,7 +16,9 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/notifier.h>
 #include <linux/platform_device.h>
+#include <linux/pm.h>
 #include <linux/serial_reg.h>
 #include <linux/kallsyms.h>
 #include <linux/of.h>
@@ -55,7 +57,8 @@ static void __iomem *base;
 static unsigned long tclk;
 static const struct power_off_cfg *cfg;
 
-static void qnap_power_off(void)
+static int qnap_power_off(struct notifier_block *this, unsigned long unused1,
+			  void *unused2)
 {
 	const unsigned divisor = ((tclk + (8 * cfg->baud)) / (16 * cfg->baud));
 
@@ -72,14 +75,20 @@ static void qnap_power_off(void)
 
 	/* send the power-off command to PIC */
 	writel(cfg->cmd, UART1_REG(TX));
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block qnap_poweroff_nb = {
+	.notifier_call = qnap_power_off,
+	.priority = 128,
+};
+
 static int qnap_power_off_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
 	struct resource *res;
 	struct clk *clk;
-	char symname[KSYM_NAME_LEN];
 
 	const struct of_device_id *match =
 		of_match_node(qnap_power_off_of_match_table, np);
@@ -106,22 +115,13 @@ static int qnap_power_off_probe(struct platform_device *pdev)
 
 	tclk = clk_get_rate(clk);
 
-	/* Check that nothing else has already setup a handler */
-	if (pm_power_off) {
-		lookup_symbol_name((ulong)pm_power_off, symname);
-		dev_err(&pdev->dev,
-			"pm_power_off already claimed %p %s",
-			pm_power_off, symname);
-		return -EBUSY;
-	}
-	pm_power_off = qnap_power_off;
-
-	return 0;
+	return register_poweroff_handler(&qnap_poweroff_nb);
 }
 
 static int qnap_power_off_remove(struct platform_device *pdev)
 {
-	pm_power_off = NULL;
+	unregister_poweroff_handler(&qnap_poweroff_nb);
+
 	return 0;
 }
 
Signature · 1 line
1.9.1
author maintainer
#188 lore raw

PATCH 24/44 power/reset: msm-powroff: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Select proprity 0 since the code does not really poweroff the system.

---
 drivers/power/reset/msm-poweroff.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/power/reset/msm-poweroff.c +11 -2
index 774f9a3..189bcd3 100644
@@ -19,6 +19,7 @@
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/module.h>
+#include <linux/notifier.h>
 #include <linux/reboot.h>
 
 #include <asm/system_misc.h>
@@ -31,12 +32,19 @@ static void do_msm_restart(enum reboot_mode reboot_mode, const char *cmd)
 	mdelay(10000);
 }
 
-static void do_msm_poweroff(void)
+static int do_msm_poweroff(struct notifier_block *this,
+			   unsigned long unused1, void *unused2)
 {
 	/* TODO: Add poweroff capability */
 	do_msm_restart(REBOOT_HARD, NULL);
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block msm_powroff_nb = {
+	.notifier_call = do_msm_poweroff,
+};
+
 static int msm_restart_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -47,7 +55,8 @@ static int msm_restart_probe(struct platform_device *pdev)
 	if (IS_ERR(msm_ps_hold))
 		return PTR_ERR(msm_ps_hold);
 
-	pm_power_off = do_msm_poweroff;
+	if (register_poweroff_handler(&msm_powroff_nb))
+		dev_err(&pdev->dev, "Failed to register poweroff handler\n");
 	arm_pm_restart = do_msm_restart;
 	return 0;
 }
Signature · 1 line
1.9.1
author maintainer
#189 lore raw

PATCH 24/44 power/reset: msm-powroff: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Select proprity 0 since the code does not really poweroff the system.

---
 drivers/power/reset/msm-poweroff.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/power/reset/msm-poweroff.c +11 -2
index 774f9a3..189bcd3 100644
@@ -19,6 +19,7 @@
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/module.h>
+#include <linux/notifier.h>
 #include <linux/reboot.h>
 
 #include <asm/system_misc.h>
@@ -31,12 +32,19 @@ static void do_msm_restart(enum reboot_mode reboot_mode, const char *cmd)
 	mdelay(10000);
 }
 
-static void do_msm_poweroff(void)
+static int do_msm_poweroff(struct notifier_block *this,
+			   unsigned long unused1, void *unused2)
 {
 	/* TODO: Add poweroff capability */
 	do_msm_restart(REBOOT_HARD, NULL);
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block msm_powroff_nb = {
+	.notifier_call = do_msm_poweroff,
+};
+
 static int msm_restart_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -47,7 +55,8 @@ static int msm_restart_probe(struct platform_device *pdev)
 	if (IS_ERR(msm_ps_hold))
 		return PTR_ERR(msm_ps_hold);
 
-	pm_power_off = do_msm_poweroff;
+	if (register_poweroff_handler(&msm_powroff_nb))
+		dev_err(&pdev->dev, "Failed to register poweroff handler\n");
 	arm_pm_restart = do_msm_restart;
 	return 0;
 }
Signature · 1 line
1.9.1
author maintainer
#190 lore raw

PATCH 24/44 power/reset: msm-powroff: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Select proprity 0 since the code does not really poweroff the system.

---
 drivers/power/reset/msm-poweroff.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/power/reset/msm-poweroff.c +11 -2
index 774f9a3..189bcd3 100644
@@ -19,6 +19,7 @@
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/module.h>
+#include <linux/notifier.h>
 #include <linux/reboot.h>
 
 #include <asm/system_misc.h>
@@ -31,12 +32,19 @@ static void do_msm_restart(enum reboot_mode reboot_mode, const char *cmd)
 	mdelay(10000);
 }
 
-static void do_msm_poweroff(void)
+static int do_msm_poweroff(struct notifier_block *this,
+			   unsigned long unused1, void *unused2)
 {
 	/* TODO: Add poweroff capability */
 	do_msm_restart(REBOOT_HARD, NULL);
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block msm_powroff_nb = {
+	.notifier_call = do_msm_poweroff,
+};
+
 static int msm_restart_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -47,7 +55,8 @@ static int msm_restart_probe(struct platform_device *pdev)
 	if (IS_ERR(msm_ps_hold))
 		return PTR_ERR(msm_ps_hold);
 
-	pm_power_off = do_msm_poweroff;
+	if (register_poweroff_handler(&msm_powroff_nb))
+		dev_err(&pdev->dev, "Failed to register poweroff handler\n");
 	arm_pm_restart = do_msm_restart;
 	return 0;
 }
Signature · 1 line
1.9.1
author maintainer
#191 lore raw

PATCH 25/44 power/reset: vexpress-poweroff: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

---
 drivers/power/reset/vexpress-poweroff.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/power/reset/vexpress-poweroff.c +17 -2
index 4dc102e2..060c55d 100644
@@ -12,6 +12,7 @@
  */
 
 #include <linux/delay.h>
+#include <linux/notifier.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
@@ -36,11 +37,19 @@ static void vexpress_reset_do(struct device *dev, const char *what)
 
 static struct device *vexpress_power_off_device;
 
-static void vexpress_power_off(void)
+static int vexpress_power_off(struct notifier_block *this,
+			      unsigned long unused1, void *unused2)
 {
 	vexpress_reset_do(vexpress_power_off_device, "power off");
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block vexpress_poweroff_nb = {
+	.notifier_call = vexpress_power_off,
+	.priority = 128,
+};
+
 static struct device *vexpress_restart_device;
 
 static void vexpress_restart(enum reboot_mode reboot_mode, const char *cmd)
@@ -92,6 +101,7 @@ static int vexpress_reset_probe(struct platform_device *pdev)
 	const struct of_device_id *match =
 			of_match_device(vexpress_reset_of_match, &pdev->dev);
 	struct regmap *regmap;
+	int ret;
 
 	if (match)
 		func = (enum vexpress_reset_func)match->data;
@@ -106,7 +116,12 @@ static int vexpress_reset_probe(struct platform_device *pdev)
 	switch (func) {
 	case FUNC_SHUTDOWN:
 		vexpress_power_off_device = &pdev->dev;
-		pm_power_off = vexpress_power_off;
+		ret = register_poweroff_handler(&vexpress_poweroff_nb);
+		if (ret) {
+			dev_err(&pdev->dev,
+				"Failed to register poweroff handler\n");
+			return ret;
+		}
 		break;
 	case FUNC_RESET:
 		if (!vexpress_restart_device)
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-metag" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author maintainer
#192 lore raw

PATCH 25/44 power/reset: vexpress-poweroff: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

---
 drivers/power/reset/vexpress-poweroff.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/power/reset/vexpress-poweroff.c +17 -2
index 4dc102e2..060c55d 100644
@@ -12,6 +12,7 @@
  */
 
 #include <linux/delay.h>
+#include <linux/notifier.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
@@ -36,11 +37,19 @@ static void vexpress_reset_do(struct device *dev, const char *what)
 
 static struct device *vexpress_power_off_device;
 
-static void vexpress_power_off(void)
+static int vexpress_power_off(struct notifier_block *this,
+			      unsigned long unused1, void *unused2)
 {
 	vexpress_reset_do(vexpress_power_off_device, "power off");
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block vexpress_poweroff_nb = {
+	.notifier_call = vexpress_power_off,
+	.priority = 128,
+};
+
 static struct device *vexpress_restart_device;
 
 static void vexpress_restart(enum reboot_mode reboot_mode, const char *cmd)
@@ -92,6 +101,7 @@ static int vexpress_reset_probe(struct platform_device *pdev)
 	const struct of_device_id *match =
 			of_match_device(vexpress_reset_of_match, &pdev->dev);
 	struct regmap *regmap;
+	int ret;
 
 	if (match)
 		func = (enum vexpress_reset_func)match->data;
@@ -106,7 +116,12 @@ static int vexpress_reset_probe(struct platform_device *pdev)
 	switch (func) {
 	case FUNC_SHUTDOWN:
 		vexpress_power_off_device = &pdev->dev;
-		pm_power_off = vexpress_power_off;
+		ret = register_poweroff_handler(&vexpress_poweroff_nb);
+		if (ret) {
+			dev_err(&pdev->dev,
+				"Failed to register poweroff handler\n");
+			return ret;
+		}
 		break;
 	case FUNC_RESET:
 		if (!vexpress_restart_device)
Signature · 1 line
1.9.1
author maintainer
#193 lore raw

PATCH 25/44 power/reset: vexpress-poweroff: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

---
 drivers/power/reset/vexpress-poweroff.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/power/reset/vexpress-poweroff.c +17 -2
index 4dc102e2..060c55d 100644
@@ -12,6 +12,7 @@
  */
 
 #include <linux/delay.h>
+#include <linux/notifier.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
@@ -36,11 +37,19 @@ static void vexpress_reset_do(struct device *dev, const char *what)
 
 static struct device *vexpress_power_off_device;
 
-static void vexpress_power_off(void)
+static int vexpress_power_off(struct notifier_block *this,
+			      unsigned long unused1, void *unused2)
 {
 	vexpress_reset_do(vexpress_power_off_device, "power off");
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block vexpress_poweroff_nb = {
+	.notifier_call = vexpress_power_off,
+	.priority = 128,
+};
+
 static struct device *vexpress_restart_device;
 
 static void vexpress_restart(enum reboot_mode reboot_mode, const char *cmd)
@@ -92,6 +101,7 @@ static int vexpress_reset_probe(struct platform_device *pdev)
 	const struct of_device_id *match =
 			of_match_device(vexpress_reset_of_match, &pdev->dev);
 	struct regmap *regmap;
+	int ret;
 
 	if (match)
 		func = (enum vexpress_reset_func)match->data;
@@ -106,7 +116,12 @@ static int vexpress_reset_probe(struct platform_device *pdev)
 	switch (func) {
 	case FUNC_SHUTDOWN:
 		vexpress_power_off_device = &pdev->dev;
-		pm_power_off = vexpress_power_off;
+		ret = register_poweroff_handler(&vexpress_poweroff_nb);
+		if (ret) {
+			dev_err(&pdev->dev,
+				"Failed to register poweroff handler\n");
+			return ret;
+		}
 		break;
 	case FUNC_RESET:
 		if (!vexpress_restart_device)
Signature · 1 line
1.9.1
author maintainer
#194 lore raw

PATCH 26/44 x86: iris: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with high priority value of 192 to reflect that the original code overwrites existing poweroff handlers.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc H. Peter Anvin <[email protected]>
---
 arch/x86/platform/iris/iris.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)
arch/x86/platform/iris/iris.c +19 -6
index 4d171e8..662c4e8 100644
@@ -23,6 +23,7 @@
 
 #include <linux/moduleparam.h>
 #include <linux/module.h>
+#include <linux/notifier.h>
 #include <linux/platform_device.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -47,15 +48,21 @@ static bool force;
 module_param(force, bool, 0);
 MODULE_PARM_DESC(force, "Set to one to force poweroff handler installation.");
 
-static void (*old_pm_power_off)(void);
-
-static void iris_power_off(void)
+static int iris_power_off(struct notifier_block *this, unsigned long unused1,
+			  void *unused2)
 {
 	outb(IRIS_GIO_PULSE, IRIS_GIO_OUTPUT);
 	msleep(850);
 	outb(IRIS_GIO_REST, IRIS_GIO_OUTPUT);
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block iris_poweroff_nb = {
+	.notifier_call = iris_power_off,
+	.priority = 192,
+};
+
 /*
  * Before installing the power_off handler, try to make sure the OS is
  * running on an Iris.  Since Iris does not support DMI, this is done
@@ -65,20 +72,26 @@ static void iris_power_off(void)
 static int iris_probe(struct platform_device *pdev)
 {
 	unsigned char status = inb(IRIS_GIO_INPUT);
+	int ret;
+
 	if (status == IRIS_GIO_NODEV) {
 		printk(KERN_ERR "This machine does not seem to be an Iris. "
 			"Power off handler not installed.\n");
 		return -ENODEV;
 	}
-	old_pm_power_off = pm_power_off;
-	pm_power_off = &iris_power_off;
+
+	ret = register_poweroff_handler(&iris_poweroff_nb);
+	if (ret) {
+		dev_err(&pdev->dev, "Failed to register poweroff handler\n");
+		return ret;
+	}
 	printk(KERN_INFO "Iris power_off handler installed.\n");
 	return 0;
 }
 
 static int iris_remove(struct platform_device *pdev)
 {
-	pm_power_off = old_pm_power_off;
+	unregister_poweroff_handler(&iris_poweroff_nb);
 	printk(KERN_INFO "Iris power_off handler uninstalled.\n");
 	return 0;
 }
Signature · 1 line
1.9.1
author maintainer
#195 lore raw

PATCH 26/44 x86: iris: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with high priority value of 192 to reflect that the original code overwrites existing poweroff handlers.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc H. Peter Anvin <[email protected]>
---
 arch/x86/platform/iris/iris.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)
arch/x86/platform/iris/iris.c +19 -6
index 4d171e8..662c4e8 100644
@@ -23,6 +23,7 @@
 
 #include <linux/moduleparam.h>
 #include <linux/module.h>
+#include <linux/notifier.h>
 #include <linux/platform_device.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -47,15 +48,21 @@ static bool force;
 module_param(force, bool, 0);
 MODULE_PARM_DESC(force, "Set to one to force poweroff handler installation.");
 
-static void (*old_pm_power_off)(void);
-
-static void iris_power_off(void)
+static int iris_power_off(struct notifier_block *this, unsigned long unused1,
+			  void *unused2)
 {
 	outb(IRIS_GIO_PULSE, IRIS_GIO_OUTPUT);
 	msleep(850);
 	outb(IRIS_GIO_REST, IRIS_GIO_OUTPUT);
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block iris_poweroff_nb = {
+	.notifier_call = iris_power_off,
+	.priority = 192,
+};
+
 /*
  * Before installing the power_off handler, try to make sure the OS is
  * running on an Iris.  Since Iris does not support DMI, this is done
@@ -65,20 +72,26 @@ static void iris_power_off(void)
 static int iris_probe(struct platform_device *pdev)
 {
 	unsigned char status = inb(IRIS_GIO_INPUT);
+	int ret;
+
 	if (status == IRIS_GIO_NODEV) {
 		printk(KERN_ERR "This machine does not seem to be an Iris. "
 			"Power off handler not installed.\n");
 		return -ENODEV;
 	}
-	old_pm_power_off = pm_power_off;
-	pm_power_off = &iris_power_off;
+
+	ret = register_poweroff_handler(&iris_poweroff_nb);
+	if (ret) {
+		dev_err(&pdev->dev, "Failed to register poweroff handler\n");
+		return ret;
+	}
 	printk(KERN_INFO "Iris power_off handler installed.\n");
 	return 0;
 }
 
 static int iris_remove(struct platform_device *pdev)
 {
-	pm_power_off = old_pm_power_off;
+	unregister_poweroff_handler(&iris_poweroff_nb);
 	printk(KERN_INFO "Iris power_off handler uninstalled.\n");
 	return 0;
 }
Signature · 1 line
1.9.1
author maintainer
#196 lore raw

PATCH 26/44 x86: iris: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with high priority value of 192 to reflect that the original code overwrites existing poweroff handlers.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc H. Peter Anvin <[email protected]>
---
 arch/x86/platform/iris/iris.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)
arch/x86/platform/iris/iris.c +19 -6
index 4d171e8..662c4e8 100644
@@ -23,6 +23,7 @@
 
 #include <linux/moduleparam.h>
 #include <linux/module.h>
+#include <linux/notifier.h>
 #include <linux/platform_device.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -47,15 +48,21 @@ static bool force;
 module_param(force, bool, 0);
 MODULE_PARM_DESC(force, "Set to one to force poweroff handler installation.");
 
-static void (*old_pm_power_off)(void);
-
-static void iris_power_off(void)
+static int iris_power_off(struct notifier_block *this, unsigned long unused1,
+			  void *unused2)
 {
 	outb(IRIS_GIO_PULSE, IRIS_GIO_OUTPUT);
 	msleep(850);
 	outb(IRIS_GIO_REST, IRIS_GIO_OUTPUT);
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block iris_poweroff_nb = {
+	.notifier_call = iris_power_off,
+	.priority = 192,
+};
+
 /*
  * Before installing the power_off handler, try to make sure the OS is
  * running on an Iris.  Since Iris does not support DMI, this is done
@@ -65,20 +72,26 @@ static void iris_power_off(void)
 static int iris_probe(struct platform_device *pdev)
 {
 	unsigned char status = inb(IRIS_GIO_INPUT);
+	int ret;
+
 	if (status == IRIS_GIO_NODEV) {
 		printk(KERN_ERR "This machine does not seem to be an Iris. "
 			"Power off handler not installed.\n");
 		return -ENODEV;
 	}
-	old_pm_power_off = pm_power_off;
-	pm_power_off = &iris_power_off;
+
+	ret = register_poweroff_handler(&iris_poweroff_nb);
+	if (ret) {
+		dev_err(&pdev->dev, "Failed to register poweroff handler\n");
+		return ret;
+	}
 	printk(KERN_INFO "Iris power_off handler installed.\n");
 	return 0;
 }
 
 static int iris_remove(struct platform_device *pdev)
 {
-	pm_power_off = old_pm_power_off;
+	unregister_poweroff_handler(&iris_poweroff_nb);
 	printk(KERN_INFO "Iris power_off handler uninstalled.\n");
 	return 0;
 }
Signature · 1 line
1.9.1
author maintainer
#197 lore raw

PATCH 27/44 x86: apm: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with high priority value of 192 to reflect that the original code overwrites existing poweroff handlers.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Jiri Kosina <[email protected]>
---
 arch/x86/kernel/apm_32.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
arch/x86/kernel/apm_32.c +15 -5
index 5848744..84566a6 100644
@@ -219,6 +219,7 @@
 #include <linux/init.h>
 #include <linux/time.h>
 #include <linux/sched.h>
+#include <linux/notifier.h>
 #include <linux/pm.h>
 #include <linux/capability.h>
 #include <linux/device.h>
@@ -981,7 +982,8 @@ recalc:
  *	on their first cpu.
  */
 
-static void apm_power_off(void)
+static int apm_power_off(struct notifier_block *this, unsigned long unused1,
+			 void *unused2)
 {
 	/* Some bioses don't like being called from CPU != 0 */
 	if (apm_info.realmode_power_off) {
@@ -990,8 +992,14 @@ static void apm_power_off(void)
 	} else {
 		(void)set_system_power_state(APM_STATE_OFF);
 	}
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block apm_poweroff_nb = {
+	.notifier_call = apm_power_off,
+	.priority = 192,
+};
+
 #ifdef CONFIG_APM_DO_ENABLE
 
 /**
@@ -1847,8 +1855,11 @@ static int apm(void *unused)
 	}
 
 	/* Install our power off handler.. */
-	if (power_off)
-		pm_power_off = apm_power_off;
+	if (power_off) {
+		error = register_poweroff_handler(&apm_poweroff_nb);
+		if (error)
+			pr_err("apm: Failed to register poweroff handler\n");
+	}
 
 	if (num_online_cpus() == 1 || smp) {
 #if defined(CONFIG_APM_DISPLAY_BLANK) && defined(CONFIG_VT)
@@ -2408,9 +2419,8 @@ static void __exit apm_exit(void)
 			apm_error("disengage power management", error);
 	}
 	misc_deregister(&apm_device);
+	unregister_poweroff_handler(&apm_poweroff_nb);
 	remove_proc_entry("apm", NULL);
-	if (power_off)
-		pm_power_off = NULL;
 	if (kapmd_task) {
 		kthread_stop(kapmd_task);
 		kapmd_task = NULL;
Signature · 1 line
1.9.1
author maintainer
#198 lore raw

PATCH 27/44 x86: apm: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with high priority value of 192 to reflect that the original code overwrites existing poweroff handlers.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Jiri Kosina <[email protected]>
---
 arch/x86/kernel/apm_32.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
arch/x86/kernel/apm_32.c +15 -5
index 5848744..84566a6 100644
@@ -219,6 +219,7 @@
 #include <linux/init.h>
 #include <linux/time.h>
 #include <linux/sched.h>
+#include <linux/notifier.h>
 #include <linux/pm.h>
 #include <linux/capability.h>
 #include <linux/device.h>
@@ -981,7 +982,8 @@ recalc:
  *	on their first cpu.
  */
 
-static void apm_power_off(void)
+static int apm_power_off(struct notifier_block *this, unsigned long unused1,
+			 void *unused2)
 {
 	/* Some bioses don't like being called from CPU != 0 */
 	if (apm_info.realmode_power_off) {
@@ -990,8 +992,14 @@ static void apm_power_off(void)
 	} else {
 		(void)set_system_power_state(APM_STATE_OFF);
 	}
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block apm_poweroff_nb = {
+	.notifier_call = apm_power_off,
+	.priority = 192,
+};
+
 #ifdef CONFIG_APM_DO_ENABLE
 
 /**
@@ -1847,8 +1855,11 @@ static int apm(void *unused)
 	}
 
 	/* Install our power off handler.. */
-	if (power_off)
-		pm_power_off = apm_power_off;
+	if (power_off) {
+		error = register_poweroff_handler(&apm_poweroff_nb);
+		if (error)
+			pr_err("apm: Failed to register poweroff handler\n");
+	}
 
 	if (num_online_cpus() == 1 || smp) {
 #if defined(CONFIG_APM_DISPLAY_BLANK) && defined(CONFIG_VT)
@@ -2408,9 +2419,8 @@ static void __exit apm_exit(void)
 			apm_error("disengage power management", error);
 	}
 	misc_deregister(&apm_device);
+	unregister_poweroff_handler(&apm_poweroff_nb);
 	remove_proc_entry("apm", NULL);
-	if (power_off)
-		pm_power_off = NULL;
 	if (kapmd_task) {
 		kthread_stop(kapmd_task);
 		kapmd_task = NULL;
Signature · 1 line
1.9.1
author maintainer
#199 lore raw

PATCH 27/44 x86: apm: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with high priority value of 192 to reflect that the original code overwrites existing poweroff handlers.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Jiri Kosina <[email protected]>
---
 arch/x86/kernel/apm_32.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
arch/x86/kernel/apm_32.c +15 -5
index 5848744..84566a6 100644
@@ -219,6 +219,7 @@
 #include <linux/init.h>
 #include <linux/time.h>
 #include <linux/sched.h>
+#include <linux/notifier.h>
 #include <linux/pm.h>
 #include <linux/capability.h>
 #include <linux/device.h>
@@ -981,7 +982,8 @@ recalc:
  *	on their first cpu.
  */
 
-static void apm_power_off(void)
+static int apm_power_off(struct notifier_block *this, unsigned long unused1,
+			 void *unused2)
 {
 	/* Some bioses don't like being called from CPU != 0 */
 	if (apm_info.realmode_power_off) {
@@ -990,8 +992,14 @@ static void apm_power_off(void)
 	} else {
 		(void)set_system_power_state(APM_STATE_OFF);
 	}
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block apm_poweroff_nb = {
+	.notifier_call = apm_power_off,
+	.priority = 192,
+};
+
 #ifdef CONFIG_APM_DO_ENABLE
 
 /**
@@ -1847,8 +1855,11 @@ static int apm(void *unused)
 	}
 
 	/* Install our power off handler.. */
-	if (power_off)
-		pm_power_off = apm_power_off;
+	if (power_off) {
+		error = register_poweroff_handler(&apm_poweroff_nb);
+		if (error)
+			pr_err("apm: Failed to register poweroff handler\n");
+	}
 
 	if (num_online_cpus() == 1 || smp) {
 #if defined(CONFIG_APM_DISPLAY_BLANK) && defined(CONFIG_VT)
@@ -2408,9 +2419,8 @@ static void __exit apm_exit(void)
 			apm_error("disengage power management", error);
 	}
 	misc_deregister(&apm_device);
+	unregister_poweroff_handler(&apm_poweroff_nb);
 	remove_proc_entry("apm", NULL);
-	if (power_off)
-		pm_power_off = NULL;
 	if (kapmd_task) {
 		kthread_stop(kapmd_task);
 		kapmd_task = NULL;
Signature · 1 line
1.9.1
author maintainer
#200 lore raw

PATCH 28/44 x86: olpc: Register xo1 poweroff handler with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with high priority value of 192 to reflect that the driver explicitly wants to override default poweroff handlers.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc H. Peter Anvin <[email protected]>
---
 arch/x86/platform/olpc/olpc-xo1-pm.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
arch/x86/platform/olpc/olpc-xo1-pm.c +17 -3
index a9acde7..96fba36 100644
@@ -15,6 +15,7 @@
 #include <linux/cs5535.h>
 #include <linux/platform_device.h>
 #include <linux/export.h>
+#include <linux/notifier.h>
 #include <linux/pm.h>
 #include <linux/mfd/core.h>
 #include <linux/suspend.h>
@@ -92,7 +93,8 @@ asmlinkage __visible int xo1_do_sleep(u8 sleep_state)
 	return 0;
 }
 
-static void xo1_power_off(void)
+static int xo1_power_off(struct notifier_block *this, unsigned long unused1,
+			 void *unused2)
 {
 	printk(KERN_INFO "OLPC XO-1 power off sequence...\n");
 
@@ -108,8 +110,15 @@ static void xo1_power_off(void)
 
 	/* Write SLP_EN bit to start the machinery */
 	outl(0x00002000, acpi_base + CS5536_PM1_CNT);
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block xo1_poweroff_nb = {
+	.notifier_call = xo1_power_off,
+	.priority = 192,
+};
+
 static int xo1_power_state_valid(suspend_state_t pm_state)
 {
 	/* suspend-to-RAM only */
@@ -146,8 +155,12 @@ static int xo1_pm_probe(struct platform_device *pdev)
 
 	/* If we have both addresses, we can override the poweroff hook */
 	if (pms_base && acpi_base) {
+		err = register_poweroff_handler(&xo1_poweroff_nb);
+		if (err) {
+			dev_err(&pdev->dev, "Failed to register poweroff handler\n");
+			return err;
+		}
 		suspend_set_ops(&xo1_suspend_ops);
-		pm_power_off = xo1_power_off;
 		printk(KERN_INFO "OLPC XO-1 support registered\n");
 	}
 
@@ -158,12 +171,13 @@ static int xo1_pm_remove(struct platform_device *pdev)
 {
 	mfd_cell_disable(pdev);
 
+	unregister_poweroff_handler(&xo1_poweroff_nb);
+
 	if (strcmp(pdev->name, "cs5535-pms") == 0)
 		pms_base = 0;
 	else if (strcmp(pdev->name, "olpc-xo1-pm-acpi") == 0)
 		acpi_base = 0;
 
-	pm_power_off = NULL;
 	return 0;
 }
 
Signature · 1 line
1.9.1
author maintainer
#201 lore raw

PATCH 28/44 x86: olpc: Register xo1 poweroff handler with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with high priority value of 192 to reflect that the driver explicitly wants to override default poweroff handlers.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc H. Peter Anvin <[email protected]>
---
 arch/x86/platform/olpc/olpc-xo1-pm.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
arch/x86/platform/olpc/olpc-xo1-pm.c +17 -3
index a9acde7..96fba36 100644
@@ -15,6 +15,7 @@
 #include <linux/cs5535.h>
 #include <linux/platform_device.h>
 #include <linux/export.h>
+#include <linux/notifier.h>
 #include <linux/pm.h>
 #include <linux/mfd/core.h>
 #include <linux/suspend.h>
@@ -92,7 +93,8 @@ asmlinkage __visible int xo1_do_sleep(u8 sleep_state)
 	return 0;
 }
 
-static void xo1_power_off(void)
+static int xo1_power_off(struct notifier_block *this, unsigned long unused1,
+			 void *unused2)
 {
 	printk(KERN_INFO "OLPC XO-1 power off sequence...\n");
 
@@ -108,8 +110,15 @@ static void xo1_power_off(void)
 
 	/* Write SLP_EN bit to start the machinery */
 	outl(0x00002000, acpi_base + CS5536_PM1_CNT);
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block xo1_poweroff_nb = {
+	.notifier_call = xo1_power_off,
+	.priority = 192,
+};
+
 static int xo1_power_state_valid(suspend_state_t pm_state)
 {
 	/* suspend-to-RAM only */
@@ -146,8 +155,12 @@ static int xo1_pm_probe(struct platform_device *pdev)
 
 	/* If we have both addresses, we can override the poweroff hook */
 	if (pms_base && acpi_base) {
+		err = register_poweroff_handler(&xo1_poweroff_nb);
+		if (err) {
+			dev_err(&pdev->dev, "Failed to register poweroff handler\n");
+			return err;
+		}
 		suspend_set_ops(&xo1_suspend_ops);
-		pm_power_off = xo1_power_off;
 		printk(KERN_INFO "OLPC XO-1 support registered\n");
 	}
 
@@ -158,12 +171,13 @@ static int xo1_pm_remove(struct platform_device *pdev)
 {
 	mfd_cell_disable(pdev);
 
+	unregister_poweroff_handler(&xo1_poweroff_nb);
+
 	if (strcmp(pdev->name, "cs5535-pms") == 0)
 		pms_base = 0;
 	else if (strcmp(pdev->name, "olpc-xo1-pm-acpi") == 0)
 		acpi_base = 0;
 
-	pm_power_off = NULL;
 	return 0;
 }
 
Signature · 1 line
1.9.1
author maintainer
#202 lore raw

PATCH 29/44 staging: nvec: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with default priority value of 128 since we don't know any better.

Cc Julian Andres Klode <[email protected]>
Cc Marc Dietrich <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/staging/nvec/nvec.c | 24 +++++++++++++++---------
 drivers/staging/nvec/nvec.h |  2 ++
 2 files changed, 17 insertions(+), 9 deletions(-)
drivers/staging/nvec/nvec.c +15 -9
index a93208a..33d406c 100644
@@ -33,6 +33,7 @@
 #include <linux/mfd/core.h>
 #include <linux/mutex.h>
 #include <linux/notifier.h>
+#include <linux/pm.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/workqueue.h>
@@ -80,8 +81,6 @@ enum nvec_sleep_subcmds {
 #define LID_SWITCH BIT(1)
 #define PWR_BUTTON BIT(15)
 
-static struct nvec_chip *nvec_power_handle;
-
 static const struct mfd_cell nvec_devices[] = {
 	{
 		.name = "nvec-kbd",
@@ -759,12 +758,17 @@ static void nvec_disable_i2c_slave(struct nvec_chip *nvec)
 }
 #endif
 
-static void nvec_power_off(void)
+static int nvec_power_off(struct notifier_block *this, unsigned long unused1,
+			  void *unused2)
 {
+	struct nvec_chip *nvec = container_of(this, struct nvec_chip,
+					      poweroff_nb);
 	char ap_pwr_down[] = { NVEC_SLEEP, AP_PWR_DOWN };
 
-	nvec_toggle_global_events(nvec_power_handle, false);
-	nvec_write_async(nvec_power_handle, ap_pwr_down, 2);
+	nvec_toggle_global_events(nvec, false);
+	nvec_write_async(nvec, ap_pwr_down, 2);
+
+	return NOTIFY_DONE;
 }
 
 /*
@@ -878,8 +882,11 @@ static int tegra_nvec_probe(struct platform_device *pdev)
 	nvec->nvec_status_notifier.notifier_call = nvec_status_notifier;
 	nvec_register_notifier(nvec, &nvec->nvec_status_notifier, 0);
 
-	nvec_power_handle = nvec;
-	pm_power_off = nvec_power_off;
+	nvec->poweroff_nb.notifier_call = nvec_power_off;
+	nvec->poweroff_nb.priority = 128;
+	ret = register_poweroff_handler(&nvec->poweroff_nb);
+	if (ret)
+		dev_err(nvec->dev, "Failed to register poweroff handler\n");
 
 	/* Get Firmware Version */
 	msg = nvec_write_sync(nvec, get_firmware_version, 2);
@@ -914,13 +921,12 @@ static int tegra_nvec_remove(struct platform_device *pdev)
 {
 	struct nvec_chip *nvec = platform_get_drvdata(pdev);
 
+	unregister_poweroff_handler(&nvec->poweroff_nb);
 	nvec_toggle_global_events(nvec, false);
 	mfd_remove_devices(nvec->dev);
 	nvec_unregister_notifier(nvec, &nvec->nvec_status_notifier);
 	cancel_work_sync(&nvec->rx_work);
 	cancel_work_sync(&nvec->tx_work);
-	/* FIXME: needs check wether nvec is responsible for power off */
-	pm_power_off = NULL;
 
 	return 0;
 }
drivers/staging/nvec/nvec.h +2 -0
index e271375..e5ee2af 100644
@@ -163,6 +163,8 @@ struct nvec_chip {
 	struct nvec_msg *last_sync_msg;
 
 	int state;
+
+	struct notifier_block poweroff_nb;
 };
 
 extern int nvec_write_async(struct nvec_chip *nvec, const unsigned char *data,
Signature · 1 line
1.9.1
maintainer Acked-by on v1 29/44
#203 lore raw

Re: [PATCH 29/44] staging: nvec: Register with kernel poweroff handler

Quoted 4 lines · Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with default priority value of 128 since we don't know any better.

Quoted 8 lines
Cc Julian Andres Klode <[email protected]>
Cc Marc Dietrich <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/staging/nvec/nvec.c | 24 +++++++++++++++---------
 drivers/staging/nvec/nvec.h |  2 ++
 2 files changed, 17 insertions(+), 9 deletions(-)
maintainer Acked-by on v1 29/44
#204 lore raw

Re: [PATCH 29/44] staging: nvec: Register with kernel poweroff handler

In reply to Guenter Roeck
Quoted 4 lines · Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with default priority value of 128 since we don't know any better.

Quoted 8 lines
Cc Julian Andres Klode <[email protected]>
Cc Marc Dietrich <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/staging/nvec/nvec.c | 24 +++++++++++++++---------
 drivers/staging/nvec/nvec.h |  2 ++
 2 files changed, 17 insertions(+), 9 deletions(-)
maintainer
#205 lore raw

Re: [PATCH 29/44] staging: nvec: Register with kernel poweroff handler

In reply to Guenter Roeck

Am Montag 06 Oktober 2014, 22:28:31 schrieb Guenter Roeck:

Quoted 3 lines

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with default priority value of 128 since we don't know any better.

I just tested this change and it seems to break power off. What the driver does it to queue the power off request and execute it sometime later. The command is send via i2c to an embedded controller (mfd device) which is responsible for removing the power.

I haven't analyzed further, but I guess this could be related with the atomic discussion brought up in some other thread of this patch series.

Marc

author maintainer
#206 lore raw

PATCH 29/44 staging: nvec: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with default priority value of 128 since we don't know any better.

Cc Julian Andres Klode <[email protected]>
Cc Marc Dietrich <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/staging/nvec/nvec.c | 24 +++++++++++++++---------
 drivers/staging/nvec/nvec.h |  2 ++
 2 files changed, 17 insertions(+), 9 deletions(-)
drivers/staging/nvec/nvec.c +15 -9
index a93208a..33d406c 100644
@@ -33,6 +33,7 @@
 #include <linux/mfd/core.h>
 #include <linux/mutex.h>
 #include <linux/notifier.h>
+#include <linux/pm.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/workqueue.h>
@@ -80,8 +81,6 @@ enum nvec_sleep_subcmds {
 #define LID_SWITCH BIT(1)
 #define PWR_BUTTON BIT(15)
 
-static struct nvec_chip *nvec_power_handle;
-
 static const struct mfd_cell nvec_devices[] = {
 	{
 		.name = "nvec-kbd",
@@ -759,12 +758,17 @@ static void nvec_disable_i2c_slave(struct nvec_chip *nvec)
 }
 #endif
 
-static void nvec_power_off(void)
+static int nvec_power_off(struct notifier_block *this, unsigned long unused1,
+			  void *unused2)
 {
+	struct nvec_chip *nvec = container_of(this, struct nvec_chip,
+					      poweroff_nb);
 	char ap_pwr_down[] = { NVEC_SLEEP, AP_PWR_DOWN };
 
-	nvec_toggle_global_events(nvec_power_handle, false);
-	nvec_write_async(nvec_power_handle, ap_pwr_down, 2);
+	nvec_toggle_global_events(nvec, false);
+	nvec_write_async(nvec, ap_pwr_down, 2);
+
+	return NOTIFY_DONE;
 }
 
 /*
@@ -878,8 +882,11 @@ static int tegra_nvec_probe(struct platform_device *pdev)
 	nvec->nvec_status_notifier.notifier_call = nvec_status_notifier;
 	nvec_register_notifier(nvec, &nvec->nvec_status_notifier, 0);
 
-	nvec_power_handle = nvec;
-	pm_power_off = nvec_power_off;
+	nvec->poweroff_nb.notifier_call = nvec_power_off;
+	nvec->poweroff_nb.priority = 128;
+	ret = register_poweroff_handler(&nvec->poweroff_nb);
+	if (ret)
+		dev_err(nvec->dev, "Failed to register poweroff handler\n");
 
 	/* Get Firmware Version */
 	msg = nvec_write_sync(nvec, get_firmware_version, 2);
@@ -914,13 +921,12 @@ static int tegra_nvec_remove(struct platform_device *pdev)
 {
 	struct nvec_chip *nvec = platform_get_drvdata(pdev);
 
+	unregister_poweroff_handler(&nvec->poweroff_nb);
 	nvec_toggle_global_events(nvec, false);
 	mfd_remove_devices(nvec->dev);
 	nvec_unregister_notifier(nvec, &nvec->nvec_status_notifier);
 	cancel_work_sync(&nvec->rx_work);
 	cancel_work_sync(&nvec->tx_work);
-	/* FIXME: needs check wether nvec is responsible for power off */
-	pm_power_off = NULL;
 
 	return 0;
 }
drivers/staging/nvec/nvec.h +2 -0
index e271375..e5ee2af 100644
@@ -163,6 +163,8 @@ struct nvec_chip {
 	struct nvec_msg *last_sync_msg;
 
 	int state;
+
+	struct notifier_block poweroff_nb;
 };
 
 extern int nvec_write_async(struct nvec_chip *nvec, const unsigned char *data,
Signature · 1 line
1.9.1
author maintainer
#207 lore raw

PATCH 30/44 acpi: Register poweroff handler with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with high priority value of 192 to reflect that the driver explicitly overrides existing poweroff handlers.

Cc Rafael J. Wysocki <[email protected]>
Cc Len Brown <[email protected]>
---
 drivers/acpi/sleep.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/acpi/sleep.c +13 -2
index 54da4a3..25aad22 100644
@@ -15,6 +15,8 @@
 #include <linux/dmi.h>
 #include <linux/device.h>
 #include <linux/suspend.h>
+#include <linux/notifier.h>
+#include <linux/pm.h>
 #include <linux/reboot.h>
 #include <linux/acpi.h>
 #include <linux/module.h>
@@ -811,14 +813,22 @@ static void acpi_power_off_prepare(void)
 	acpi_disable_all_gpes();
 }
 
-static void acpi_power_off(void)
+static int acpi_power_off(struct notifier_block *this,
+			  unsigned long unused1, void *unused2)
 {
 	/* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
 	printk(KERN_DEBUG "%s called\n", __func__);
 	local_irq_disable();
 	acpi_enter_sleep_state(ACPI_STATE_S5);
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block acpi_poweroff_nb = {
+	.notifier_call = acpi_power_off,
+	.priority = 192,
+};
+
 int __init acpi_sleep_init(void)
 {
 	char supported[ACPI_S_STATE_COUNT * 3 + 1];
@@ -835,7 +845,8 @@ int __init acpi_sleep_init(void)
 	if (acpi_sleep_state_supported(ACPI_STATE_S5)) {
 		sleep_states[ACPI_STATE_S5] = 1;
 		pm_power_off_prepare = acpi_power_off_prepare;
-		pm_power_off = acpi_power_off;
+		if (register_poweroff_handler(&acpi_poweroff_nb))
+			pr_err("acpi: Failed to register poweroff handler\n");
 	}
 
 	supported[0] = 0;
Signature · 1 line
1.9.1
author maintainer
#208 lore raw

PATCH 30/44 acpi: Register poweroff handler with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with high priority value of 192 to reflect that the driver explicitly overrides existing poweroff handlers.

Cc Rafael J. Wysocki <[email protected]>
Cc Len Brown <[email protected]>
---
 drivers/acpi/sleep.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/acpi/sleep.c +13 -2
index 54da4a3..25aad22 100644
@@ -15,6 +15,8 @@
 #include <linux/dmi.h>
 #include <linux/device.h>
 #include <linux/suspend.h>
+#include <linux/notifier.h>
+#include <linux/pm.h>
 #include <linux/reboot.h>
 #include <linux/acpi.h>
 #include <linux/module.h>
@@ -811,14 +813,22 @@ static void acpi_power_off_prepare(void)
 	acpi_disable_all_gpes();
 }
 
-static void acpi_power_off(void)
+static int acpi_power_off(struct notifier_block *this,
+			  unsigned long unused1, void *unused2)
 {
 	/* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
 	printk(KERN_DEBUG "%s called\n", __func__);
 	local_irq_disable();
 	acpi_enter_sleep_state(ACPI_STATE_S5);
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block acpi_poweroff_nb = {
+	.notifier_call = acpi_power_off,
+	.priority = 192,
+};
+
 int __init acpi_sleep_init(void)
 {
 	char supported[ACPI_S_STATE_COUNT * 3 + 1];
@@ -835,7 +845,8 @@ int __init acpi_sleep_init(void)
 	if (acpi_sleep_state_supported(ACPI_STATE_S5)) {
 		sleep_states[ACPI_STATE_S5] = 1;
 		pm_power_off_prepare = acpi_power_off_prepare;
-		pm_power_off = acpi_power_off;
+		if (register_poweroff_handler(&acpi_poweroff_nb))
+			pr_err("acpi: Failed to register poweroff handler\n");
 	}
 
 	supported[0] = 0;
Signature · 1 line
1.9.1
author maintainer
#209 lore raw

PATCH 30/44 acpi: Register poweroff handler with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with high priority value of 192 to reflect that the driver explicitly overrides existing poweroff handlers.

Cc Rafael J. Wysocki <[email protected]>
Cc Len Brown <[email protected]>
---
 drivers/acpi/sleep.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/acpi/sleep.c +13 -2
index 54da4a3..25aad22 100644
@@ -15,6 +15,8 @@
 #include <linux/dmi.h>
 #include <linux/device.h>
 #include <linux/suspend.h>
+#include <linux/notifier.h>
+#include <linux/pm.h>
 #include <linux/reboot.h>
 #include <linux/acpi.h>
 #include <linux/module.h>
@@ -811,14 +813,22 @@ static void acpi_power_off_prepare(void)
 	acpi_disable_all_gpes();
 }
 
-static void acpi_power_off(void)
+static int acpi_power_off(struct notifier_block *this,
+			  unsigned long unused1, void *unused2)
 {
 	/* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
 	printk(KERN_DEBUG "%s called\n", __func__);
 	local_irq_disable();
 	acpi_enter_sleep_state(ACPI_STATE_S5);
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block acpi_poweroff_nb = {
+	.notifier_call = acpi_power_off,
+	.priority = 192,
+};
+
 int __init acpi_sleep_init(void)
 {
 	char supported[ACPI_S_STATE_COUNT * 3 + 1];
@@ -835,7 +845,8 @@ int __init acpi_sleep_init(void)
 	if (acpi_sleep_state_supported(ACPI_STATE_S5)) {
 		sleep_states[ACPI_STATE_S5] = 1;
 		pm_power_off_prepare = acpi_power_off_prepare;
-		pm_power_off = acpi_power_off;
+		if (register_poweroff_handler(&acpi_poweroff_nb))
+			pr_err("acpi: Failed to register poweroff handler\n");
 	}
 
 	supported[0] = 0;
Signature · 1 line
1.9.1
author maintainer
#210 lore raw

PATCH 31/44 arm: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Always use register_poweroff_handler_simple as there is no indication that more than one poweroff handler is registered.

If the poweroff handler only resets the system or puts the CPU in sleep mode, select a priority of 0 to indicate that the poweroff handler is one of last resort. If the poweroff handler powers off the system, select a priority of 128.

Cc Russell King <linux-lFZ/[email protected]>
Cc Andrew Victor <[email protected]>
Cc Nicolas Ferre <[email protected]>
Cc Jean-Christophe Plagniol-Villard <plagnioj-sclMFOaUSTBWk0Htik3J/[email protected]>
Cc Stephen Warren <[email protected]>
Cc Christian Daudt <[email protected]>
Cc Matt Porter <[email protected]>
Cc Anton Vorontsov <[email protected]>
Cc Rob Herring <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Imre Kaloz <[email protected]>
Cc Krzysztof Halasa <khc-9GfyWEdoJtJmR6Xm/[email protected]>
Cc Tony Lindgren <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Andrew Lunn <[email protected]>
Cc Sebastian Hesselbarth <[email protected]>
Cc Eric Miao <[email protected]>
Cc Haojian Zhuang <[email protected]>
Cc Robert Jarzmik <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Ben Dooks <[email protected]>
Cc Kukjin Kim <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Tony Prisk <[email protected]>
Cc Stefano Stabellini <[email protected]>
---
 arch/arm/kernel/psci.c                         | 2 +-
 arch/arm/mach-at91/board-gsia18s.c             | 2 +-
 arch/arm/mach-at91/setup.c                     | 4 ++--
 arch/arm/mach-bcm/board_bcm2835.c              | 2 +-
 arch/arm/mach-cns3xxx/cns3420vb.c              | 2 +-
 arch/arm/mach-cns3xxx/core.c                   | 2 +-
 arch/arm/mach-highbank/highbank.c              | 2 +-
 arch/arm/mach-imx/mach-mx31moboard.c           | 2 +-
 arch/arm/mach-iop32x/em7210.c                  | 2 +-
 arch/arm/mach-iop32x/glantank.c                | 2 +-
 arch/arm/mach-iop32x/iq31244.c                 | 2 +-
 arch/arm/mach-iop32x/n2100.c                   | 2 +-
 arch/arm/mach-ixp4xx/dsmg600-setup.c           | 2 +-
 arch/arm/mach-ixp4xx/nas100d-setup.c           | 2 +-
 arch/arm/mach-ixp4xx/nslu2-setup.c             | 2 +-
 arch/arm/mach-omap2/board-omap3touchbook.c     | 2 +-
 arch/arm/mach-orion5x/board-mss2.c             | 2 +-
 arch/arm/mach-orion5x/dns323-setup.c           | 6 +++---
 arch/arm/mach-orion5x/kurobox_pro-setup.c      | 2 +-
 arch/arm/mach-orion5x/ls-chl-setup.c           | 2 +-
 arch/arm/mach-orion5x/ls_hgl-setup.c           | 2 +-
 arch/arm/mach-orion5x/lsmini-setup.c           | 2 +-
 arch/arm/mach-orion5x/mv2120-setup.c           | 2 +-
 arch/arm/mach-orion5x/net2big-setup.c          | 2 +-
 arch/arm/mach-orion5x/terastation_pro2-setup.c | 2 +-
 arch/arm/mach-orion5x/ts209-setup.c            | 2 +-
 arch/arm/mach-orion5x/ts409-setup.c            | 2 +-
 arch/arm/mach-pxa/corgi.c                      | 2 +-
 arch/arm/mach-pxa/mioa701.c                    | 2 +-
 arch/arm/mach-pxa/poodle.c                     | 2 +-
 arch/arm/mach-pxa/spitz.c                      | 2 +-
 arch/arm/mach-pxa/tosa.c                       | 2 +-
 arch/arm/mach-pxa/viper.c                      | 2 +-
 arch/arm/mach-pxa/z2.c                         | 6 +++---
 arch/arm/mach-pxa/zeus.c                       | 6 +++---
 arch/arm/mach-s3c24xx/mach-gta02.c             | 2 +-
 arch/arm/mach-s3c24xx/mach-jive.c              | 2 +-
 arch/arm/mach-s3c24xx/mach-vr1000.c            | 2 +-
 arch/arm/mach-s3c64xx/mach-smartq.c            | 2 +-
 arch/arm/mach-sa1100/generic.c                 | 2 +-
 arch/arm/mach-sa1100/simpad.c                  | 2 +-
 arch/arm/mach-u300/regulator.c                 | 2 +-
 arch/arm/mach-vt8500/vt8500.c                  | 2 +-
 arch/arm/xen/enlighten.c                       | 2 +-
 44 files changed, 51 insertions(+), 51 deletions(-)
arch/arm/kernel/psci.c +1 -1
index f73891b..dd58d86 100644
@@ -264,7 +264,7 @@ static int psci_0_2_init(struct device_node *np)
 
 	arm_pm_restart = psci_sys_reset;
 
-	pm_power_off = psci_sys_poweroff;
+	register_poweroff_handler_simple(psci_sys_poweroff, 128);
 
 out_put_node:
 	of_node_put(np);
arch/arm/mach-at91/board-gsia18s.c +1 -1
index b729dd1..6722e66 100644
@@ -521,7 +521,7 @@ static void gsia18s_power_off(void)
 
 static int __init gsia18s_power_off_init(void)
 {
-	pm_power_off = gsia18s_power_off;
+	register_poweroff_handler_simple(gsia18s_power_off, 128);
 	return 0;
 }
 
arch/arm/mach-at91/setup.c +2 -2
index f7a07a5..9989e88 100644
@@ -329,7 +329,7 @@ void __init at91_ioremap_shdwc(u32 base_addr)
 	at91_shdwc_base = ioremap(base_addr, 16);
 	if (!at91_shdwc_base)
 		panic("Impossible to ioremap at91_shdwc_base\n");
-	pm_power_off = at91sam9_poweroff;
+	register_poweroff_handler_simple(at91sam9_poweroff, 128);
 }
 
 void __iomem *at91_rstc_base;
@@ -482,7 +482,7 @@ static void at91_dt_shdwc(void)
 	at91_shdwc_write(AT91_SHDW_MR, wakeup_mode | mode);
 
 end:
-	pm_power_off = at91sam9_poweroff;
+	register_poweroff_handler_simple(at91sam9_poweroff, 128);
 
 	of_node_put(np);
 }
arch/arm/mach-bcm/board_bcm2835.c +1 -1
index 70f2f39..7d5784f 100644
@@ -111,7 +111,7 @@ static void __init bcm2835_init(void)
 
 	bcm2835_setup_restart();
 	if (wdt_regs)
-		pm_power_off = bcm2835_power_off;
+		register_poweroff_handler_simple(bcm2835_power_off, 0);
 
 	bcm2835_init_clocks();
 
arch/arm/mach-cns3xxx/cns3420vb.c +1 -1
index d863d87..136b7c6 100644
@@ -224,7 +224,7 @@ static void __init cns3420_init(void)
 	cns3xxx_ahci_init();
 	cns3xxx_sdhci_init();
 
-	pm_power_off = cns3xxx_power_off;
+	register_poweroff_handler_simple(cns3xxx_power_off, 128);
 }
 
 static struct map_desc cns3420_io_desc[] __initdata = {
arch/arm/mach-cns3xxx/core.c +1 -1
index f85449a..79e6ead 100644
@@ -386,7 +386,7 @@ static void __init cns3xxx_init(void)
 		cns3xxx_pwr_soft_rst(CNS3XXX_PWR_SOFTWARE_RST(SDIO));
 	}
 
-	pm_power_off = cns3xxx_power_off;
+	register_poweroff_handler_simple(cns3xxx_power_off, 128);
 
 	of_platform_populate(NULL, of_default_bus_match_table,
                         cns3xxx_auxdata, NULL);
arch/arm/mach-highbank/highbank.c +1 -1
index 8c35ae4..25d0134 100644
@@ -155,7 +155,7 @@ static void __init highbank_init(void)
 	sregs_base = of_iomap(np, 0);
 	WARN_ON(!sregs_base);
 
-	pm_power_off = highbank_power_off;
+	register_poweroff_handler_simple(highbank_power_off, 0);
 	highbank_pm_init();
 
 	bus_register_notifier(&platform_bus_type, &highbank_platform_nb);
arch/arm/mach-imx/mach-mx31moboard.c +1 -1
index bb6f8a5..9b3616f 100644
@@ -559,7 +559,7 @@ static void __init mx31moboard_init(void)
 
 	imx_add_platform_device("imx_mc13783", 0, NULL, 0, NULL, 0);
 
-	pm_power_off = mx31moboard_poweroff;
+	register_poweroff_handler_simple(mx31moboard_poweroff, 128);
 
 	switch (mx31moboard_baseboard) {
 	case MX31NOBOARD:
arch/arm/mach-iop32x/em7210.c +1 -1
index 77e1ff0..beeeb0c2 100644
@@ -201,7 +201,7 @@ static int __init em7210_request_gpios(void)
 		return 0;
 	}
 
-	pm_power_off = em7210_power_off;
+	register_poweroff_handler_simple(em7210_power_off, 128);
 
 	return 0;
 }
arch/arm/mach-iop32x/glantank.c +1 -1
index 547b234..050a8e6 100644
@@ -199,7 +199,7 @@ static void __init glantank_init_machine(void)
 	i2c_register_board_info(0, glantank_i2c_devices,
 		ARRAY_SIZE(glantank_i2c_devices));
 
-	pm_power_off = glantank_power_off;
+	register_poweroff_handler_simple(glantank_power_off, 128);
 }
 
 MACHINE_START(GLANTANK, "GLAN Tank")
arch/arm/mach-iop32x/iq31244.c +1 -1
index 0e1392b..4e9b972 100644
@@ -293,7 +293,7 @@ static void __init iq31244_init_machine(void)
 	platform_device_register(&iop3xx_dma_1_channel);
 
 	if (is_ep80219())
-		pm_power_off = ep80219_power_off;
+		register_poweroff_handler_simple(ep80219_power_off, 128);
 
 	if (!is_80219())
 		platform_device_register(&iop3xx_aau_channel);
arch/arm/mach-iop32x/n2100.c +1 -1
index c1cd80e..171d496 100644
@@ -356,7 +356,7 @@ static void __init n2100_init_machine(void)
 	i2c_register_board_info(0, n2100_i2c_devices,
 		ARRAY_SIZE(n2100_i2c_devices));
 
-	pm_power_off = n2100_power_off;
+	register_poweroff_handler_simple(n2100_power_off, 128);
 }
 
 MACHINE_START(N2100, "Thecus N2100")
arch/arm/mach-ixp4xx/dsmg600-setup.c +1 -1
index 43ee06d..6fb5072 100644
@@ -281,7 +281,7 @@ static void __init dsmg600_init(void)
 
 	platform_add_devices(dsmg600_devices, ARRAY_SIZE(dsmg600_devices));
 
-	pm_power_off = dsmg600_power_off;
+	register_poweroff_handler_simple(dsmg600_power_off, 128);
 }
 
 MACHINE_START(DSMG600, "D-Link DSM-G600 RevA")
arch/arm/mach-ixp4xx/nas100d-setup.c +1 -1
index 4e0f762..bd9a8d6 100644
@@ -292,7 +292,7 @@ static void __init nas100d_init(void)
 
 	platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
 
-	pm_power_off = nas100d_power_off;
+	register_poweroff_handler_simple(nas100d_power_off, 128);
 
 	if (request_irq(gpio_to_irq(NAS100D_RB_GPIO), &nas100d_reset_handler,
 		IRQF_TRIGGER_LOW, "NAS100D reset button", NULL) < 0) {
arch/arm/mach-ixp4xx/nslu2-setup.c +1 -1
index 88c025f..c4c5475 100644
@@ -262,7 +262,7 @@ static void __init nslu2_init(void)
 
 	platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices));
 
-	pm_power_off = nslu2_power_off;
+	register_poweroff_handler_simple(nslu2_power_off, 128);
 
 	if (request_irq(gpio_to_irq(NSLU2_RB_GPIO), &nslu2_reset_handler,
 		IRQF_TRIGGER_LOW, "NSLU2 reset button", NULL) < 0) {
arch/arm/mach-omap2/board-omap3touchbook.c +1 -1
index 70b904c..0c0a0e2 100644
@@ -344,7 +344,7 @@ static void __init omap3_touchbook_init(void)
 {
 	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
 
-	pm_power_off = omap3_touchbook_poweroff;
+	register_poweroff_handler_simple(omap3_touchbook_poweroff, 128);
 
 	if (system_rev >= 0x20 && system_rev <= 0x34301000) {
 		omap_mux_init_gpio(23, OMAP_PIN_INPUT);
arch/arm/mach-orion5x/board-mss2.c +1 -1
index 66f9c3b..3840d66 100644
@@ -86,5 +86,5 @@ static void mss2_power_off(void)
 void __init mss2_init(void)
 {
 	/* register mss2 specific power-off method */
-	pm_power_off = mss2_power_off;
+	register_poweroff_handler_simple(mss2_power_off, 0);
 }
arch/arm/mach-orion5x/dns323-setup.c +3 -3
index 56edeab..353ca3d 100644
@@ -669,7 +669,7 @@ static void __init dns323_init(void)
 		if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 ||
 		    gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0)
 			pr_err("DNS-323: failed to setup power-off GPIO\n");
-		pm_power_off = dns323a_power_off;
+		register_poweroff_handler_simple(dns323a_power_off, 128);
 		break;
 	case DNS323_REV_B1:
 		/* 5182 built-in SATA init */
@@ -686,7 +686,7 @@ static void __init dns323_init(void)
 		if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 ||
 		    gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0)
 			pr_err("DNS-323: failed to setup power-off GPIO\n");
-		pm_power_off = dns323b_power_off;
+		register_poweroff_handler_simple(dns323b_power_off, 128);
 		break;
 	case DNS323_REV_C1:
 		/* 5182 built-in SATA init */
@@ -696,7 +696,7 @@ static void __init dns323_init(void)
 		if (gpio_request(DNS323C_GPIO_POWER_OFF, "POWEROFF") != 0 ||
 		    gpio_direction_output(DNS323C_GPIO_POWER_OFF, 0) != 0)
 			pr_err("DNS-323: failed to setup power-off GPIO\n");
-		pm_power_off = dns323c_power_off;
+		register_poweroff_handler_simple(dns323c_power_off, 128);
 
 		/* Now, -this- should theorically be done by the sata_mv driver
 		 * once I figure out what's going on there. Maybe the behaviour
arch/arm/mach-orion5x/kurobox_pro-setup.c +1 -1
index fe6a48a..c4101f1 100644
@@ -376,7 +376,7 @@ static void __init kurobox_pro_init(void)
 	i2c_register_board_info(0, &kurobox_pro_i2c_rtc, 1);
 
 	/* register Kurobox Pro specific power-off method */
-	pm_power_off = kurobox_pro_power_off;
+	register_poweroff_handler_simple(kurobox_pro_power_off, 128);
 }
 
 #ifdef CONFIG_MACH_KUROBOX_PRO
arch/arm/mach-orion5x/ls-chl-setup.c +1 -1
index 028ea03..005bb04 100644
@@ -312,7 +312,7 @@ static void __init lschl_init(void)
 	gpio_set_value(LSCHL_GPIO_USB_POWER, 1);
 
 	/* register power-off method */
-	pm_power_off = lschl_power_off;
+	register_poweroff_handler_simple(lschl_power_off, 0);
 
 	pr_info("%s: finished\n", __func__);
 }
arch/arm/mach-orion5x/ls_hgl-setup.c +1 -1
index 32b7129..37c29a0 100644
@@ -259,7 +259,7 @@ static void __init ls_hgl_init(void)
 	gpio_set_value(LS_HGL_GPIO_USB_POWER, 1);
 
 	/* register power-off method */
-	pm_power_off = ls_hgl_power_off;
+	register_poweroff_handler_simple(ls_hgl_power_off, 0);
 
 	pr_info("%s: finished\n", __func__);
 }
arch/arm/mach-orion5x/lsmini-setup.c +1 -1
index a6493e7..ffec72f 100644
@@ -260,7 +260,7 @@ static void __init lsmini_init(void)
 	gpio_set_value(LSMINI_GPIO_USB_POWER, 1);
 
 	/* register power-off method */
-	pm_power_off = lsmini_power_off;
+	register_poweroff_handler_simple(lsmini_power_off, 0);
 
 	pr_info("%s: finished\n", __func__);
 }
arch/arm/mach-orion5x/mv2120-setup.c +1 -1
index e032f01..dadc2b9 100644
@@ -225,7 +225,7 @@ static void __init mv2120_init(void)
 	if (gpio_request(MV2120_GPIO_POWER_OFF, "POWEROFF") != 0 ||
 	    gpio_direction_output(MV2120_GPIO_POWER_OFF, 1) != 0)
 		pr_err("mv2120: failed to setup power-off GPIO\n");
-	pm_power_off = mv2120_power_off;
+	register_poweroff_handler_simple(mv2120_power_off, 128);
 }
 
 /* Warning: HP uses a wrong mach-type (=526) in their bootloader */
arch/arm/mach-orion5x/net2big-setup.c +1 -1
index ba73dc7..3a73dce 100644
@@ -413,7 +413,7 @@ static void __init net2big_init(void)
 
 	if (gpio_request(NET2BIG_GPIO_POWER_OFF, "power-off") == 0 &&
 	    gpio_direction_output(NET2BIG_GPIO_POWER_OFF, 0) == 0)
-		pm_power_off = net2big_power_off;
+		register_poweroff_handler_simple(net2big_power_off, 128);
 	else
 		pr_err("net2big: failed to configure power-off GPIO\n");
 
arch/arm/mach-orion5x/terastation_pro2-setup.c +1 -1
index 6208d12..2a234cb 100644
@@ -353,7 +353,7 @@ static void __init tsp2_init(void)
 	i2c_register_board_info(0, &tsp2_i2c_rtc, 1);
 
 	/* register Terastation Pro II specific power-off method */
-	pm_power_off = tsp2_power_off;
+	register_poweroff_handler_simple(tsp2_power_off, 128);
 }
 
 MACHINE_START(TERASTATION_PRO2, "Buffalo Terastation Pro II/Live")
arch/arm/mach-orion5x/ts209-setup.c +1 -1
index 9136797..50bdfbc 100644
@@ -318,7 +318,7 @@ static void __init qnap_ts209_init(void)
 	i2c_register_board_info(0, &qnap_ts209_i2c_rtc, 1);
 
 	/* register tsx09 specific power-off method */
-	pm_power_off = qnap_tsx09_power_off;
+	register_poweroff_handler_simple(qnap_tsx09_power_off, 128);
 }
 
 MACHINE_START(TS209, "QNAP TS-109/TS-209")
arch/arm/mach-orion5x/ts409-setup.c +1 -1
index 5c079d31..06a7cc0 100644
@@ -307,7 +307,7 @@ static void __init qnap_ts409_init(void)
 	platform_device_register(&ts409_leds);
 
 	/* register tsx09 specific power-off method */
-	pm_power_off = qnap_tsx09_power_off;
+	register_poweroff_handler_simple(qnap_tsx09_power_off, 128);
 }
 
 MACHINE_START(TS409, "QNAP TS-409")
arch/arm/mach-pxa/corgi.c +1 -1
index 06022b2..a93bac0 100644
@@ -718,7 +718,7 @@ static void corgi_restart(enum reboot_mode mode, const char *cmd)
 
 static void __init corgi_init(void)
 {
-	pm_power_off = corgi_poweroff;
+	register_poweroff_handler_simple(corgi_poweroff, 0);
 
 	/* Stop 3.6MHz and drive HIGH to PCMCIA and CS */
 	PCFR |= PCFR_OPDE;
arch/arm/mach-pxa/mioa701.c +1 -1
index 29997bd..c4345a4 100644
@@ -750,7 +750,7 @@ static void __init mioa701_machine_init(void)
 	pxa_set_keypad_info(&mioa701_keypad_info);
 	pxa_set_udc_info(&mioa701_udc_info);
 	pxa_set_ac97_info(&mioa701_ac97_info);
-	pm_power_off = mioa701_poweroff;
+	register_poweroff_handler_simple(mioa701_poweroff, 0);
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 	gsm_init();
 
arch/arm/mach-pxa/poodle.c +1 -1
index 1319916..c9536ed 100644
@@ -432,7 +432,7 @@ static void __init poodle_init(void)
 {
 	int ret = 0;
 
-	pm_power_off = poodle_poweroff;
+	register_poweroff_handler_simple(poodle_poweroff, 0);
 
 	PCFR |= PCFR_OPDE;
 
arch/arm/mach-pxa/spitz.c +1 -1
index 840c3a4..09f0de8 100644
@@ -944,7 +944,7 @@ static void spitz_restart(enum reboot_mode mode, const char *cmd)
 static void __init spitz_init(void)
 {
 	init_gpio_reset(SPITZ_GPIO_ON_RESET, 1, 0);
-	pm_power_off = spitz_poweroff;
+	register_poweroff_handler_simple(spitz_poweroff, 0);
 
 	PMCR = 0x00;
 
arch/arm/mach-pxa/tosa.c +1 -1
index c158a6e..3a4af1d 100644
@@ -940,7 +940,7 @@ static void __init tosa_init(void)
 
 	init_gpio_reset(TOSA_GPIO_ON_RESET, 0, 0);
 
-	pm_power_off = tosa_poweroff;
+	register_poweroff_handler_simple(tosa_poweroff, 0);
 
 	PCFR |= PCFR_OPDE;
 
arch/arm/mach-pxa/viper.c +1 -1
index de3b080..679c8ea 100644
@@ -919,7 +919,7 @@ static void __init viper_init(void)
 {
 	u8 version;
 
-	pm_power_off = viper_power_off;
+	register_poweroff_handler_simple(viper_power_off, 128);
 
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(viper_pin_config));
 
arch/arm/mach-pxa/z2.c +3 -3
index e1a121b..e0195ac 100644
@@ -693,8 +693,6 @@ static void z2_power_off(void)
 	pxa27x_set_pwrmode(PWRMODE_DEEPSLEEP);
 	pxa27x_cpu_pm_enter(PM_SUSPEND_MEM);
 }
-#else
-#define z2_power_off   NULL
 #endif
 
 /******************************************************************************
@@ -719,7 +717,9 @@ static void __init z2_init(void)
 	z2_keys_init();
 	z2_pmic_init();
 
-	pm_power_off = z2_power_off;
+#ifdef CONFIG_PM
+	register_poweroff_handler_simple(z2_power_off, 0);
+#endif
 }
 
 MACHINE_START(ZIPIT2, "Zipit Z2")
arch/arm/mach-pxa/zeus.c +3 -3
index 205f9bf..6118fd5 100644
@@ -690,8 +690,6 @@ static void zeus_power_off(void)
 	local_irq_disable();
 	cpu_suspend(PWRMODE_DEEPSLEEP, pxa27x_finish_suspend);
 }
-#else
-#define zeus_power_off   NULL
 #endif
 
 #ifdef CONFIG_APM_EMULATION
@@ -847,7 +845,9 @@ static void __init zeus_init(void)
 	__raw_writel(msc0, MSC0);
 	__raw_writel(msc1, MSC1);
 
-	pm_power_off = zeus_power_off;
+#ifdef CONFIG_PM
+	register_poweroff_handler_simple(zeus_power_off, 0);
+#endif
 	zeus_setup_apm();
 
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(zeus_pin_config));
arch/arm/mach-s3c24xx/mach-gta02.c +1 -1
index fc3a08d..ca78150 100644
@@ -579,7 +579,7 @@ static void __init gta02_machine_init(void)
 	i2c_register_board_info(0, gta02_i2c_devs, ARRAY_SIZE(gta02_i2c_devs));
 
 	platform_add_devices(gta02_devices, ARRAY_SIZE(gta02_devices));
-	pm_power_off = gta02_poweroff;
+	register_poweroff_handler_simple(gta02_poweroff, 128);
 
 	regulator_has_full_constraints();
 }
arch/arm/mach-s3c24xx/mach-jive.c +1 -1
index 7804d3c..5a828a3 100644
@@ -657,7 +657,7 @@ static void __init jive_machine_init(void)
 	s3c_i2c0_set_platdata(&jive_i2c_cfg);
 	i2c_register_board_info(0, jive_i2c_devs, ARRAY_SIZE(jive_i2c_devs));
 
-	pm_power_off = jive_power_off;
+	register_poweroff_handler_simple(jive_power_off, 128);
 
 	platform_add_devices(jive_devices, ARRAY_SIZE(jive_devices));
 }
arch/arm/mach-s3c24xx/mach-vr1000.c +1 -1
index f88c584..40d7655 100644
@@ -306,7 +306,7 @@ static void vr1000_power_off(void)
 
 static void __init vr1000_map_io(void)
 {
-	pm_power_off = vr1000_power_off;
+	register_poweroff_handler_simple(vr1000_power_off, 128);
 
 	s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc));
 	s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs));
arch/arm/mach-s3c64xx/mach-smartq.c +1 -1
index b3d1353..61f0893 100644
@@ -291,7 +291,7 @@ static int __init smartq_power_off_init(void)
 	/* leave power on */
 	gpio_direction_output(S3C64XX_GPK(15), 0);
 
-	pm_power_off = smartq_power_off;
+	register_poweroff_handler_simple(smartq_power_off, 128);
 
 	return ret;
 }
arch/arm/mach-sa1100/generic.c +1 -1
index d4ea142..6b839cf 100644
@@ -311,7 +311,7 @@ static struct platform_device *sa11x0_devices[] __initdata = {
 
 static int __init sa1100_init(void)
 {
-	pm_power_off = sa1100_power_off;
+	register_poweroff_handler_simple(sa1100_power_off, 0);
 	return platform_add_devices(sa11x0_devices, ARRAY_SIZE(sa11x0_devices));
 }
 
arch/arm/mach-sa1100/simpad.c +1 -1
index 41e476e..a65ca58 100644
@@ -373,7 +373,7 @@ static int __init simpad_init(void)
 	if (ret)
 		printk(KERN_WARNING "simpad: Unable to register cs3 GPIO device");
 
-	pm_power_off = simpad_power_off;
+	register_poweroff_handler_simple(simpad_power_off, 0);
 
 	sa11x0_ppc_configure_mcp();
 	sa11x0_register_mtd(&simpad_flash_data, simpad_flash_resources,
arch/arm/mach-u300/regulator.c +1 -1
index 0493a84..c98eb6e 100644
@@ -98,7 +98,7 @@ static int __init __u300_init_boardpower(struct platform_device *pdev)
 			   U300_SYSCON_PMCR_DCON_ENABLE, 0);
 
 	/* Register globally exported PM poweroff hook */
-	pm_power_off = u300_pm_poweroff;
+	register_poweroff_handler_simple(u300_pm_poweroff, 128);
 
 	return 0;
 }
arch/arm/mach-vt8500/vt8500.c +1 -1
index 2da7be3..515946b 100644
@@ -155,7 +155,7 @@ static void __init vt8500_init(void)
 			pr_err("%s:ioremap(power_off) failed\n", __func__);
 	}
 	if (pmc_base)
-		pm_power_off = &vt8500_power_off;
+		register_poweroff_handler_simple(vt8500_power_off, 0);
 	else
 		pr_err("%s: PMC Hibernation register could not be remapped, not enabling power off!\n", __func__);
 
arch/arm/xen/enlighten.c +1 -1
index 0e15f01..0da639b 100644
@@ -336,7 +336,7 @@ static int __init xen_pm_init(void)
 	if (!xen_domain())
 		return -ENODEV;
 
-	pm_power_off = xen_power_off;
+	register_poweroff_handler_simple(xen_power_off, 128);
 	arm_pm_restart = xen_restart;
 
 	return 0;
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#211 lore raw

Re: [PATCH 31/44] arm: Register with kernel poweroff handler

On 07/10/2014 07:28, Guenter Roeck :

Quoted 36 lines

Register with kernel poweroff handler instead of setting pm_power_off directly. Always use register_poweroff_handler_simple as there is no indication that more than one poweroff handler is registered.

If the poweroff handler only resets the system or puts the CPU in sleep mode, select a priority of 0 to indicate that the poweroff handler is one of last resort. If the poweroff handler powers off the system, select a priority of 128.

Cc Russell King <[email protected]>
Cc Andrew Victor <[email protected]>
Cc Nicolas Ferre <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Christian Daudt <[email protected]>
Cc Matt Porter <[email protected]>
Cc Anton Vorontsov <[email protected]>
Cc Rob Herring <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Imre Kaloz <[email protected]>
Cc Krzysztof Halasa <[email protected]>
Cc Tony Lindgren <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Andrew Lunn <[email protected]>
Cc Sebastian Hesselbarth <[email protected]>
Cc Eric Miao <[email protected]>
Cc Haojian Zhuang <[email protected]>
Cc Robert Jarzmik <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Ben Dooks <[email protected]>
Cc Kukjin Kim <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Tony Prisk <[email protected]>
Cc Stefano Stabellini <[email protected]>
Quoted 6 lines
---
 arch/arm/kernel/psci.c                         | 2 +-
 arch/arm/mach-at91/board-gsia18s.c             | 2 +-
 arch/arm/mach-at91/setup.c                     | 4 ++--

For the 2 files above: NAK just because:
for the first one -> this file will be removed during 3.19 dev cycle. for the second one -> the poweroff handlers are removed during the 3.18 cycle and converted in the appropriate poweroff drivers (in drivers/power/reset/at91-poweroff.c).

So, can you remove these changes from your patch?

Thanks for your work, bye.

Quoted 663 lines
 arch/arm/mach-bcm/board_bcm2835.c              | 2 +-
 arch/arm/mach-cns3xxx/cns3420vb.c              | 2 +-
 arch/arm/mach-cns3xxx/core.c                   | 2 +-
 arch/arm/mach-highbank/highbank.c              | 2 +-
 arch/arm/mach-imx/mach-mx31moboard.c           | 2 +-
 arch/arm/mach-iop32x/em7210.c                  | 2 +-
 arch/arm/mach-iop32x/glantank.c                | 2 +-
 arch/arm/mach-iop32x/iq31244.c                 | 2 +-
 arch/arm/mach-iop32x/n2100.c                   | 2 +-
 arch/arm/mach-ixp4xx/dsmg600-setup.c           | 2 +-
 arch/arm/mach-ixp4xx/nas100d-setup.c           | 2 +-
 arch/arm/mach-ixp4xx/nslu2-setup.c             | 2 +-
 arch/arm/mach-omap2/board-omap3touchbook.c     | 2 +-
 arch/arm/mach-orion5x/board-mss2.c             | 2 +-
 arch/arm/mach-orion5x/dns323-setup.c           | 6 +++---
 arch/arm/mach-orion5x/kurobox_pro-setup.c      | 2 +-
 arch/arm/mach-orion5x/ls-chl-setup.c           | 2 +-
 arch/arm/mach-orion5x/ls_hgl-setup.c           | 2 +-
 arch/arm/mach-orion5x/lsmini-setup.c           | 2 +-
 arch/arm/mach-orion5x/mv2120-setup.c           | 2 +-
 arch/arm/mach-orion5x/net2big-setup.c          | 2 +-
 arch/arm/mach-orion5x/terastation_pro2-setup.c | 2 +-
 arch/arm/mach-orion5x/ts209-setup.c            | 2 +-
 arch/arm/mach-orion5x/ts409-setup.c            | 2 +-
 arch/arm/mach-pxa/corgi.c                      | 2 +-
 arch/arm/mach-pxa/mioa701.c                    | 2 +-
 arch/arm/mach-pxa/poodle.c                     | 2 +-
 arch/arm/mach-pxa/spitz.c                      | 2 +-
 arch/arm/mach-pxa/tosa.c                       | 2 +-
 arch/arm/mach-pxa/viper.c                      | 2 +-
 arch/arm/mach-pxa/z2.c                         | 6 +++---
 arch/arm/mach-pxa/zeus.c                       | 6 +++---
 arch/arm/mach-s3c24xx/mach-gta02.c             | 2 +-
 arch/arm/mach-s3c24xx/mach-jive.c              | 2 +-
 arch/arm/mach-s3c24xx/mach-vr1000.c            | 2 +-
 arch/arm/mach-s3c64xx/mach-smartq.c            | 2 +-
 arch/arm/mach-sa1100/generic.c                 | 2 +-
 arch/arm/mach-sa1100/simpad.c                  | 2 +-
 arch/arm/mach-u300/regulator.c                 | 2 +-
 arch/arm/mach-vt8500/vt8500.c                  | 2 +-
 arch/arm/xen/enlighten.c                       | 2 +-
 44 files changed, 51 insertions(+), 51 deletions(-)
arch/arm/kernel/psci.c +1 -1
index f73891b..dd58d86 100644
@@ -264,7 +264,7 @@ static int psci_0_2_init(struct device_node *np)
 
 	arm_pm_restart = psci_sys_reset;
 
-	pm_power_off = psci_sys_poweroff;
+	register_poweroff_handler_simple(psci_sys_poweroff, 128);
 
 out_put_node:
 	of_node_put(np);
arch/arm/mach-at91/board-gsia18s.c +1 -1
index b729dd1..6722e66 100644
@@ -521,7 +521,7 @@ static void gsia18s_power_off(void)
 
 static int __init gsia18s_power_off_init(void)
 {
-	pm_power_off = gsia18s_power_off;
+	register_poweroff_handler_simple(gsia18s_power_off, 128);
 	return 0;
 }
 
arch/arm/mach-at91/setup.c +2 -2
index f7a07a5..9989e88 100644
@@ -329,7 +329,7 @@ void __init at91_ioremap_shdwc(u32 base_addr)
 	at91_shdwc_base = ioremap(base_addr, 16);
 	if (!at91_shdwc_base)
 		panic("Impossible to ioremap at91_shdwc_base\n");
-	pm_power_off = at91sam9_poweroff;
+	register_poweroff_handler_simple(at91sam9_poweroff, 128);
 }
 
 void __iomem *at91_rstc_base;
@@ -482,7 +482,7 @@ static void at91_dt_shdwc(void)
 	at91_shdwc_write(AT91_SHDW_MR, wakeup_mode | mode);
 
 end:
-	pm_power_off = at91sam9_poweroff;
+	register_poweroff_handler_simple(at91sam9_poweroff, 128);
 
 	of_node_put(np);
 }
arch/arm/mach-bcm/board_bcm2835.c +1 -1
index 70f2f39..7d5784f 100644
@@ -111,7 +111,7 @@ static void __init bcm2835_init(void)
 
 	bcm2835_setup_restart();
 	if (wdt_regs)
-		pm_power_off = bcm2835_power_off;
+		register_poweroff_handler_simple(bcm2835_power_off, 0);
 
 	bcm2835_init_clocks();
 
arch/arm/mach-cns3xxx/cns3420vb.c +1 -1
index d863d87..136b7c6 100644
@@ -224,7 +224,7 @@ static void __init cns3420_init(void)
 	cns3xxx_ahci_init();
 	cns3xxx_sdhci_init();
 
-	pm_power_off = cns3xxx_power_off;
+	register_poweroff_handler_simple(cns3xxx_power_off, 128);
 }
 
 static struct map_desc cns3420_io_desc[] __initdata = {
arch/arm/mach-cns3xxx/core.c +1 -1
index f85449a..79e6ead 100644
@@ -386,7 +386,7 @@ static void __init cns3xxx_init(void)
 		cns3xxx_pwr_soft_rst(CNS3XXX_PWR_SOFTWARE_RST(SDIO));
 	}
 
-	pm_power_off = cns3xxx_power_off;
+	register_poweroff_handler_simple(cns3xxx_power_off, 128);
 
 	of_platform_populate(NULL, of_default_bus_match_table,
                         cns3xxx_auxdata, NULL);
arch/arm/mach-highbank/highbank.c +1 -1
index 8c35ae4..25d0134 100644
@@ -155,7 +155,7 @@ static void __init highbank_init(void)
 	sregs_base = of_iomap(np, 0);
 	WARN_ON(!sregs_base);
 
-	pm_power_off = highbank_power_off;
+	register_poweroff_handler_simple(highbank_power_off, 0);
 	highbank_pm_init();
 
 	bus_register_notifier(&platform_bus_type, &highbank_platform_nb);
arch/arm/mach-imx/mach-mx31moboard.c +1 -1
index bb6f8a5..9b3616f 100644
@@ -559,7 +559,7 @@ static void __init mx31moboard_init(void)
 
 	imx_add_platform_device("imx_mc13783", 0, NULL, 0, NULL, 0);
 
-	pm_power_off = mx31moboard_poweroff;
+	register_poweroff_handler_simple(mx31moboard_poweroff, 128);
 
 	switch (mx31moboard_baseboard) {
 	case MX31NOBOARD:
arch/arm/mach-iop32x/em7210.c +1 -1
index 77e1ff0..beeeb0c2 100644
@@ -201,7 +201,7 @@ static int __init em7210_request_gpios(void)
 		return 0;
 	}
 
-	pm_power_off = em7210_power_off;
+	register_poweroff_handler_simple(em7210_power_off, 128);
 
 	return 0;
 }
arch/arm/mach-iop32x/glantank.c +1 -1
index 547b234..050a8e6 100644
@@ -199,7 +199,7 @@ static void __init glantank_init_machine(void)
 	i2c_register_board_info(0, glantank_i2c_devices,
 		ARRAY_SIZE(glantank_i2c_devices));
 
-	pm_power_off = glantank_power_off;
+	register_poweroff_handler_simple(glantank_power_off, 128);
 }
 
 MACHINE_START(GLANTANK, "GLAN Tank")
arch/arm/mach-iop32x/iq31244.c +1 -1
index 0e1392b..4e9b972 100644
@@ -293,7 +293,7 @@ static void __init iq31244_init_machine(void)
 	platform_device_register(&iop3xx_dma_1_channel);
 
 	if (is_ep80219())
-		pm_power_off = ep80219_power_off;
+		register_poweroff_handler_simple(ep80219_power_off, 128);
 
 	if (!is_80219())
 		platform_device_register(&iop3xx_aau_channel);
arch/arm/mach-iop32x/n2100.c +1 -1
index c1cd80e..171d496 100644
@@ -356,7 +356,7 @@ static void __init n2100_init_machine(void)
 	i2c_register_board_info(0, n2100_i2c_devices,
 		ARRAY_SIZE(n2100_i2c_devices));
 
-	pm_power_off = n2100_power_off;
+	register_poweroff_handler_simple(n2100_power_off, 128);
 }
 
 MACHINE_START(N2100, "Thecus N2100")
arch/arm/mach-ixp4xx/dsmg600-setup.c +1 -1
index 43ee06d..6fb5072 100644
@@ -281,7 +281,7 @@ static void __init dsmg600_init(void)
 
 	platform_add_devices(dsmg600_devices, ARRAY_SIZE(dsmg600_devices));
 
-	pm_power_off = dsmg600_power_off;
+	register_poweroff_handler_simple(dsmg600_power_off, 128);
 }
 
 MACHINE_START(DSMG600, "D-Link DSM-G600 RevA")
arch/arm/mach-ixp4xx/nas100d-setup.c +1 -1
index 4e0f762..bd9a8d6 100644
@@ -292,7 +292,7 @@ static void __init nas100d_init(void)
 
 	platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
 
-	pm_power_off = nas100d_power_off;
+	register_poweroff_handler_simple(nas100d_power_off, 128);
 
 	if (request_irq(gpio_to_irq(NAS100D_RB_GPIO), &nas100d_reset_handler,
 		IRQF_TRIGGER_LOW, "NAS100D reset button", NULL) < 0) {
arch/arm/mach-ixp4xx/nslu2-setup.c +1 -1
index 88c025f..c4c5475 100644
@@ -262,7 +262,7 @@ static void __init nslu2_init(void)
 
 	platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices));
 
-	pm_power_off = nslu2_power_off;
+	register_poweroff_handler_simple(nslu2_power_off, 128);
 
 	if (request_irq(gpio_to_irq(NSLU2_RB_GPIO), &nslu2_reset_handler,
 		IRQF_TRIGGER_LOW, "NSLU2 reset button", NULL) < 0) {
arch/arm/mach-omap2/board-omap3touchbook.c +1 -1
index 70b904c..0c0a0e2 100644
@@ -344,7 +344,7 @@ static void __init omap3_touchbook_init(void)
 {
 	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
 
-	pm_power_off = omap3_touchbook_poweroff;
+	register_poweroff_handler_simple(omap3_touchbook_poweroff, 128);
 
 	if (system_rev >= 0x20 && system_rev <= 0x34301000) {
 		omap_mux_init_gpio(23, OMAP_PIN_INPUT);
arch/arm/mach-orion5x/board-mss2.c +1 -1
index 66f9c3b..3840d66 100644
@@ -86,5 +86,5 @@ static void mss2_power_off(void)
 void __init mss2_init(void)
 {
 	/* register mss2 specific power-off method */
-	pm_power_off = mss2_power_off;
+	register_poweroff_handler_simple(mss2_power_off, 0);
 }
arch/arm/mach-orion5x/dns323-setup.c +3 -3
index 56edeab..353ca3d 100644
@@ -669,7 +669,7 @@ static void __init dns323_init(void)
 		if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 ||
 		    gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0)
 			pr_err("DNS-323: failed to setup power-off GPIO\n");
-		pm_power_off = dns323a_power_off;
+		register_poweroff_handler_simple(dns323a_power_off, 128);
 		break;
 	case DNS323_REV_B1:
 		/* 5182 built-in SATA init */
@@ -686,7 +686,7 @@ static void __init dns323_init(void)
 		if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 ||
 		    gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0)
 			pr_err("DNS-323: failed to setup power-off GPIO\n");
-		pm_power_off = dns323b_power_off;
+		register_poweroff_handler_simple(dns323b_power_off, 128);
 		break;
 	case DNS323_REV_C1:
 		/* 5182 built-in SATA init */
@@ -696,7 +696,7 @@ static void __init dns323_init(void)
 		if (gpio_request(DNS323C_GPIO_POWER_OFF, "POWEROFF") != 0 ||
 		    gpio_direction_output(DNS323C_GPIO_POWER_OFF, 0) != 0)
 			pr_err("DNS-323: failed to setup power-off GPIO\n");
-		pm_power_off = dns323c_power_off;
+		register_poweroff_handler_simple(dns323c_power_off, 128);
 
 		/* Now, -this- should theorically be done by the sata_mv driver
 		 * once I figure out what's going on there. Maybe the behaviour
arch/arm/mach-orion5x/kurobox_pro-setup.c +1 -1
index fe6a48a..c4101f1 100644
@@ -376,7 +376,7 @@ static void __init kurobox_pro_init(void)
 	i2c_register_board_info(0, &kurobox_pro_i2c_rtc, 1);
 
 	/* register Kurobox Pro specific power-off method */
-	pm_power_off = kurobox_pro_power_off;
+	register_poweroff_handler_simple(kurobox_pro_power_off, 128);
 }
 
 #ifdef CONFIG_MACH_KUROBOX_PRO
arch/arm/mach-orion5x/ls-chl-setup.c +1 -1
index 028ea03..005bb04 100644
@@ -312,7 +312,7 @@ static void __init lschl_init(void)
 	gpio_set_value(LSCHL_GPIO_USB_POWER, 1);
 
 	/* register power-off method */
-	pm_power_off = lschl_power_off;
+	register_poweroff_handler_simple(lschl_power_off, 0);
 
 	pr_info("%s: finished\n", __func__);
 }
arch/arm/mach-orion5x/ls_hgl-setup.c +1 -1
index 32b7129..37c29a0 100644
@@ -259,7 +259,7 @@ static void __init ls_hgl_init(void)
 	gpio_set_value(LS_HGL_GPIO_USB_POWER, 1);
 
 	/* register power-off method */
-	pm_power_off = ls_hgl_power_off;
+	register_poweroff_handler_simple(ls_hgl_power_off, 0);
 
 	pr_info("%s: finished\n", __func__);
 }
arch/arm/mach-orion5x/lsmini-setup.c +1 -1
index a6493e7..ffec72f 100644
@@ -260,7 +260,7 @@ static void __init lsmini_init(void)
 	gpio_set_value(LSMINI_GPIO_USB_POWER, 1);
 
 	/* register power-off method */
-	pm_power_off = lsmini_power_off;
+	register_poweroff_handler_simple(lsmini_power_off, 0);
 
 	pr_info("%s: finished\n", __func__);
 }
arch/arm/mach-orion5x/mv2120-setup.c +1 -1
index e032f01..dadc2b9 100644
@@ -225,7 +225,7 @@ static void __init mv2120_init(void)
 	if (gpio_request(MV2120_GPIO_POWER_OFF, "POWEROFF") != 0 ||
 	    gpio_direction_output(MV2120_GPIO_POWER_OFF, 1) != 0)
 		pr_err("mv2120: failed to setup power-off GPIO\n");
-	pm_power_off = mv2120_power_off;
+	register_poweroff_handler_simple(mv2120_power_off, 128);
 }
 
 /* Warning: HP uses a wrong mach-type (=526) in their bootloader */
arch/arm/mach-orion5x/net2big-setup.c +1 -1
index ba73dc7..3a73dce 100644
@@ -413,7 +413,7 @@ static void __init net2big_init(void)
 
 	if (gpio_request(NET2BIG_GPIO_POWER_OFF, "power-off") == 0 &&
 	    gpio_direction_output(NET2BIG_GPIO_POWER_OFF, 0) == 0)
-		pm_power_off = net2big_power_off;
+		register_poweroff_handler_simple(net2big_power_off, 128);
 	else
 		pr_err("net2big: failed to configure power-off GPIO\n");
 
arch/arm/mach-orion5x/terastation_pro2-setup.c +1 -1
index 6208d12..2a234cb 100644
@@ -353,7 +353,7 @@ static void __init tsp2_init(void)
 	i2c_register_board_info(0, &tsp2_i2c_rtc, 1);
 
 	/* register Terastation Pro II specific power-off method */
-	pm_power_off = tsp2_power_off;
+	register_poweroff_handler_simple(tsp2_power_off, 128);
 }
 
 MACHINE_START(TERASTATION_PRO2, "Buffalo Terastation Pro II/Live")
arch/arm/mach-orion5x/ts209-setup.c +1 -1
index 9136797..50bdfbc 100644
@@ -318,7 +318,7 @@ static void __init qnap_ts209_init(void)
 	i2c_register_board_info(0, &qnap_ts209_i2c_rtc, 1);
 
 	/* register tsx09 specific power-off method */
-	pm_power_off = qnap_tsx09_power_off;
+	register_poweroff_handler_simple(qnap_tsx09_power_off, 128);
 }
 
 MACHINE_START(TS209, "QNAP TS-109/TS-209")
arch/arm/mach-orion5x/ts409-setup.c +1 -1
index 5c079d31..06a7cc0 100644
@@ -307,7 +307,7 @@ static void __init qnap_ts409_init(void)
 	platform_device_register(&ts409_leds);
 
 	/* register tsx09 specific power-off method */
-	pm_power_off = qnap_tsx09_power_off;
+	register_poweroff_handler_simple(qnap_tsx09_power_off, 128);
 }
 
 MACHINE_START(TS409, "QNAP TS-409")
arch/arm/mach-pxa/corgi.c +1 -1
index 06022b2..a93bac0 100644
@@ -718,7 +718,7 @@ static void corgi_restart(enum reboot_mode mode, const char *cmd)
 
 static void __init corgi_init(void)
 {
-	pm_power_off = corgi_poweroff;
+	register_poweroff_handler_simple(corgi_poweroff, 0);
 
 	/* Stop 3.6MHz and drive HIGH to PCMCIA and CS */
 	PCFR |= PCFR_OPDE;
arch/arm/mach-pxa/mioa701.c +1 -1
index 29997bd..c4345a4 100644
@@ -750,7 +750,7 @@ static void __init mioa701_machine_init(void)
 	pxa_set_keypad_info(&mioa701_keypad_info);
 	pxa_set_udc_info(&mioa701_udc_info);
 	pxa_set_ac97_info(&mioa701_ac97_info);
-	pm_power_off = mioa701_poweroff;
+	register_poweroff_handler_simple(mioa701_poweroff, 0);
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 	gsm_init();
 
arch/arm/mach-pxa/poodle.c +1 -1
index 1319916..c9536ed 100644
@@ -432,7 +432,7 @@ static void __init poodle_init(void)
 {
 	int ret = 0;
 
-	pm_power_off = poodle_poweroff;
+	register_poweroff_handler_simple(poodle_poweroff, 0);
 
 	PCFR |= PCFR_OPDE;
 
arch/arm/mach-pxa/spitz.c +1 -1
index 840c3a4..09f0de8 100644
@@ -944,7 +944,7 @@ static void spitz_restart(enum reboot_mode mode, const char *cmd)
 static void __init spitz_init(void)
 {
 	init_gpio_reset(SPITZ_GPIO_ON_RESET, 1, 0);
-	pm_power_off = spitz_poweroff;
+	register_poweroff_handler_simple(spitz_poweroff, 0);
 
 	PMCR = 0x00;
 
arch/arm/mach-pxa/tosa.c +1 -1
index c158a6e..3a4af1d 100644
@@ -940,7 +940,7 @@ static void __init tosa_init(void)
 
 	init_gpio_reset(TOSA_GPIO_ON_RESET, 0, 0);
 
-	pm_power_off = tosa_poweroff;
+	register_poweroff_handler_simple(tosa_poweroff, 0);
 
 	PCFR |= PCFR_OPDE;
 
arch/arm/mach-pxa/viper.c +1 -1
index de3b080..679c8ea 100644
@@ -919,7 +919,7 @@ static void __init viper_init(void)
 {
 	u8 version;
 
-	pm_power_off = viper_power_off;
+	register_poweroff_handler_simple(viper_power_off, 128);
 
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(viper_pin_config));
 
arch/arm/mach-pxa/z2.c +3 -3
index e1a121b..e0195ac 100644
@@ -693,8 +693,6 @@ static void z2_power_off(void)
 	pxa27x_set_pwrmode(PWRMODE_DEEPSLEEP);
 	pxa27x_cpu_pm_enter(PM_SUSPEND_MEM);
 }
-#else
-#define z2_power_off   NULL
 #endif
 
 /******************************************************************************
@@ -719,7 +717,9 @@ static void __init z2_init(void)
 	z2_keys_init();
 	z2_pmic_init();
 
-	pm_power_off = z2_power_off;
+#ifdef CONFIG_PM
+	register_poweroff_handler_simple(z2_power_off, 0);
+#endif
 }
 
 MACHINE_START(ZIPIT2, "Zipit Z2")
arch/arm/mach-pxa/zeus.c +3 -3
index 205f9bf..6118fd5 100644
@@ -690,8 +690,6 @@ static void zeus_power_off(void)
 	local_irq_disable();
 	cpu_suspend(PWRMODE_DEEPSLEEP, pxa27x_finish_suspend);
 }
-#else
-#define zeus_power_off   NULL
 #endif
 
 #ifdef CONFIG_APM_EMULATION
@@ -847,7 +845,9 @@ static void __init zeus_init(void)
 	__raw_writel(msc0, MSC0);
 	__raw_writel(msc1, MSC1);
 
-	pm_power_off = zeus_power_off;
+#ifdef CONFIG_PM
+	register_poweroff_handler_simple(zeus_power_off, 0);
+#endif
 	zeus_setup_apm();
 
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(zeus_pin_config));
arch/arm/mach-s3c24xx/mach-gta02.c +1 -1
index fc3a08d..ca78150 100644
@@ -579,7 +579,7 @@ static void __init gta02_machine_init(void)
 	i2c_register_board_info(0, gta02_i2c_devs, ARRAY_SIZE(gta02_i2c_devs));
 
 	platform_add_devices(gta02_devices, ARRAY_SIZE(gta02_devices));
-	pm_power_off = gta02_poweroff;
+	register_poweroff_handler_simple(gta02_poweroff, 128);
 
 	regulator_has_full_constraints();
 }
arch/arm/mach-s3c24xx/mach-jive.c +1 -1
index 7804d3c..5a828a3 100644
@@ -657,7 +657,7 @@ static void __init jive_machine_init(void)
 	s3c_i2c0_set_platdata(&jive_i2c_cfg);
 	i2c_register_board_info(0, jive_i2c_devs, ARRAY_SIZE(jive_i2c_devs));
 
-	pm_power_off = jive_power_off;
+	register_poweroff_handler_simple(jive_power_off, 128);
 
 	platform_add_devices(jive_devices, ARRAY_SIZE(jive_devices));
 }
arch/arm/mach-s3c24xx/mach-vr1000.c +1 -1
index f88c584..40d7655 100644
@@ -306,7 +306,7 @@ static void vr1000_power_off(void)
 
 static void __init vr1000_map_io(void)
 {
-	pm_power_off = vr1000_power_off;
+	register_poweroff_handler_simple(vr1000_power_off, 128);
 
 	s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc));
 	s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs));
arch/arm/mach-s3c64xx/mach-smartq.c +1 -1
index b3d1353..61f0893 100644
@@ -291,7 +291,7 @@ static int __init smartq_power_off_init(void)
 	/* leave power on */
 	gpio_direction_output(S3C64XX_GPK(15), 0);
 
-	pm_power_off = smartq_power_off;
+	register_poweroff_handler_simple(smartq_power_off, 128);
 
 	return ret;
 }
arch/arm/mach-sa1100/generic.c +1 -1
index d4ea142..6b839cf 100644
@@ -311,7 +311,7 @@ static struct platform_device *sa11x0_devices[] __initdata = {
 
 static int __init sa1100_init(void)
 {
-	pm_power_off = sa1100_power_off;
+	register_poweroff_handler_simple(sa1100_power_off, 0);
 	return platform_add_devices(sa11x0_devices, ARRAY_SIZE(sa11x0_devices));
 }
 
arch/arm/mach-sa1100/simpad.c +1 -1
index 41e476e..a65ca58 100644
@@ -373,7 +373,7 @@ static int __init simpad_init(void)
 	if (ret)
 		printk(KERN_WARNING "simpad: Unable to register cs3 GPIO device");
 
-	pm_power_off = simpad_power_off;
+	register_poweroff_handler_simple(simpad_power_off, 0);
 
 	sa11x0_ppc_configure_mcp();
 	sa11x0_register_mtd(&simpad_flash_data, simpad_flash_resources,
arch/arm/mach-u300/regulator.c +1 -1
index 0493a84..c98eb6e 100644
@@ -98,7 +98,7 @@ static int __init __u300_init_boardpower(struct platform_device *pdev)
 			   U300_SYSCON_PMCR_DCON_ENABLE, 0);
 
 	/* Register globally exported PM poweroff hook */
-	pm_power_off = u300_pm_poweroff;
+	register_poweroff_handler_simple(u300_pm_poweroff, 128);
 
 	return 0;
 }
arch/arm/mach-vt8500/vt8500.c +1 -1
index 2da7be3..515946b 100644
@@ -155,7 +155,7 @@ static void __init vt8500_init(void)
 			pr_err("%s:ioremap(power_off) failed\n", __func__);
 	}
 	if (pmc_base)
-		pm_power_off = &vt8500_power_off;
+		register_poweroff_handler_simple(vt8500_power_off, 0);
 	else
 		pr_err("%s: PMC Hibernation register could not be remapped, not enabling power off!\n", __func__);
 
arch/arm/xen/enlighten.c +1 -1
index 0e15f01..0da639b 100644
@@ -336,7 +336,7 @@ static int __init xen_pm_init(void)
 	if (!xen_domain())
 		return -ENODEV;
 
-	pm_power_off = xen_power_off;
+	register_poweroff_handler_simple(xen_power_off, 128);
 	arm_pm_restart = xen_restart;
 
 	return 0;
Signature · 1 line
Nicolas Ferre
#212 lore raw

Re: [PATCH 31/44] arm: Register with kernel poweroff handler

In reply to Guenter Roeck

On 07/10/2014 07:28, Guenter Roeck :

Quoted 36 lines

Register with kernel poweroff handler instead of setting pm_power_off directly. Always use register_poweroff_handler_simple as there is no indication that more than one poweroff handler is registered.

If the poweroff handler only resets the system or puts the CPU in sleep mode, select a priority of 0 to indicate that the poweroff handler is one of last resort. If the poweroff handler powers off the system, select a priority of 128.

Cc Russell King <[email protected]>
Cc Andrew Victor <[email protected]>
Cc Nicolas Ferre <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Christian Daudt <[email protected]>
Cc Matt Porter <[email protected]>
Cc Anton Vorontsov <[email protected]>
Cc Rob Herring <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Imre Kaloz <[email protected]>
Cc Krzysztof Halasa <[email protected]>
Cc Tony Lindgren <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Andrew Lunn <[email protected]>
Cc Sebastian Hesselbarth <[email protected]>
Cc Eric Miao <[email protected]>
Cc Haojian Zhuang <[email protected]>
Cc Robert Jarzmik <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Ben Dooks <[email protected]>
Cc Kukjin Kim <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Tony Prisk <[email protected]>
Cc Stefano Stabellini <[email protected]>
Quoted 6 lines
---
 arch/arm/kernel/psci.c                         | 2 +-
 arch/arm/mach-at91/board-gsia18s.c             | 2 +-
 arch/arm/mach-at91/setup.c                     | 4 ++--

For the 2 files above: NAK just because:
for the first one -> this file will be removed during 3.19 dev cycle. for the second one -> the poweroff handlers are removed during the 3.18 cycle and converted in the appropriate poweroff drivers (in drivers/power/reset/at91-poweroff.c).

So, can you remove these changes from your patch?

Thanks for your work, bye.

Quoted 663 lines
 arch/arm/mach-bcm/board_bcm2835.c              | 2 +-
 arch/arm/mach-cns3xxx/cns3420vb.c              | 2 +-
 arch/arm/mach-cns3xxx/core.c                   | 2 +-
 arch/arm/mach-highbank/highbank.c              | 2 +-
 arch/arm/mach-imx/mach-mx31moboard.c           | 2 +-
 arch/arm/mach-iop32x/em7210.c                  | 2 +-
 arch/arm/mach-iop32x/glantank.c                | 2 +-
 arch/arm/mach-iop32x/iq31244.c                 | 2 +-
 arch/arm/mach-iop32x/n2100.c                   | 2 +-
 arch/arm/mach-ixp4xx/dsmg600-setup.c           | 2 +-
 arch/arm/mach-ixp4xx/nas100d-setup.c           | 2 +-
 arch/arm/mach-ixp4xx/nslu2-setup.c             | 2 +-
 arch/arm/mach-omap2/board-omap3touchbook.c     | 2 +-
 arch/arm/mach-orion5x/board-mss2.c             | 2 +-
 arch/arm/mach-orion5x/dns323-setup.c           | 6 +++---
 arch/arm/mach-orion5x/kurobox_pro-setup.c      | 2 +-
 arch/arm/mach-orion5x/ls-chl-setup.c           | 2 +-
 arch/arm/mach-orion5x/ls_hgl-setup.c           | 2 +-
 arch/arm/mach-orion5x/lsmini-setup.c           | 2 +-
 arch/arm/mach-orion5x/mv2120-setup.c           | 2 +-
 arch/arm/mach-orion5x/net2big-setup.c          | 2 +-
 arch/arm/mach-orion5x/terastation_pro2-setup.c | 2 +-
 arch/arm/mach-orion5x/ts209-setup.c            | 2 +-
 arch/arm/mach-orion5x/ts409-setup.c            | 2 +-
 arch/arm/mach-pxa/corgi.c                      | 2 +-
 arch/arm/mach-pxa/mioa701.c                    | 2 +-
 arch/arm/mach-pxa/poodle.c                     | 2 +-
 arch/arm/mach-pxa/spitz.c                      | 2 +-
 arch/arm/mach-pxa/tosa.c                       | 2 +-
 arch/arm/mach-pxa/viper.c                      | 2 +-
 arch/arm/mach-pxa/z2.c                         | 6 +++---
 arch/arm/mach-pxa/zeus.c                       | 6 +++---
 arch/arm/mach-s3c24xx/mach-gta02.c             | 2 +-
 arch/arm/mach-s3c24xx/mach-jive.c              | 2 +-
 arch/arm/mach-s3c24xx/mach-vr1000.c            | 2 +-
 arch/arm/mach-s3c64xx/mach-smartq.c            | 2 +-
 arch/arm/mach-sa1100/generic.c                 | 2 +-
 arch/arm/mach-sa1100/simpad.c                  | 2 +-
 arch/arm/mach-u300/regulator.c                 | 2 +-
 arch/arm/mach-vt8500/vt8500.c                  | 2 +-
 arch/arm/xen/enlighten.c                       | 2 +-
 44 files changed, 51 insertions(+), 51 deletions(-)
arch/arm/kernel/psci.c +1 -1
index f73891b..dd58d86 100644
@@ -264,7 +264,7 @@ static int psci_0_2_init(struct device_node *np)
 
 	arm_pm_restart = psci_sys_reset;
 
-	pm_power_off = psci_sys_poweroff;
+	register_poweroff_handler_simple(psci_sys_poweroff, 128);
 
 out_put_node:
 	of_node_put(np);
arch/arm/mach-at91/board-gsia18s.c +1 -1
index b729dd1..6722e66 100644
@@ -521,7 +521,7 @@ static void gsia18s_power_off(void)
 
 static int __init gsia18s_power_off_init(void)
 {
-	pm_power_off = gsia18s_power_off;
+	register_poweroff_handler_simple(gsia18s_power_off, 128);
 	return 0;
 }
 
arch/arm/mach-at91/setup.c +2 -2
index f7a07a5..9989e88 100644
@@ -329,7 +329,7 @@ void __init at91_ioremap_shdwc(u32 base_addr)
 	at91_shdwc_base = ioremap(base_addr, 16);
 	if (!at91_shdwc_base)
 		panic("Impossible to ioremap at91_shdwc_base\n");
-	pm_power_off = at91sam9_poweroff;
+	register_poweroff_handler_simple(at91sam9_poweroff, 128);
 }
 
 void __iomem *at91_rstc_base;
@@ -482,7 +482,7 @@ static void at91_dt_shdwc(void)
 	at91_shdwc_write(AT91_SHDW_MR, wakeup_mode | mode);
 
 end:
-	pm_power_off = at91sam9_poweroff;
+	register_poweroff_handler_simple(at91sam9_poweroff, 128);
 
 	of_node_put(np);
 }
arch/arm/mach-bcm/board_bcm2835.c +1 -1
index 70f2f39..7d5784f 100644
@@ -111,7 +111,7 @@ static void __init bcm2835_init(void)
 
 	bcm2835_setup_restart();
 	if (wdt_regs)
-		pm_power_off = bcm2835_power_off;
+		register_poweroff_handler_simple(bcm2835_power_off, 0);
 
 	bcm2835_init_clocks();
 
arch/arm/mach-cns3xxx/cns3420vb.c +1 -1
index d863d87..136b7c6 100644
@@ -224,7 +224,7 @@ static void __init cns3420_init(void)
 	cns3xxx_ahci_init();
 	cns3xxx_sdhci_init();
 
-	pm_power_off = cns3xxx_power_off;
+	register_poweroff_handler_simple(cns3xxx_power_off, 128);
 }
 
 static struct map_desc cns3420_io_desc[] __initdata = {
arch/arm/mach-cns3xxx/core.c +1 -1
index f85449a..79e6ead 100644
@@ -386,7 +386,7 @@ static void __init cns3xxx_init(void)
 		cns3xxx_pwr_soft_rst(CNS3XXX_PWR_SOFTWARE_RST(SDIO));
 	}
 
-	pm_power_off = cns3xxx_power_off;
+	register_poweroff_handler_simple(cns3xxx_power_off, 128);
 
 	of_platform_populate(NULL, of_default_bus_match_table,
                         cns3xxx_auxdata, NULL);
arch/arm/mach-highbank/highbank.c +1 -1
index 8c35ae4..25d0134 100644
@@ -155,7 +155,7 @@ static void __init highbank_init(void)
 	sregs_base = of_iomap(np, 0);
 	WARN_ON(!sregs_base);
 
-	pm_power_off = highbank_power_off;
+	register_poweroff_handler_simple(highbank_power_off, 0);
 	highbank_pm_init();
 
 	bus_register_notifier(&platform_bus_type, &highbank_platform_nb);
arch/arm/mach-imx/mach-mx31moboard.c +1 -1
index bb6f8a5..9b3616f 100644
@@ -559,7 +559,7 @@ static void __init mx31moboard_init(void)
 
 	imx_add_platform_device("imx_mc13783", 0, NULL, 0, NULL, 0);
 
-	pm_power_off = mx31moboard_poweroff;
+	register_poweroff_handler_simple(mx31moboard_poweroff, 128);
 
 	switch (mx31moboard_baseboard) {
 	case MX31NOBOARD:
arch/arm/mach-iop32x/em7210.c +1 -1
index 77e1ff0..beeeb0c2 100644
@@ -201,7 +201,7 @@ static int __init em7210_request_gpios(void)
 		return 0;
 	}
 
-	pm_power_off = em7210_power_off;
+	register_poweroff_handler_simple(em7210_power_off, 128);
 
 	return 0;
 }
arch/arm/mach-iop32x/glantank.c +1 -1
index 547b234..050a8e6 100644
@@ -199,7 +199,7 @@ static void __init glantank_init_machine(void)
 	i2c_register_board_info(0, glantank_i2c_devices,
 		ARRAY_SIZE(glantank_i2c_devices));
 
-	pm_power_off = glantank_power_off;
+	register_poweroff_handler_simple(glantank_power_off, 128);
 }
 
 MACHINE_START(GLANTANK, "GLAN Tank")
arch/arm/mach-iop32x/iq31244.c +1 -1
index 0e1392b..4e9b972 100644
@@ -293,7 +293,7 @@ static void __init iq31244_init_machine(void)
 	platform_device_register(&iop3xx_dma_1_channel);
 
 	if (is_ep80219())
-		pm_power_off = ep80219_power_off;
+		register_poweroff_handler_simple(ep80219_power_off, 128);
 
 	if (!is_80219())
 		platform_device_register(&iop3xx_aau_channel);
arch/arm/mach-iop32x/n2100.c +1 -1
index c1cd80e..171d496 100644
@@ -356,7 +356,7 @@ static void __init n2100_init_machine(void)
 	i2c_register_board_info(0, n2100_i2c_devices,
 		ARRAY_SIZE(n2100_i2c_devices));
 
-	pm_power_off = n2100_power_off;
+	register_poweroff_handler_simple(n2100_power_off, 128);
 }
 
 MACHINE_START(N2100, "Thecus N2100")
arch/arm/mach-ixp4xx/dsmg600-setup.c +1 -1
index 43ee06d..6fb5072 100644
@@ -281,7 +281,7 @@ static void __init dsmg600_init(void)
 
 	platform_add_devices(dsmg600_devices, ARRAY_SIZE(dsmg600_devices));
 
-	pm_power_off = dsmg600_power_off;
+	register_poweroff_handler_simple(dsmg600_power_off, 128);
 }
 
 MACHINE_START(DSMG600, "D-Link DSM-G600 RevA")
arch/arm/mach-ixp4xx/nas100d-setup.c +1 -1
index 4e0f762..bd9a8d6 100644
@@ -292,7 +292,7 @@ static void __init nas100d_init(void)
 
 	platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
 
-	pm_power_off = nas100d_power_off;
+	register_poweroff_handler_simple(nas100d_power_off, 128);
 
 	if (request_irq(gpio_to_irq(NAS100D_RB_GPIO), &nas100d_reset_handler,
 		IRQF_TRIGGER_LOW, "NAS100D reset button", NULL) < 0) {
arch/arm/mach-ixp4xx/nslu2-setup.c +1 -1
index 88c025f..c4c5475 100644
@@ -262,7 +262,7 @@ static void __init nslu2_init(void)
 
 	platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices));
 
-	pm_power_off = nslu2_power_off;
+	register_poweroff_handler_simple(nslu2_power_off, 128);
 
 	if (request_irq(gpio_to_irq(NSLU2_RB_GPIO), &nslu2_reset_handler,
 		IRQF_TRIGGER_LOW, "NSLU2 reset button", NULL) < 0) {
arch/arm/mach-omap2/board-omap3touchbook.c +1 -1
index 70b904c..0c0a0e2 100644
@@ -344,7 +344,7 @@ static void __init omap3_touchbook_init(void)
 {
 	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
 
-	pm_power_off = omap3_touchbook_poweroff;
+	register_poweroff_handler_simple(omap3_touchbook_poweroff, 128);
 
 	if (system_rev >= 0x20 && system_rev <= 0x34301000) {
 		omap_mux_init_gpio(23, OMAP_PIN_INPUT);
arch/arm/mach-orion5x/board-mss2.c +1 -1
index 66f9c3b..3840d66 100644
@@ -86,5 +86,5 @@ static void mss2_power_off(void)
 void __init mss2_init(void)
 {
 	/* register mss2 specific power-off method */
-	pm_power_off = mss2_power_off;
+	register_poweroff_handler_simple(mss2_power_off, 0);
 }
arch/arm/mach-orion5x/dns323-setup.c +3 -3
index 56edeab..353ca3d 100644
@@ -669,7 +669,7 @@ static void __init dns323_init(void)
 		if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 ||
 		    gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0)
 			pr_err("DNS-323: failed to setup power-off GPIO\n");
-		pm_power_off = dns323a_power_off;
+		register_poweroff_handler_simple(dns323a_power_off, 128);
 		break;
 	case DNS323_REV_B1:
 		/* 5182 built-in SATA init */
@@ -686,7 +686,7 @@ static void __init dns323_init(void)
 		if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 ||
 		    gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0)
 			pr_err("DNS-323: failed to setup power-off GPIO\n");
-		pm_power_off = dns323b_power_off;
+		register_poweroff_handler_simple(dns323b_power_off, 128);
 		break;
 	case DNS323_REV_C1:
 		/* 5182 built-in SATA init */
@@ -696,7 +696,7 @@ static void __init dns323_init(void)
 		if (gpio_request(DNS323C_GPIO_POWER_OFF, "POWEROFF") != 0 ||
 		    gpio_direction_output(DNS323C_GPIO_POWER_OFF, 0) != 0)
 			pr_err("DNS-323: failed to setup power-off GPIO\n");
-		pm_power_off = dns323c_power_off;
+		register_poweroff_handler_simple(dns323c_power_off, 128);
 
 		/* Now, -this- should theorically be done by the sata_mv driver
 		 * once I figure out what's going on there. Maybe the behaviour
arch/arm/mach-orion5x/kurobox_pro-setup.c +1 -1
index fe6a48a..c4101f1 100644
@@ -376,7 +376,7 @@ static void __init kurobox_pro_init(void)
 	i2c_register_board_info(0, &kurobox_pro_i2c_rtc, 1);
 
 	/* register Kurobox Pro specific power-off method */
-	pm_power_off = kurobox_pro_power_off;
+	register_poweroff_handler_simple(kurobox_pro_power_off, 128);
 }
 
 #ifdef CONFIG_MACH_KUROBOX_PRO
arch/arm/mach-orion5x/ls-chl-setup.c +1 -1
index 028ea03..005bb04 100644
@@ -312,7 +312,7 @@ static void __init lschl_init(void)
 	gpio_set_value(LSCHL_GPIO_USB_POWER, 1);
 
 	/* register power-off method */
-	pm_power_off = lschl_power_off;
+	register_poweroff_handler_simple(lschl_power_off, 0);
 
 	pr_info("%s: finished\n", __func__);
 }
arch/arm/mach-orion5x/ls_hgl-setup.c +1 -1
index 32b7129..37c29a0 100644
@@ -259,7 +259,7 @@ static void __init ls_hgl_init(void)
 	gpio_set_value(LS_HGL_GPIO_USB_POWER, 1);
 
 	/* register power-off method */
-	pm_power_off = ls_hgl_power_off;
+	register_poweroff_handler_simple(ls_hgl_power_off, 0);
 
 	pr_info("%s: finished\n", __func__);
 }
arch/arm/mach-orion5x/lsmini-setup.c +1 -1
index a6493e7..ffec72f 100644
@@ -260,7 +260,7 @@ static void __init lsmini_init(void)
 	gpio_set_value(LSMINI_GPIO_USB_POWER, 1);
 
 	/* register power-off method */
-	pm_power_off = lsmini_power_off;
+	register_poweroff_handler_simple(lsmini_power_off, 0);
 
 	pr_info("%s: finished\n", __func__);
 }
arch/arm/mach-orion5x/mv2120-setup.c +1 -1
index e032f01..dadc2b9 100644
@@ -225,7 +225,7 @@ static void __init mv2120_init(void)
 	if (gpio_request(MV2120_GPIO_POWER_OFF, "POWEROFF") != 0 ||
 	    gpio_direction_output(MV2120_GPIO_POWER_OFF, 1) != 0)
 		pr_err("mv2120: failed to setup power-off GPIO\n");
-	pm_power_off = mv2120_power_off;
+	register_poweroff_handler_simple(mv2120_power_off, 128);
 }
 
 /* Warning: HP uses a wrong mach-type (=526) in their bootloader */
arch/arm/mach-orion5x/net2big-setup.c +1 -1
index ba73dc7..3a73dce 100644
@@ -413,7 +413,7 @@ static void __init net2big_init(void)
 
 	if (gpio_request(NET2BIG_GPIO_POWER_OFF, "power-off") == 0 &&
 	    gpio_direction_output(NET2BIG_GPIO_POWER_OFF, 0) == 0)
-		pm_power_off = net2big_power_off;
+		register_poweroff_handler_simple(net2big_power_off, 128);
 	else
 		pr_err("net2big: failed to configure power-off GPIO\n");
 
arch/arm/mach-orion5x/terastation_pro2-setup.c +1 -1
index 6208d12..2a234cb 100644
@@ -353,7 +353,7 @@ static void __init tsp2_init(void)
 	i2c_register_board_info(0, &tsp2_i2c_rtc, 1);
 
 	/* register Terastation Pro II specific power-off method */
-	pm_power_off = tsp2_power_off;
+	register_poweroff_handler_simple(tsp2_power_off, 128);
 }
 
 MACHINE_START(TERASTATION_PRO2, "Buffalo Terastation Pro II/Live")
arch/arm/mach-orion5x/ts209-setup.c +1 -1
index 9136797..50bdfbc 100644
@@ -318,7 +318,7 @@ static void __init qnap_ts209_init(void)
 	i2c_register_board_info(0, &qnap_ts209_i2c_rtc, 1);
 
 	/* register tsx09 specific power-off method */
-	pm_power_off = qnap_tsx09_power_off;
+	register_poweroff_handler_simple(qnap_tsx09_power_off, 128);
 }
 
 MACHINE_START(TS209, "QNAP TS-109/TS-209")
arch/arm/mach-orion5x/ts409-setup.c +1 -1
index 5c079d31..06a7cc0 100644
@@ -307,7 +307,7 @@ static void __init qnap_ts409_init(void)
 	platform_device_register(&ts409_leds);
 
 	/* register tsx09 specific power-off method */
-	pm_power_off = qnap_tsx09_power_off;
+	register_poweroff_handler_simple(qnap_tsx09_power_off, 128);
 }
 
 MACHINE_START(TS409, "QNAP TS-409")
arch/arm/mach-pxa/corgi.c +1 -1
index 06022b2..a93bac0 100644
@@ -718,7 +718,7 @@ static void corgi_restart(enum reboot_mode mode, const char *cmd)
 
 static void __init corgi_init(void)
 {
-	pm_power_off = corgi_poweroff;
+	register_poweroff_handler_simple(corgi_poweroff, 0);
 
 	/* Stop 3.6MHz and drive HIGH to PCMCIA and CS */
 	PCFR |= PCFR_OPDE;
arch/arm/mach-pxa/mioa701.c +1 -1
index 29997bd..c4345a4 100644
@@ -750,7 +750,7 @@ static void __init mioa701_machine_init(void)
 	pxa_set_keypad_info(&mioa701_keypad_info);
 	pxa_set_udc_info(&mioa701_udc_info);
 	pxa_set_ac97_info(&mioa701_ac97_info);
-	pm_power_off = mioa701_poweroff;
+	register_poweroff_handler_simple(mioa701_poweroff, 0);
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 	gsm_init();
 
arch/arm/mach-pxa/poodle.c +1 -1
index 1319916..c9536ed 100644
@@ -432,7 +432,7 @@ static void __init poodle_init(void)
 {
 	int ret = 0;
 
-	pm_power_off = poodle_poweroff;
+	register_poweroff_handler_simple(poodle_poweroff, 0);
 
 	PCFR |= PCFR_OPDE;
 
arch/arm/mach-pxa/spitz.c +1 -1
index 840c3a4..09f0de8 100644
@@ -944,7 +944,7 @@ static void spitz_restart(enum reboot_mode mode, const char *cmd)
 static void __init spitz_init(void)
 {
 	init_gpio_reset(SPITZ_GPIO_ON_RESET, 1, 0);
-	pm_power_off = spitz_poweroff;
+	register_poweroff_handler_simple(spitz_poweroff, 0);
 
 	PMCR = 0x00;
 
arch/arm/mach-pxa/tosa.c +1 -1
index c158a6e..3a4af1d 100644
@@ -940,7 +940,7 @@ static void __init tosa_init(void)
 
 	init_gpio_reset(TOSA_GPIO_ON_RESET, 0, 0);
 
-	pm_power_off = tosa_poweroff;
+	register_poweroff_handler_simple(tosa_poweroff, 0);
 
 	PCFR |= PCFR_OPDE;
 
arch/arm/mach-pxa/viper.c +1 -1
index de3b080..679c8ea 100644
@@ -919,7 +919,7 @@ static void __init viper_init(void)
 {
 	u8 version;
 
-	pm_power_off = viper_power_off;
+	register_poweroff_handler_simple(viper_power_off, 128);
 
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(viper_pin_config));
 
arch/arm/mach-pxa/z2.c +3 -3
index e1a121b..e0195ac 100644
@@ -693,8 +693,6 @@ static void z2_power_off(void)
 	pxa27x_set_pwrmode(PWRMODE_DEEPSLEEP);
 	pxa27x_cpu_pm_enter(PM_SUSPEND_MEM);
 }
-#else
-#define z2_power_off   NULL
 #endif
 
 /******************************************************************************
@@ -719,7 +717,9 @@ static void __init z2_init(void)
 	z2_keys_init();
 	z2_pmic_init();
 
-	pm_power_off = z2_power_off;
+#ifdef CONFIG_PM
+	register_poweroff_handler_simple(z2_power_off, 0);
+#endif
 }
 
 MACHINE_START(ZIPIT2, "Zipit Z2")
arch/arm/mach-pxa/zeus.c +3 -3
index 205f9bf..6118fd5 100644
@@ -690,8 +690,6 @@ static void zeus_power_off(void)
 	local_irq_disable();
 	cpu_suspend(PWRMODE_DEEPSLEEP, pxa27x_finish_suspend);
 }
-#else
-#define zeus_power_off   NULL
 #endif
 
 #ifdef CONFIG_APM_EMULATION
@@ -847,7 +845,9 @@ static void __init zeus_init(void)
 	__raw_writel(msc0, MSC0);
 	__raw_writel(msc1, MSC1);
 
-	pm_power_off = zeus_power_off;
+#ifdef CONFIG_PM
+	register_poweroff_handler_simple(zeus_power_off, 0);
+#endif
 	zeus_setup_apm();
 
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(zeus_pin_config));
arch/arm/mach-s3c24xx/mach-gta02.c +1 -1
index fc3a08d..ca78150 100644
@@ -579,7 +579,7 @@ static void __init gta02_machine_init(void)
 	i2c_register_board_info(0, gta02_i2c_devs, ARRAY_SIZE(gta02_i2c_devs));
 
 	platform_add_devices(gta02_devices, ARRAY_SIZE(gta02_devices));
-	pm_power_off = gta02_poweroff;
+	register_poweroff_handler_simple(gta02_poweroff, 128);
 
 	regulator_has_full_constraints();
 }
arch/arm/mach-s3c24xx/mach-jive.c +1 -1
index 7804d3c..5a828a3 100644
@@ -657,7 +657,7 @@ static void __init jive_machine_init(void)
 	s3c_i2c0_set_platdata(&jive_i2c_cfg);
 	i2c_register_board_info(0, jive_i2c_devs, ARRAY_SIZE(jive_i2c_devs));
 
-	pm_power_off = jive_power_off;
+	register_poweroff_handler_simple(jive_power_off, 128);
 
 	platform_add_devices(jive_devices, ARRAY_SIZE(jive_devices));
 }
arch/arm/mach-s3c24xx/mach-vr1000.c +1 -1
index f88c584..40d7655 100644
@@ -306,7 +306,7 @@ static void vr1000_power_off(void)
 
 static void __init vr1000_map_io(void)
 {
-	pm_power_off = vr1000_power_off;
+	register_poweroff_handler_simple(vr1000_power_off, 128);
 
 	s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc));
 	s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs));
arch/arm/mach-s3c64xx/mach-smartq.c +1 -1
index b3d1353..61f0893 100644
@@ -291,7 +291,7 @@ static int __init smartq_power_off_init(void)
 	/* leave power on */
 	gpio_direction_output(S3C64XX_GPK(15), 0);
 
-	pm_power_off = smartq_power_off;
+	register_poweroff_handler_simple(smartq_power_off, 128);
 
 	return ret;
 }
arch/arm/mach-sa1100/generic.c +1 -1
index d4ea142..6b839cf 100644
@@ -311,7 +311,7 @@ static struct platform_device *sa11x0_devices[] __initdata = {
 
 static int __init sa1100_init(void)
 {
-	pm_power_off = sa1100_power_off;
+	register_poweroff_handler_simple(sa1100_power_off, 0);
 	return platform_add_devices(sa11x0_devices, ARRAY_SIZE(sa11x0_devices));
 }
 
arch/arm/mach-sa1100/simpad.c +1 -1
index 41e476e..a65ca58 100644
@@ -373,7 +373,7 @@ static int __init simpad_init(void)
 	if (ret)
 		printk(KERN_WARNING "simpad: Unable to register cs3 GPIO device");
 
-	pm_power_off = simpad_power_off;
+	register_poweroff_handler_simple(simpad_power_off, 0);
 
 	sa11x0_ppc_configure_mcp();
 	sa11x0_register_mtd(&simpad_flash_data, simpad_flash_resources,
arch/arm/mach-u300/regulator.c +1 -1
index 0493a84..c98eb6e 100644
@@ -98,7 +98,7 @@ static int __init __u300_init_boardpower(struct platform_device *pdev)
 			   U300_SYSCON_PMCR_DCON_ENABLE, 0);
 
 	/* Register globally exported PM poweroff hook */
-	pm_power_off = u300_pm_poweroff;
+	register_poweroff_handler_simple(u300_pm_poweroff, 128);
 
 	return 0;
 }
arch/arm/mach-vt8500/vt8500.c +1 -1
index 2da7be3..515946b 100644
@@ -155,7 +155,7 @@ static void __init vt8500_init(void)
 			pr_err("%s:ioremap(power_off) failed\n", __func__);
 	}
 	if (pmc_base)
-		pm_power_off = &vt8500_power_off;
+		register_poweroff_handler_simple(vt8500_power_off, 0);
 	else
 		pr_err("%s: PMC Hibernation register could not be remapped, not enabling power off!\n", __func__);
 
arch/arm/xen/enlighten.c +1 -1
index 0e15f01..0da639b 100644
@@ -336,7 +336,7 @@ static int __init xen_pm_init(void)
 	if (!xen_domain())
 		return -ENODEV;
 
-	pm_power_off = xen_power_off;
+	register_poweroff_handler_simple(xen_power_off, 128);
 	arm_pm_restart = xen_restart;
 
 	return 0;
Signature · 1 line
Nicolas Ferre
#213 lore raw

Re: [PATCH 31/44] arm: Register with kernel poweroff handler

In reply to Guenter Roeck

On 07/10/2014 07:28, Guenter Roeck :

Quoted 36 lines

Register with kernel poweroff handler instead of setting pm_power_off directly. Always use register_poweroff_handler_simple as there is no indication that more than one poweroff handler is registered.

If the poweroff handler only resets the system or puts the CPU in sleep mode, select a priority of 0 to indicate that the poweroff handler is one of last resort. If the poweroff handler powers off the system, select a priority of 128.

Cc Russell King <[email protected]>
Cc Andrew Victor <[email protected]>
Cc Nicolas Ferre <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Christian Daudt <[email protected]>
Cc Matt Porter <[email protected]>
Cc Anton Vorontsov <[email protected]>
Cc Rob Herring <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Imre Kaloz <[email protected]>
Cc Krzysztof Halasa <[email protected]>
Cc Tony Lindgren <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Andrew Lunn <[email protected]>
Cc Sebastian Hesselbarth <[email protected]>
Cc Eric Miao <[email protected]>
Cc Haojian Zhuang <[email protected]>
Cc Robert Jarzmik <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Ben Dooks <[email protected]>
Cc Kukjin Kim <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Tony Prisk <[email protected]>
Cc Stefano Stabellini <[email protected]>
Quoted 6 lines
---
 arch/arm/kernel/psci.c                         | 2 +-
 arch/arm/mach-at91/board-gsia18s.c             | 2 +-
 arch/arm/mach-at91/setup.c                     | 4 ++--

For the 2 files above: NAK just because:
for the first one -> this file will be removed during 3.19 dev cycle. for the second one -> the poweroff handlers are removed during the 3.18 cycle and converted in the appropriate poweroff drivers (in drivers/power/reset/at91-poweroff.c).

So, can you remove these changes from your patch?

Thanks for your work, bye.

Quoted 663 lines
 arch/arm/mach-bcm/board_bcm2835.c              | 2 +-
 arch/arm/mach-cns3xxx/cns3420vb.c              | 2 +-
 arch/arm/mach-cns3xxx/core.c                   | 2 +-
 arch/arm/mach-highbank/highbank.c              | 2 +-
 arch/arm/mach-imx/mach-mx31moboard.c           | 2 +-
 arch/arm/mach-iop32x/em7210.c                  | 2 +-
 arch/arm/mach-iop32x/glantank.c                | 2 +-
 arch/arm/mach-iop32x/iq31244.c                 | 2 +-
 arch/arm/mach-iop32x/n2100.c                   | 2 +-
 arch/arm/mach-ixp4xx/dsmg600-setup.c           | 2 +-
 arch/arm/mach-ixp4xx/nas100d-setup.c           | 2 +-
 arch/arm/mach-ixp4xx/nslu2-setup.c             | 2 +-
 arch/arm/mach-omap2/board-omap3touchbook.c     | 2 +-
 arch/arm/mach-orion5x/board-mss2.c             | 2 +-
 arch/arm/mach-orion5x/dns323-setup.c           | 6 +++---
 arch/arm/mach-orion5x/kurobox_pro-setup.c      | 2 +-
 arch/arm/mach-orion5x/ls-chl-setup.c           | 2 +-
 arch/arm/mach-orion5x/ls_hgl-setup.c           | 2 +-
 arch/arm/mach-orion5x/lsmini-setup.c           | 2 +-
 arch/arm/mach-orion5x/mv2120-setup.c           | 2 +-
 arch/arm/mach-orion5x/net2big-setup.c          | 2 +-
 arch/arm/mach-orion5x/terastation_pro2-setup.c | 2 +-
 arch/arm/mach-orion5x/ts209-setup.c            | 2 +-
 arch/arm/mach-orion5x/ts409-setup.c            | 2 +-
 arch/arm/mach-pxa/corgi.c                      | 2 +-
 arch/arm/mach-pxa/mioa701.c                    | 2 +-
 arch/arm/mach-pxa/poodle.c                     | 2 +-
 arch/arm/mach-pxa/spitz.c                      | 2 +-
 arch/arm/mach-pxa/tosa.c                       | 2 +-
 arch/arm/mach-pxa/viper.c                      | 2 +-
 arch/arm/mach-pxa/z2.c                         | 6 +++---
 arch/arm/mach-pxa/zeus.c                       | 6 +++---
 arch/arm/mach-s3c24xx/mach-gta02.c             | 2 +-
 arch/arm/mach-s3c24xx/mach-jive.c              | 2 +-
 arch/arm/mach-s3c24xx/mach-vr1000.c            | 2 +-
 arch/arm/mach-s3c64xx/mach-smartq.c            | 2 +-
 arch/arm/mach-sa1100/generic.c                 | 2 +-
 arch/arm/mach-sa1100/simpad.c                  | 2 +-
 arch/arm/mach-u300/regulator.c                 | 2 +-
 arch/arm/mach-vt8500/vt8500.c                  | 2 +-
 arch/arm/xen/enlighten.c                       | 2 +-
 44 files changed, 51 insertions(+), 51 deletions(-)
arch/arm/kernel/psci.c +1 -1
index f73891b..dd58d86 100644
@@ -264,7 +264,7 @@ static int psci_0_2_init(struct device_node *np)
 
 	arm_pm_restart = psci_sys_reset;
 
-	pm_power_off = psci_sys_poweroff;
+	register_poweroff_handler_simple(psci_sys_poweroff, 128);
 
 out_put_node:
 	of_node_put(np);
arch/arm/mach-at91/board-gsia18s.c +1 -1
index b729dd1..6722e66 100644
@@ -521,7 +521,7 @@ static void gsia18s_power_off(void)
 
 static int __init gsia18s_power_off_init(void)
 {
-	pm_power_off = gsia18s_power_off;
+	register_poweroff_handler_simple(gsia18s_power_off, 128);
 	return 0;
 }
 
arch/arm/mach-at91/setup.c +2 -2
index f7a07a5..9989e88 100644
@@ -329,7 +329,7 @@ void __init at91_ioremap_shdwc(u32 base_addr)
 	at91_shdwc_base = ioremap(base_addr, 16);
 	if (!at91_shdwc_base)
 		panic("Impossible to ioremap at91_shdwc_base\n");
-	pm_power_off = at91sam9_poweroff;
+	register_poweroff_handler_simple(at91sam9_poweroff, 128);
 }
 
 void __iomem *at91_rstc_base;
@@ -482,7 +482,7 @@ static void at91_dt_shdwc(void)
 	at91_shdwc_write(AT91_SHDW_MR, wakeup_mode | mode);
 
 end:
-	pm_power_off = at91sam9_poweroff;
+	register_poweroff_handler_simple(at91sam9_poweroff, 128);
 
 	of_node_put(np);
 }
arch/arm/mach-bcm/board_bcm2835.c +1 -1
index 70f2f39..7d5784f 100644
@@ -111,7 +111,7 @@ static void __init bcm2835_init(void)
 
 	bcm2835_setup_restart();
 	if (wdt_regs)
-		pm_power_off = bcm2835_power_off;
+		register_poweroff_handler_simple(bcm2835_power_off, 0);
 
 	bcm2835_init_clocks();
 
arch/arm/mach-cns3xxx/cns3420vb.c +1 -1
index d863d87..136b7c6 100644
@@ -224,7 +224,7 @@ static void __init cns3420_init(void)
 	cns3xxx_ahci_init();
 	cns3xxx_sdhci_init();
 
-	pm_power_off = cns3xxx_power_off;
+	register_poweroff_handler_simple(cns3xxx_power_off, 128);
 }
 
 static struct map_desc cns3420_io_desc[] __initdata = {
arch/arm/mach-cns3xxx/core.c +1 -1
index f85449a..79e6ead 100644
@@ -386,7 +386,7 @@ static void __init cns3xxx_init(void)
 		cns3xxx_pwr_soft_rst(CNS3XXX_PWR_SOFTWARE_RST(SDIO));
 	}
 
-	pm_power_off = cns3xxx_power_off;
+	register_poweroff_handler_simple(cns3xxx_power_off, 128);
 
 	of_platform_populate(NULL, of_default_bus_match_table,
                         cns3xxx_auxdata, NULL);
arch/arm/mach-highbank/highbank.c +1 -1
index 8c35ae4..25d0134 100644
@@ -155,7 +155,7 @@ static void __init highbank_init(void)
 	sregs_base = of_iomap(np, 0);
 	WARN_ON(!sregs_base);
 
-	pm_power_off = highbank_power_off;
+	register_poweroff_handler_simple(highbank_power_off, 0);
 	highbank_pm_init();
 
 	bus_register_notifier(&platform_bus_type, &highbank_platform_nb);
arch/arm/mach-imx/mach-mx31moboard.c +1 -1
index bb6f8a5..9b3616f 100644
@@ -559,7 +559,7 @@ static void __init mx31moboard_init(void)
 
 	imx_add_platform_device("imx_mc13783", 0, NULL, 0, NULL, 0);
 
-	pm_power_off = mx31moboard_poweroff;
+	register_poweroff_handler_simple(mx31moboard_poweroff, 128);
 
 	switch (mx31moboard_baseboard) {
 	case MX31NOBOARD:
arch/arm/mach-iop32x/em7210.c +1 -1
index 77e1ff0..beeeb0c2 100644
@@ -201,7 +201,7 @@ static int __init em7210_request_gpios(void)
 		return 0;
 	}
 
-	pm_power_off = em7210_power_off;
+	register_poweroff_handler_simple(em7210_power_off, 128);
 
 	return 0;
 }
arch/arm/mach-iop32x/glantank.c +1 -1
index 547b234..050a8e6 100644
@@ -199,7 +199,7 @@ static void __init glantank_init_machine(void)
 	i2c_register_board_info(0, glantank_i2c_devices,
 		ARRAY_SIZE(glantank_i2c_devices));
 
-	pm_power_off = glantank_power_off;
+	register_poweroff_handler_simple(glantank_power_off, 128);
 }
 
 MACHINE_START(GLANTANK, "GLAN Tank")
arch/arm/mach-iop32x/iq31244.c +1 -1
index 0e1392b..4e9b972 100644
@@ -293,7 +293,7 @@ static void __init iq31244_init_machine(void)
 	platform_device_register(&iop3xx_dma_1_channel);
 
 	if (is_ep80219())
-		pm_power_off = ep80219_power_off;
+		register_poweroff_handler_simple(ep80219_power_off, 128);
 
 	if (!is_80219())
 		platform_device_register(&iop3xx_aau_channel);
arch/arm/mach-iop32x/n2100.c +1 -1
index c1cd80e..171d496 100644
@@ -356,7 +356,7 @@ static void __init n2100_init_machine(void)
 	i2c_register_board_info(0, n2100_i2c_devices,
 		ARRAY_SIZE(n2100_i2c_devices));
 
-	pm_power_off = n2100_power_off;
+	register_poweroff_handler_simple(n2100_power_off, 128);
 }
 
 MACHINE_START(N2100, "Thecus N2100")
arch/arm/mach-ixp4xx/dsmg600-setup.c +1 -1
index 43ee06d..6fb5072 100644
@@ -281,7 +281,7 @@ static void __init dsmg600_init(void)
 
 	platform_add_devices(dsmg600_devices, ARRAY_SIZE(dsmg600_devices));
 
-	pm_power_off = dsmg600_power_off;
+	register_poweroff_handler_simple(dsmg600_power_off, 128);
 }
 
 MACHINE_START(DSMG600, "D-Link DSM-G600 RevA")
arch/arm/mach-ixp4xx/nas100d-setup.c +1 -1
index 4e0f762..bd9a8d6 100644
@@ -292,7 +292,7 @@ static void __init nas100d_init(void)
 
 	platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
 
-	pm_power_off = nas100d_power_off;
+	register_poweroff_handler_simple(nas100d_power_off, 128);
 
 	if (request_irq(gpio_to_irq(NAS100D_RB_GPIO), &nas100d_reset_handler,
 		IRQF_TRIGGER_LOW, "NAS100D reset button", NULL) < 0) {
arch/arm/mach-ixp4xx/nslu2-setup.c +1 -1
index 88c025f..c4c5475 100644
@@ -262,7 +262,7 @@ static void __init nslu2_init(void)
 
 	platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices));
 
-	pm_power_off = nslu2_power_off;
+	register_poweroff_handler_simple(nslu2_power_off, 128);
 
 	if (request_irq(gpio_to_irq(NSLU2_RB_GPIO), &nslu2_reset_handler,
 		IRQF_TRIGGER_LOW, "NSLU2 reset button", NULL) < 0) {
arch/arm/mach-omap2/board-omap3touchbook.c +1 -1
index 70b904c..0c0a0e2 100644
@@ -344,7 +344,7 @@ static void __init omap3_touchbook_init(void)
 {
 	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
 
-	pm_power_off = omap3_touchbook_poweroff;
+	register_poweroff_handler_simple(omap3_touchbook_poweroff, 128);
 
 	if (system_rev >= 0x20 && system_rev <= 0x34301000) {
 		omap_mux_init_gpio(23, OMAP_PIN_INPUT);
arch/arm/mach-orion5x/board-mss2.c +1 -1
index 66f9c3b..3840d66 100644
@@ -86,5 +86,5 @@ static void mss2_power_off(void)
 void __init mss2_init(void)
 {
 	/* register mss2 specific power-off method */
-	pm_power_off = mss2_power_off;
+	register_poweroff_handler_simple(mss2_power_off, 0);
 }
arch/arm/mach-orion5x/dns323-setup.c +3 -3
index 56edeab..353ca3d 100644
@@ -669,7 +669,7 @@ static void __init dns323_init(void)
 		if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 ||
 		    gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0)
 			pr_err("DNS-323: failed to setup power-off GPIO\n");
-		pm_power_off = dns323a_power_off;
+		register_poweroff_handler_simple(dns323a_power_off, 128);
 		break;
 	case DNS323_REV_B1:
 		/* 5182 built-in SATA init */
@@ -686,7 +686,7 @@ static void __init dns323_init(void)
 		if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 ||
 		    gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0)
 			pr_err("DNS-323: failed to setup power-off GPIO\n");
-		pm_power_off = dns323b_power_off;
+		register_poweroff_handler_simple(dns323b_power_off, 128);
 		break;
 	case DNS323_REV_C1:
 		/* 5182 built-in SATA init */
@@ -696,7 +696,7 @@ static void __init dns323_init(void)
 		if (gpio_request(DNS323C_GPIO_POWER_OFF, "POWEROFF") != 0 ||
 		    gpio_direction_output(DNS323C_GPIO_POWER_OFF, 0) != 0)
 			pr_err("DNS-323: failed to setup power-off GPIO\n");
-		pm_power_off = dns323c_power_off;
+		register_poweroff_handler_simple(dns323c_power_off, 128);
 
 		/* Now, -this- should theorically be done by the sata_mv driver
 		 * once I figure out what's going on there. Maybe the behaviour
arch/arm/mach-orion5x/kurobox_pro-setup.c +1 -1
index fe6a48a..c4101f1 100644
@@ -376,7 +376,7 @@ static void __init kurobox_pro_init(void)
 	i2c_register_board_info(0, &kurobox_pro_i2c_rtc, 1);
 
 	/* register Kurobox Pro specific power-off method */
-	pm_power_off = kurobox_pro_power_off;
+	register_poweroff_handler_simple(kurobox_pro_power_off, 128);
 }
 
 #ifdef CONFIG_MACH_KUROBOX_PRO
arch/arm/mach-orion5x/ls-chl-setup.c +1 -1
index 028ea03..005bb04 100644
@@ -312,7 +312,7 @@ static void __init lschl_init(void)
 	gpio_set_value(LSCHL_GPIO_USB_POWER, 1);
 
 	/* register power-off method */
-	pm_power_off = lschl_power_off;
+	register_poweroff_handler_simple(lschl_power_off, 0);
 
 	pr_info("%s: finished\n", __func__);
 }
arch/arm/mach-orion5x/ls_hgl-setup.c +1 -1
index 32b7129..37c29a0 100644
@@ -259,7 +259,7 @@ static void __init ls_hgl_init(void)
 	gpio_set_value(LS_HGL_GPIO_USB_POWER, 1);
 
 	/* register power-off method */
-	pm_power_off = ls_hgl_power_off;
+	register_poweroff_handler_simple(ls_hgl_power_off, 0);
 
 	pr_info("%s: finished\n", __func__);
 }
arch/arm/mach-orion5x/lsmini-setup.c +1 -1
index a6493e7..ffec72f 100644
@@ -260,7 +260,7 @@ static void __init lsmini_init(void)
 	gpio_set_value(LSMINI_GPIO_USB_POWER, 1);
 
 	/* register power-off method */
-	pm_power_off = lsmini_power_off;
+	register_poweroff_handler_simple(lsmini_power_off, 0);
 
 	pr_info("%s: finished\n", __func__);
 }
arch/arm/mach-orion5x/mv2120-setup.c +1 -1
index e032f01..dadc2b9 100644
@@ -225,7 +225,7 @@ static void __init mv2120_init(void)
 	if (gpio_request(MV2120_GPIO_POWER_OFF, "POWEROFF") != 0 ||
 	    gpio_direction_output(MV2120_GPIO_POWER_OFF, 1) != 0)
 		pr_err("mv2120: failed to setup power-off GPIO\n");
-	pm_power_off = mv2120_power_off;
+	register_poweroff_handler_simple(mv2120_power_off, 128);
 }
 
 /* Warning: HP uses a wrong mach-type (=526) in their bootloader */
arch/arm/mach-orion5x/net2big-setup.c +1 -1
index ba73dc7..3a73dce 100644
@@ -413,7 +413,7 @@ static void __init net2big_init(void)
 
 	if (gpio_request(NET2BIG_GPIO_POWER_OFF, "power-off") == 0 &&
 	    gpio_direction_output(NET2BIG_GPIO_POWER_OFF, 0) == 0)
-		pm_power_off = net2big_power_off;
+		register_poweroff_handler_simple(net2big_power_off, 128);
 	else
 		pr_err("net2big: failed to configure power-off GPIO\n");
 
arch/arm/mach-orion5x/terastation_pro2-setup.c +1 -1
index 6208d12..2a234cb 100644
@@ -353,7 +353,7 @@ static void __init tsp2_init(void)
 	i2c_register_board_info(0, &tsp2_i2c_rtc, 1);
 
 	/* register Terastation Pro II specific power-off method */
-	pm_power_off = tsp2_power_off;
+	register_poweroff_handler_simple(tsp2_power_off, 128);
 }
 
 MACHINE_START(TERASTATION_PRO2, "Buffalo Terastation Pro II/Live")
arch/arm/mach-orion5x/ts209-setup.c +1 -1
index 9136797..50bdfbc 100644
@@ -318,7 +318,7 @@ static void __init qnap_ts209_init(void)
 	i2c_register_board_info(0, &qnap_ts209_i2c_rtc, 1);
 
 	/* register tsx09 specific power-off method */
-	pm_power_off = qnap_tsx09_power_off;
+	register_poweroff_handler_simple(qnap_tsx09_power_off, 128);
 }
 
 MACHINE_START(TS209, "QNAP TS-109/TS-209")
arch/arm/mach-orion5x/ts409-setup.c +1 -1
index 5c079d31..06a7cc0 100644
@@ -307,7 +307,7 @@ static void __init qnap_ts409_init(void)
 	platform_device_register(&ts409_leds);
 
 	/* register tsx09 specific power-off method */
-	pm_power_off = qnap_tsx09_power_off;
+	register_poweroff_handler_simple(qnap_tsx09_power_off, 128);
 }
 
 MACHINE_START(TS409, "QNAP TS-409")
arch/arm/mach-pxa/corgi.c +1 -1
index 06022b2..a93bac0 100644
@@ -718,7 +718,7 @@ static void corgi_restart(enum reboot_mode mode, const char *cmd)
 
 static void __init corgi_init(void)
 {
-	pm_power_off = corgi_poweroff;
+	register_poweroff_handler_simple(corgi_poweroff, 0);
 
 	/* Stop 3.6MHz and drive HIGH to PCMCIA and CS */
 	PCFR |= PCFR_OPDE;
arch/arm/mach-pxa/mioa701.c +1 -1
index 29997bd..c4345a4 100644
@@ -750,7 +750,7 @@ static void __init mioa701_machine_init(void)
 	pxa_set_keypad_info(&mioa701_keypad_info);
 	pxa_set_udc_info(&mioa701_udc_info);
 	pxa_set_ac97_info(&mioa701_ac97_info);
-	pm_power_off = mioa701_poweroff;
+	register_poweroff_handler_simple(mioa701_poweroff, 0);
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 	gsm_init();
 
arch/arm/mach-pxa/poodle.c +1 -1
index 1319916..c9536ed 100644
@@ -432,7 +432,7 @@ static void __init poodle_init(void)
 {
 	int ret = 0;
 
-	pm_power_off = poodle_poweroff;
+	register_poweroff_handler_simple(poodle_poweroff, 0);
 
 	PCFR |= PCFR_OPDE;
 
arch/arm/mach-pxa/spitz.c +1 -1
index 840c3a4..09f0de8 100644
@@ -944,7 +944,7 @@ static void spitz_restart(enum reboot_mode mode, const char *cmd)
 static void __init spitz_init(void)
 {
 	init_gpio_reset(SPITZ_GPIO_ON_RESET, 1, 0);
-	pm_power_off = spitz_poweroff;
+	register_poweroff_handler_simple(spitz_poweroff, 0);
 
 	PMCR = 0x00;
 
arch/arm/mach-pxa/tosa.c +1 -1
index c158a6e..3a4af1d 100644
@@ -940,7 +940,7 @@ static void __init tosa_init(void)
 
 	init_gpio_reset(TOSA_GPIO_ON_RESET, 0, 0);
 
-	pm_power_off = tosa_poweroff;
+	register_poweroff_handler_simple(tosa_poweroff, 0);
 
 	PCFR |= PCFR_OPDE;
 
arch/arm/mach-pxa/viper.c +1 -1
index de3b080..679c8ea 100644
@@ -919,7 +919,7 @@ static void __init viper_init(void)
 {
 	u8 version;
 
-	pm_power_off = viper_power_off;
+	register_poweroff_handler_simple(viper_power_off, 128);
 
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(viper_pin_config));
 
arch/arm/mach-pxa/z2.c +3 -3
index e1a121b..e0195ac 100644
@@ -693,8 +693,6 @@ static void z2_power_off(void)
 	pxa27x_set_pwrmode(PWRMODE_DEEPSLEEP);
 	pxa27x_cpu_pm_enter(PM_SUSPEND_MEM);
 }
-#else
-#define z2_power_off   NULL
 #endif
 
 /******************************************************************************
@@ -719,7 +717,9 @@ static void __init z2_init(void)
 	z2_keys_init();
 	z2_pmic_init();
 
-	pm_power_off = z2_power_off;
+#ifdef CONFIG_PM
+	register_poweroff_handler_simple(z2_power_off, 0);
+#endif
 }
 
 MACHINE_START(ZIPIT2, "Zipit Z2")
arch/arm/mach-pxa/zeus.c +3 -3
index 205f9bf..6118fd5 100644
@@ -690,8 +690,6 @@ static void zeus_power_off(void)
 	local_irq_disable();
 	cpu_suspend(PWRMODE_DEEPSLEEP, pxa27x_finish_suspend);
 }
-#else
-#define zeus_power_off   NULL
 #endif
 
 #ifdef CONFIG_APM_EMULATION
@@ -847,7 +845,9 @@ static void __init zeus_init(void)
 	__raw_writel(msc0, MSC0);
 	__raw_writel(msc1, MSC1);
 
-	pm_power_off = zeus_power_off;
+#ifdef CONFIG_PM
+	register_poweroff_handler_simple(zeus_power_off, 0);
+#endif
 	zeus_setup_apm();
 
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(zeus_pin_config));
arch/arm/mach-s3c24xx/mach-gta02.c +1 -1
index fc3a08d..ca78150 100644
@@ -579,7 +579,7 @@ static void __init gta02_machine_init(void)
 	i2c_register_board_info(0, gta02_i2c_devs, ARRAY_SIZE(gta02_i2c_devs));
 
 	platform_add_devices(gta02_devices, ARRAY_SIZE(gta02_devices));
-	pm_power_off = gta02_poweroff;
+	register_poweroff_handler_simple(gta02_poweroff, 128);
 
 	regulator_has_full_constraints();
 }
arch/arm/mach-s3c24xx/mach-jive.c +1 -1
index 7804d3c..5a828a3 100644
@@ -657,7 +657,7 @@ static void __init jive_machine_init(void)
 	s3c_i2c0_set_platdata(&jive_i2c_cfg);
 	i2c_register_board_info(0, jive_i2c_devs, ARRAY_SIZE(jive_i2c_devs));
 
-	pm_power_off = jive_power_off;
+	register_poweroff_handler_simple(jive_power_off, 128);
 
 	platform_add_devices(jive_devices, ARRAY_SIZE(jive_devices));
 }
arch/arm/mach-s3c24xx/mach-vr1000.c +1 -1
index f88c584..40d7655 100644
@@ -306,7 +306,7 @@ static void vr1000_power_off(void)
 
 static void __init vr1000_map_io(void)
 {
-	pm_power_off = vr1000_power_off;
+	register_poweroff_handler_simple(vr1000_power_off, 128);
 
 	s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc));
 	s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs));
arch/arm/mach-s3c64xx/mach-smartq.c +1 -1
index b3d1353..61f0893 100644
@@ -291,7 +291,7 @@ static int __init smartq_power_off_init(void)
 	/* leave power on */
 	gpio_direction_output(S3C64XX_GPK(15), 0);
 
-	pm_power_off = smartq_power_off;
+	register_poweroff_handler_simple(smartq_power_off, 128);
 
 	return ret;
 }
arch/arm/mach-sa1100/generic.c +1 -1
index d4ea142..6b839cf 100644
@@ -311,7 +311,7 @@ static struct platform_device *sa11x0_devices[] __initdata = {
 
 static int __init sa1100_init(void)
 {
-	pm_power_off = sa1100_power_off;
+	register_poweroff_handler_simple(sa1100_power_off, 0);
 	return platform_add_devices(sa11x0_devices, ARRAY_SIZE(sa11x0_devices));
 }
 
arch/arm/mach-sa1100/simpad.c +1 -1
index 41e476e..a65ca58 100644
@@ -373,7 +373,7 @@ static int __init simpad_init(void)
 	if (ret)
 		printk(KERN_WARNING "simpad: Unable to register cs3 GPIO device");
 
-	pm_power_off = simpad_power_off;
+	register_poweroff_handler_simple(simpad_power_off, 0);
 
 	sa11x0_ppc_configure_mcp();
 	sa11x0_register_mtd(&simpad_flash_data, simpad_flash_resources,
arch/arm/mach-u300/regulator.c +1 -1
index 0493a84..c98eb6e 100644
@@ -98,7 +98,7 @@ static int __init __u300_init_boardpower(struct platform_device *pdev)
 			   U300_SYSCON_PMCR_DCON_ENABLE, 0);
 
 	/* Register globally exported PM poweroff hook */
-	pm_power_off = u300_pm_poweroff;
+	register_poweroff_handler_simple(u300_pm_poweroff, 128);
 
 	return 0;
 }
arch/arm/mach-vt8500/vt8500.c +1 -1
index 2da7be3..515946b 100644
@@ -155,7 +155,7 @@ static void __init vt8500_init(void)
 			pr_err("%s:ioremap(power_off) failed\n", __func__);
 	}
 	if (pmc_base)
-		pm_power_off = &vt8500_power_off;
+		register_poweroff_handler_simple(vt8500_power_off, 0);
 	else
 		pr_err("%s: PMC Hibernation register could not be remapped, not enabling power off!\n", __func__);
 
arch/arm/xen/enlighten.c +1 -1
index 0e15f01..0da639b 100644
@@ -336,7 +336,7 @@ static int __init xen_pm_init(void)
 	if (!xen_domain())
 		return -ENODEV;
 
-	pm_power_off = xen_power_off;
+	register_poweroff_handler_simple(xen_power_off, 128);
 	arm_pm_restart = xen_restart;
 
 	return 0;
Signature · 1 line
Nicolas Ferre
author maintainer
#214 lore raw

PATCH 31/44 arm: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Always use register_poweroff_handler_simple as there is no indication that more than one poweroff handler is registered.

If the poweroff handler only resets the system or puts the CPU in sleep mode, select a priority of 0 to indicate that the poweroff handler is one of last resort. If the poweroff handler powers off the system, select a priority of 128.

Cc Russell King <[email protected]>
Cc Andrew Victor <[email protected]>
Cc Nicolas Ferre <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Christian Daudt <[email protected]>
Cc Matt Porter <[email protected]>
Cc Anton Vorontsov <[email protected]>
Cc Rob Herring <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Imre Kaloz <[email protected]>
Cc Krzysztof Halasa <[email protected]>
Cc Tony Lindgren <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Andrew Lunn <[email protected]>
Cc Sebastian Hesselbarth <[email protected]>
Cc Eric Miao <[email protected]>
Cc Haojian Zhuang <[email protected]>
Cc Robert Jarzmik <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Ben Dooks <[email protected]>
Cc Kukjin Kim <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Tony Prisk <[email protected]>
Cc Stefano Stabellini <[email protected]>
---
 arch/arm/kernel/psci.c                         | 2 +-
 arch/arm/mach-at91/board-gsia18s.c             | 2 +-
 arch/arm/mach-at91/setup.c                     | 4 ++--
 arch/arm/mach-bcm/board_bcm2835.c              | 2 +-
 arch/arm/mach-cns3xxx/cns3420vb.c              | 2 +-
 arch/arm/mach-cns3xxx/core.c                   | 2 +-
 arch/arm/mach-highbank/highbank.c              | 2 +-
 arch/arm/mach-imx/mach-mx31moboard.c           | 2 +-
 arch/arm/mach-iop32x/em7210.c                  | 2 +-
 arch/arm/mach-iop32x/glantank.c                | 2 +-
 arch/arm/mach-iop32x/iq31244.c                 | 2 +-
 arch/arm/mach-iop32x/n2100.c                   | 2 +-
 arch/arm/mach-ixp4xx/dsmg600-setup.c           | 2 +-
 arch/arm/mach-ixp4xx/nas100d-setup.c           | 2 +-
 arch/arm/mach-ixp4xx/nslu2-setup.c             | 2 +-
 arch/arm/mach-omap2/board-omap3touchbook.c     | 2 +-
 arch/arm/mach-orion5x/board-mss2.c             | 2 +-
 arch/arm/mach-orion5x/dns323-setup.c           | 6 +++---
 arch/arm/mach-orion5x/kurobox_pro-setup.c      | 2 +-
 arch/arm/mach-orion5x/ls-chl-setup.c           | 2 +-
 arch/arm/mach-orion5x/ls_hgl-setup.c           | 2 +-
 arch/arm/mach-orion5x/lsmini-setup.c           | 2 +-
 arch/arm/mach-orion5x/mv2120-setup.c           | 2 +-
 arch/arm/mach-orion5x/net2big-setup.c          | 2 +-
 arch/arm/mach-orion5x/terastation_pro2-setup.c | 2 +-
 arch/arm/mach-orion5x/ts209-setup.c            | 2 +-
 arch/arm/mach-orion5x/ts409-setup.c            | 2 +-
 arch/arm/mach-pxa/corgi.c                      | 2 +-
 arch/arm/mach-pxa/mioa701.c                    | 2 +-
 arch/arm/mach-pxa/poodle.c                     | 2 +-
 arch/arm/mach-pxa/spitz.c                      | 2 +-
 arch/arm/mach-pxa/tosa.c                       | 2 +-
 arch/arm/mach-pxa/viper.c                      | 2 +-
 arch/arm/mach-pxa/z2.c                         | 6 +++---
 arch/arm/mach-pxa/zeus.c                       | 6 +++---
 arch/arm/mach-s3c24xx/mach-gta02.c             | 2 +-
 arch/arm/mach-s3c24xx/mach-jive.c              | 2 +-
 arch/arm/mach-s3c24xx/mach-vr1000.c            | 2 +-
 arch/arm/mach-s3c64xx/mach-smartq.c            | 2 +-
 arch/arm/mach-sa1100/generic.c                 | 2 +-
 arch/arm/mach-sa1100/simpad.c                  | 2 +-
 arch/arm/mach-u300/regulator.c                 | 2 +-
 arch/arm/mach-vt8500/vt8500.c                  | 2 +-
 arch/arm/xen/enlighten.c                       | 2 +-
 44 files changed, 51 insertions(+), 51 deletions(-)
arch/arm/kernel/psci.c +1 -1
index f73891b..dd58d86 100644
@@ -264,7 +264,7 @@ static int psci_0_2_init(struct device_node *np)
 
 	arm_pm_restart = psci_sys_reset;
 
-	pm_power_off = psci_sys_poweroff;
+	register_poweroff_handler_simple(psci_sys_poweroff, 128);
 
 out_put_node:
 	of_node_put(np);
arch/arm/mach-at91/board-gsia18s.c +1 -1
index b729dd1..6722e66 100644
@@ -521,7 +521,7 @@ static void gsia18s_power_off(void)
 
 static int __init gsia18s_power_off_init(void)
 {
-	pm_power_off = gsia18s_power_off;
+	register_poweroff_handler_simple(gsia18s_power_off, 128);
 	return 0;
 }
 
arch/arm/mach-at91/setup.c +2 -2
index f7a07a5..9989e88 100644
@@ -329,7 +329,7 @@ void __init at91_ioremap_shdwc(u32 base_addr)
 	at91_shdwc_base = ioremap(base_addr, 16);
 	if (!at91_shdwc_base)
 		panic("Impossible to ioremap at91_shdwc_base\n");
-	pm_power_off = at91sam9_poweroff;
+	register_poweroff_handler_simple(at91sam9_poweroff, 128);
 }
 
 void __iomem *at91_rstc_base;
@@ -482,7 +482,7 @@ static void at91_dt_shdwc(void)
 	at91_shdwc_write(AT91_SHDW_MR, wakeup_mode | mode);
 
 end:
-	pm_power_off = at91sam9_poweroff;
+	register_poweroff_handler_simple(at91sam9_poweroff, 128);
 
 	of_node_put(np);
 }
arch/arm/mach-bcm/board_bcm2835.c +1 -1
index 70f2f39..7d5784f 100644
@@ -111,7 +111,7 @@ static void __init bcm2835_init(void)
 
 	bcm2835_setup_restart();
 	if (wdt_regs)
-		pm_power_off = bcm2835_power_off;
+		register_poweroff_handler_simple(bcm2835_power_off, 0);
 
 	bcm2835_init_clocks();
 
arch/arm/mach-cns3xxx/cns3420vb.c +1 -1
index d863d87..136b7c6 100644
@@ -224,7 +224,7 @@ static void __init cns3420_init(void)
 	cns3xxx_ahci_init();
 	cns3xxx_sdhci_init();
 
-	pm_power_off = cns3xxx_power_off;
+	register_poweroff_handler_simple(cns3xxx_power_off, 128);
 }
 
 static struct map_desc cns3420_io_desc[] __initdata = {
arch/arm/mach-cns3xxx/core.c +1 -1
index f85449a..79e6ead 100644
@@ -386,7 +386,7 @@ static void __init cns3xxx_init(void)
 		cns3xxx_pwr_soft_rst(CNS3XXX_PWR_SOFTWARE_RST(SDIO));
 	}
 
-	pm_power_off = cns3xxx_power_off;
+	register_poweroff_handler_simple(cns3xxx_power_off, 128);
 
 	of_platform_populate(NULL, of_default_bus_match_table,
                         cns3xxx_auxdata, NULL);
arch/arm/mach-highbank/highbank.c +1 -1
index 8c35ae4..25d0134 100644
@@ -155,7 +155,7 @@ static void __init highbank_init(void)
 	sregs_base = of_iomap(np, 0);
 	WARN_ON(!sregs_base);
 
-	pm_power_off = highbank_power_off;
+	register_poweroff_handler_simple(highbank_power_off, 0);
 	highbank_pm_init();
 
 	bus_register_notifier(&platform_bus_type, &highbank_platform_nb);
arch/arm/mach-imx/mach-mx31moboard.c +1 -1
index bb6f8a5..9b3616f 100644
@@ -559,7 +559,7 @@ static void __init mx31moboard_init(void)
 
 	imx_add_platform_device("imx_mc13783", 0, NULL, 0, NULL, 0);
 
-	pm_power_off = mx31moboard_poweroff;
+	register_poweroff_handler_simple(mx31moboard_poweroff, 128);
 
 	switch (mx31moboard_baseboard) {
 	case MX31NOBOARD:
arch/arm/mach-iop32x/em7210.c +1 -1
index 77e1ff0..beeeb0c2 100644
@@ -201,7 +201,7 @@ static int __init em7210_request_gpios(void)
 		return 0;
 	}
 
-	pm_power_off = em7210_power_off;
+	register_poweroff_handler_simple(em7210_power_off, 128);
 
 	return 0;
 }
arch/arm/mach-iop32x/glantank.c +1 -1
index 547b234..050a8e6 100644
@@ -199,7 +199,7 @@ static void __init glantank_init_machine(void)
 	i2c_register_board_info(0, glantank_i2c_devices,
 		ARRAY_SIZE(glantank_i2c_devices));
 
-	pm_power_off = glantank_power_off;
+	register_poweroff_handler_simple(glantank_power_off, 128);
 }
 
 MACHINE_START(GLANTANK, "GLAN Tank")
arch/arm/mach-iop32x/iq31244.c +1 -1
index 0e1392b..4e9b972 100644
@@ -293,7 +293,7 @@ static void __init iq31244_init_machine(void)
 	platform_device_register(&iop3xx_dma_1_channel);
 
 	if (is_ep80219())
-		pm_power_off = ep80219_power_off;
+		register_poweroff_handler_simple(ep80219_power_off, 128);
 
 	if (!is_80219())
 		platform_device_register(&iop3xx_aau_channel);
arch/arm/mach-iop32x/n2100.c +1 -1
index c1cd80e..171d496 100644
@@ -356,7 +356,7 @@ static void __init n2100_init_machine(void)
 	i2c_register_board_info(0, n2100_i2c_devices,
 		ARRAY_SIZE(n2100_i2c_devices));
 
-	pm_power_off = n2100_power_off;
+	register_poweroff_handler_simple(n2100_power_off, 128);
 }
 
 MACHINE_START(N2100, "Thecus N2100")
arch/arm/mach-ixp4xx/dsmg600-setup.c +1 -1
index 43ee06d..6fb5072 100644
@@ -281,7 +281,7 @@ static void __init dsmg600_init(void)
 
 	platform_add_devices(dsmg600_devices, ARRAY_SIZE(dsmg600_devices));
 
-	pm_power_off = dsmg600_power_off;
+	register_poweroff_handler_simple(dsmg600_power_off, 128);
 }
 
 MACHINE_START(DSMG600, "D-Link DSM-G600 RevA")
arch/arm/mach-ixp4xx/nas100d-setup.c +1 -1
index 4e0f762..bd9a8d6 100644
@@ -292,7 +292,7 @@ static void __init nas100d_init(void)
 
 	platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
 
-	pm_power_off = nas100d_power_off;
+	register_poweroff_handler_simple(nas100d_power_off, 128);
 
 	if (request_irq(gpio_to_irq(NAS100D_RB_GPIO), &nas100d_reset_handler,
 		IRQF_TRIGGER_LOW, "NAS100D reset button", NULL) < 0) {
arch/arm/mach-ixp4xx/nslu2-setup.c +1 -1
index 88c025f..c4c5475 100644
@@ -262,7 +262,7 @@ static void __init nslu2_init(void)
 
 	platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices));
 
-	pm_power_off = nslu2_power_off;
+	register_poweroff_handler_simple(nslu2_power_off, 128);
 
 	if (request_irq(gpio_to_irq(NSLU2_RB_GPIO), &nslu2_reset_handler,
 		IRQF_TRIGGER_LOW, "NSLU2 reset button", NULL) < 0) {
arch/arm/mach-omap2/board-omap3touchbook.c +1 -1
index 70b904c..0c0a0e2 100644
@@ -344,7 +344,7 @@ static void __init omap3_touchbook_init(void)
 {
 	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
 
-	pm_power_off = omap3_touchbook_poweroff;
+	register_poweroff_handler_simple(omap3_touchbook_poweroff, 128);
 
 	if (system_rev >= 0x20 && system_rev <= 0x34301000) {
 		omap_mux_init_gpio(23, OMAP_PIN_INPUT);
arch/arm/mach-orion5x/board-mss2.c +1 -1
index 66f9c3b..3840d66 100644
@@ -86,5 +86,5 @@ static void mss2_power_off(void)
 void __init mss2_init(void)
 {
 	/* register mss2 specific power-off method */
-	pm_power_off = mss2_power_off;
+	register_poweroff_handler_simple(mss2_power_off, 0);
 }
arch/arm/mach-orion5x/dns323-setup.c +3 -3
index 56edeab..353ca3d 100644
@@ -669,7 +669,7 @@ static void __init dns323_init(void)
 		if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 ||
 		    gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0)
 			pr_err("DNS-323: failed to setup power-off GPIO\n");
-		pm_power_off = dns323a_power_off;
+		register_poweroff_handler_simple(dns323a_power_off, 128);
 		break;
 	case DNS323_REV_B1:
 		/* 5182 built-in SATA init */
@@ -686,7 +686,7 @@ static void __init dns323_init(void)
 		if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 ||
 		    gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0)
 			pr_err("DNS-323: failed to setup power-off GPIO\n");
-		pm_power_off = dns323b_power_off;
+		register_poweroff_handler_simple(dns323b_power_off, 128);
 		break;
 	case DNS323_REV_C1:
 		/* 5182 built-in SATA init */
@@ -696,7 +696,7 @@ static void __init dns323_init(void)
 		if (gpio_request(DNS323C_GPIO_POWER_OFF, "POWEROFF") != 0 ||
 		    gpio_direction_output(DNS323C_GPIO_POWER_OFF, 0) != 0)
 			pr_err("DNS-323: failed to setup power-off GPIO\n");
-		pm_power_off = dns323c_power_off;
+		register_poweroff_handler_simple(dns323c_power_off, 128);
 
 		/* Now, -this- should theorically be done by the sata_mv driver
 		 * once I figure out what's going on there. Maybe the behaviour
arch/arm/mach-orion5x/kurobox_pro-setup.c +1 -1
index fe6a48a..c4101f1 100644
@@ -376,7 +376,7 @@ static void __init kurobox_pro_init(void)
 	i2c_register_board_info(0, &kurobox_pro_i2c_rtc, 1);
 
 	/* register Kurobox Pro specific power-off method */
-	pm_power_off = kurobox_pro_power_off;
+	register_poweroff_handler_simple(kurobox_pro_power_off, 128);
 }
 
 #ifdef CONFIG_MACH_KUROBOX_PRO
arch/arm/mach-orion5x/ls-chl-setup.c +1 -1
index 028ea03..005bb04 100644
@@ -312,7 +312,7 @@ static void __init lschl_init(void)
 	gpio_set_value(LSCHL_GPIO_USB_POWER, 1);
 
 	/* register power-off method */
-	pm_power_off = lschl_power_off;
+	register_poweroff_handler_simple(lschl_power_off, 0);
 
 	pr_info("%s: finished\n", __func__);
 }
arch/arm/mach-orion5x/ls_hgl-setup.c +1 -1
index 32b7129..37c29a0 100644
@@ -259,7 +259,7 @@ static void __init ls_hgl_init(void)
 	gpio_set_value(LS_HGL_GPIO_USB_POWER, 1);
 
 	/* register power-off method */
-	pm_power_off = ls_hgl_power_off;
+	register_poweroff_handler_simple(ls_hgl_power_off, 0);
 
 	pr_info("%s: finished\n", __func__);
 }
arch/arm/mach-orion5x/lsmini-setup.c +1 -1
index a6493e7..ffec72f 100644
@@ -260,7 +260,7 @@ static void __init lsmini_init(void)
 	gpio_set_value(LSMINI_GPIO_USB_POWER, 1);
 
 	/* register power-off method */
-	pm_power_off = lsmini_power_off;
+	register_poweroff_handler_simple(lsmini_power_off, 0);
 
 	pr_info("%s: finished\n", __func__);
 }
arch/arm/mach-orion5x/mv2120-setup.c +1 -1
index e032f01..dadc2b9 100644
@@ -225,7 +225,7 @@ static void __init mv2120_init(void)
 	if (gpio_request(MV2120_GPIO_POWER_OFF, "POWEROFF") != 0 ||
 	    gpio_direction_output(MV2120_GPIO_POWER_OFF, 1) != 0)
 		pr_err("mv2120: failed to setup power-off GPIO\n");
-	pm_power_off = mv2120_power_off;
+	register_poweroff_handler_simple(mv2120_power_off, 128);
 }
 
 /* Warning: HP uses a wrong mach-type (=526) in their bootloader */
arch/arm/mach-orion5x/net2big-setup.c +1 -1
index ba73dc7..3a73dce 100644
@@ -413,7 +413,7 @@ static void __init net2big_init(void)
 
 	if (gpio_request(NET2BIG_GPIO_POWER_OFF, "power-off") == 0 &&
 	    gpio_direction_output(NET2BIG_GPIO_POWER_OFF, 0) == 0)
-		pm_power_off = net2big_power_off;
+		register_poweroff_handler_simple(net2big_power_off, 128);
 	else
 		pr_err("net2big: failed to configure power-off GPIO\n");
 
arch/arm/mach-orion5x/terastation_pro2-setup.c +1 -1
index 6208d12..2a234cb 100644
@@ -353,7 +353,7 @@ static void __init tsp2_init(void)
 	i2c_register_board_info(0, &tsp2_i2c_rtc, 1);
 
 	/* register Terastation Pro II specific power-off method */
-	pm_power_off = tsp2_power_off;
+	register_poweroff_handler_simple(tsp2_power_off, 128);
 }
 
 MACHINE_START(TERASTATION_PRO2, "Buffalo Terastation Pro II/Live")
arch/arm/mach-orion5x/ts209-setup.c +1 -1
index 9136797..50bdfbc 100644
@@ -318,7 +318,7 @@ static void __init qnap_ts209_init(void)
 	i2c_register_board_info(0, &qnap_ts209_i2c_rtc, 1);
 
 	/* register tsx09 specific power-off method */
-	pm_power_off = qnap_tsx09_power_off;
+	register_poweroff_handler_simple(qnap_tsx09_power_off, 128);
 }
 
 MACHINE_START(TS209, "QNAP TS-109/TS-209")
arch/arm/mach-orion5x/ts409-setup.c +1 -1
index 5c079d31..06a7cc0 100644
@@ -307,7 +307,7 @@ static void __init qnap_ts409_init(void)
 	platform_device_register(&ts409_leds);
 
 	/* register tsx09 specific power-off method */
-	pm_power_off = qnap_tsx09_power_off;
+	register_poweroff_handler_simple(qnap_tsx09_power_off, 128);
 }
 
 MACHINE_START(TS409, "QNAP TS-409")
arch/arm/mach-pxa/corgi.c +1 -1
index 06022b2..a93bac0 100644
@@ -718,7 +718,7 @@ static void corgi_restart(enum reboot_mode mode, const char *cmd)
 
 static void __init corgi_init(void)
 {
-	pm_power_off = corgi_poweroff;
+	register_poweroff_handler_simple(corgi_poweroff, 0);
 
 	/* Stop 3.6MHz and drive HIGH to PCMCIA and CS */
 	PCFR |= PCFR_OPDE;
arch/arm/mach-pxa/mioa701.c +1 -1
index 29997bd..c4345a4 100644
@@ -750,7 +750,7 @@ static void __init mioa701_machine_init(void)
 	pxa_set_keypad_info(&mioa701_keypad_info);
 	pxa_set_udc_info(&mioa701_udc_info);
 	pxa_set_ac97_info(&mioa701_ac97_info);
-	pm_power_off = mioa701_poweroff;
+	register_poweroff_handler_simple(mioa701_poweroff, 0);
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 	gsm_init();
 
arch/arm/mach-pxa/poodle.c +1 -1
index 1319916..c9536ed 100644
@@ -432,7 +432,7 @@ static void __init poodle_init(void)
 {
 	int ret = 0;
 
-	pm_power_off = poodle_poweroff;
+	register_poweroff_handler_simple(poodle_poweroff, 0);
 
 	PCFR |= PCFR_OPDE;
 
arch/arm/mach-pxa/spitz.c +1 -1
index 840c3a4..09f0de8 100644
@@ -944,7 +944,7 @@ static void spitz_restart(enum reboot_mode mode, const char *cmd)
 static void __init spitz_init(void)
 {
 	init_gpio_reset(SPITZ_GPIO_ON_RESET, 1, 0);
-	pm_power_off = spitz_poweroff;
+	register_poweroff_handler_simple(spitz_poweroff, 0);
 
 	PMCR = 0x00;
 
arch/arm/mach-pxa/tosa.c +1 -1
index c158a6e..3a4af1d 100644
@@ -940,7 +940,7 @@ static void __init tosa_init(void)
 
 	init_gpio_reset(TOSA_GPIO_ON_RESET, 0, 0);
 
-	pm_power_off = tosa_poweroff;
+	register_poweroff_handler_simple(tosa_poweroff, 0);
 
 	PCFR |= PCFR_OPDE;
 
arch/arm/mach-pxa/viper.c +1 -1
index de3b080..679c8ea 100644
@@ -919,7 +919,7 @@ static void __init viper_init(void)
 {
 	u8 version;
 
-	pm_power_off = viper_power_off;
+	register_poweroff_handler_simple(viper_power_off, 128);
 
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(viper_pin_config));
 
arch/arm/mach-pxa/z2.c +3 -3
index e1a121b..e0195ac 100644
@@ -693,8 +693,6 @@ static void z2_power_off(void)
 	pxa27x_set_pwrmode(PWRMODE_DEEPSLEEP);
 	pxa27x_cpu_pm_enter(PM_SUSPEND_MEM);
 }
-#else
-#define z2_power_off   NULL
 #endif
 
 /******************************************************************************
@@ -719,7 +717,9 @@ static void __init z2_init(void)
 	z2_keys_init();
 	z2_pmic_init();
 
-	pm_power_off = z2_power_off;
+#ifdef CONFIG_PM
+	register_poweroff_handler_simple(z2_power_off, 0);
+#endif
 }
 
 MACHINE_START(ZIPIT2, "Zipit Z2")
arch/arm/mach-pxa/zeus.c +3 -3
index 205f9bf..6118fd5 100644
@@ -690,8 +690,6 @@ static void zeus_power_off(void)
 	local_irq_disable();
 	cpu_suspend(PWRMODE_DEEPSLEEP, pxa27x_finish_suspend);
 }
-#else
-#define zeus_power_off   NULL
 #endif
 
 #ifdef CONFIG_APM_EMULATION
@@ -847,7 +845,9 @@ static void __init zeus_init(void)
 	__raw_writel(msc0, MSC0);
 	__raw_writel(msc1, MSC1);
 
-	pm_power_off = zeus_power_off;
+#ifdef CONFIG_PM
+	register_poweroff_handler_simple(zeus_power_off, 0);
+#endif
 	zeus_setup_apm();
 
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(zeus_pin_config));
arch/arm/mach-s3c24xx/mach-gta02.c +1 -1
index fc3a08d..ca78150 100644
@@ -579,7 +579,7 @@ static void __init gta02_machine_init(void)
 	i2c_register_board_info(0, gta02_i2c_devs, ARRAY_SIZE(gta02_i2c_devs));
 
 	platform_add_devices(gta02_devices, ARRAY_SIZE(gta02_devices));
-	pm_power_off = gta02_poweroff;
+	register_poweroff_handler_simple(gta02_poweroff, 128);
 
 	regulator_has_full_constraints();
 }
arch/arm/mach-s3c24xx/mach-jive.c +1 -1
index 7804d3c..5a828a3 100644
@@ -657,7 +657,7 @@ static void __init jive_machine_init(void)
 	s3c_i2c0_set_platdata(&jive_i2c_cfg);
 	i2c_register_board_info(0, jive_i2c_devs, ARRAY_SIZE(jive_i2c_devs));
 
-	pm_power_off = jive_power_off;
+	register_poweroff_handler_simple(jive_power_off, 128);
 
 	platform_add_devices(jive_devices, ARRAY_SIZE(jive_devices));
 }
arch/arm/mach-s3c24xx/mach-vr1000.c +1 -1
index f88c584..40d7655 100644
@@ -306,7 +306,7 @@ static void vr1000_power_off(void)
 
 static void __init vr1000_map_io(void)
 {
-	pm_power_off = vr1000_power_off;
+	register_poweroff_handler_simple(vr1000_power_off, 128);
 
 	s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc));
 	s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs));
arch/arm/mach-s3c64xx/mach-smartq.c +1 -1
index b3d1353..61f0893 100644
@@ -291,7 +291,7 @@ static int __init smartq_power_off_init(void)
 	/* leave power on */
 	gpio_direction_output(S3C64XX_GPK(15), 0);
 
-	pm_power_off = smartq_power_off;
+	register_poweroff_handler_simple(smartq_power_off, 128);
 
 	return ret;
 }
arch/arm/mach-sa1100/generic.c +1 -1
index d4ea142..6b839cf 100644
@@ -311,7 +311,7 @@ static struct platform_device *sa11x0_devices[] __initdata = {
 
 static int __init sa1100_init(void)
 {
-	pm_power_off = sa1100_power_off;
+	register_poweroff_handler_simple(sa1100_power_off, 0);
 	return platform_add_devices(sa11x0_devices, ARRAY_SIZE(sa11x0_devices));
 }
 
arch/arm/mach-sa1100/simpad.c +1 -1
index 41e476e..a65ca58 100644
@@ -373,7 +373,7 @@ static int __init simpad_init(void)
 	if (ret)
 		printk(KERN_WARNING "simpad: Unable to register cs3 GPIO device");
 
-	pm_power_off = simpad_power_off;
+	register_poweroff_handler_simple(simpad_power_off, 0);
 
 	sa11x0_ppc_configure_mcp();
 	sa11x0_register_mtd(&simpad_flash_data, simpad_flash_resources,
arch/arm/mach-u300/regulator.c +1 -1
index 0493a84..c98eb6e 100644
@@ -98,7 +98,7 @@ static int __init __u300_init_boardpower(struct platform_device *pdev)
 			   U300_SYSCON_PMCR_DCON_ENABLE, 0);
 
 	/* Register globally exported PM poweroff hook */
-	pm_power_off = u300_pm_poweroff;
+	register_poweroff_handler_simple(u300_pm_poweroff, 128);
 
 	return 0;
 }
arch/arm/mach-vt8500/vt8500.c +1 -1
index 2da7be3..515946b 100644
@@ -155,7 +155,7 @@ static void __init vt8500_init(void)
 			pr_err("%s:ioremap(power_off) failed\n", __func__);
 	}
 	if (pmc_base)
-		pm_power_off = &vt8500_power_off;
+		register_poweroff_handler_simple(vt8500_power_off, 0);
 	else
 		pr_err("%s: PMC Hibernation register could not be remapped, not enabling power off!\n", __func__);
 
arch/arm/xen/enlighten.c +1 -1
index 0e15f01..0da639b 100644
@@ -336,7 +336,7 @@ static int __init xen_pm_init(void)
 	if (!xen_domain())
 		return -ENODEV;
 
-	pm_power_off = xen_power_off;
+	register_poweroff_handler_simple(xen_power_off, 128);
 	arm_pm_restart = xen_restart;
 
 	return 0;
Signature · 1 line
1.9.1
author maintainer
#215 lore raw

PATCH 31/44 arm: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Always use register_poweroff_handler_simple as there is no indication that more than one poweroff handler is registered.

If the poweroff handler only resets the system or puts the CPU in sleep mode, select a priority of 0 to indicate that the poweroff handler is one of last resort. If the poweroff handler powers off the system, select a priority of 128.

Cc Russell King <[email protected]>
Cc Andrew Victor <[email protected]>
Cc Nicolas Ferre <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Christian Daudt <[email protected]>
Cc Matt Porter <[email protected]>
Cc Anton Vorontsov <[email protected]>
Cc Rob Herring <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Imre Kaloz <[email protected]>
Cc Krzysztof Halasa <[email protected]>
Cc Tony Lindgren <[email protected]>
Cc Jason Cooper <[email protected]>
Cc Andrew Lunn <[email protected]>
Cc Sebastian Hesselbarth <[email protected]>
Cc Eric Miao <[email protected]>
Cc Haojian Zhuang <[email protected]>
Cc Robert Jarzmik <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Ben Dooks <[email protected]>
Cc Kukjin Kim <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Tony Prisk <[email protected]>
Cc Stefano Stabellini <[email protected]>
---
 arch/arm/kernel/psci.c                         | 2 +-
 arch/arm/mach-at91/board-gsia18s.c             | 2 +-
 arch/arm/mach-at91/setup.c                     | 4 ++--
 arch/arm/mach-bcm/board_bcm2835.c              | 2 +-
 arch/arm/mach-cns3xxx/cns3420vb.c              | 2 +-
 arch/arm/mach-cns3xxx/core.c                   | 2 +-
 arch/arm/mach-highbank/highbank.c              | 2 +-
 arch/arm/mach-imx/mach-mx31moboard.c           | 2 +-
 arch/arm/mach-iop32x/em7210.c                  | 2 +-
 arch/arm/mach-iop32x/glantank.c                | 2 +-
 arch/arm/mach-iop32x/iq31244.c                 | 2 +-
 arch/arm/mach-iop32x/n2100.c                   | 2 +-
 arch/arm/mach-ixp4xx/dsmg600-setup.c           | 2 +-
 arch/arm/mach-ixp4xx/nas100d-setup.c           | 2 +-
 arch/arm/mach-ixp4xx/nslu2-setup.c             | 2 +-
 arch/arm/mach-omap2/board-omap3touchbook.c     | 2 +-
 arch/arm/mach-orion5x/board-mss2.c             | 2 +-
 arch/arm/mach-orion5x/dns323-setup.c           | 6 +++---
 arch/arm/mach-orion5x/kurobox_pro-setup.c      | 2 +-
 arch/arm/mach-orion5x/ls-chl-setup.c           | 2 +-
 arch/arm/mach-orion5x/ls_hgl-setup.c           | 2 +-
 arch/arm/mach-orion5x/lsmini-setup.c           | 2 +-
 arch/arm/mach-orion5x/mv2120-setup.c           | 2 +-
 arch/arm/mach-orion5x/net2big-setup.c          | 2 +-
 arch/arm/mach-orion5x/terastation_pro2-setup.c | 2 +-
 arch/arm/mach-orion5x/ts209-setup.c            | 2 +-
 arch/arm/mach-orion5x/ts409-setup.c            | 2 +-
 arch/arm/mach-pxa/corgi.c                      | 2 +-
 arch/arm/mach-pxa/mioa701.c                    | 2 +-
 arch/arm/mach-pxa/poodle.c                     | 2 +-
 arch/arm/mach-pxa/spitz.c                      | 2 +-
 arch/arm/mach-pxa/tosa.c                       | 2 +-
 arch/arm/mach-pxa/viper.c                      | 2 +-
 arch/arm/mach-pxa/z2.c                         | 6 +++---
 arch/arm/mach-pxa/zeus.c                       | 6 +++---
 arch/arm/mach-s3c24xx/mach-gta02.c             | 2 +-
 arch/arm/mach-s3c24xx/mach-jive.c              | 2 +-
 arch/arm/mach-s3c24xx/mach-vr1000.c            | 2 +-
 arch/arm/mach-s3c64xx/mach-smartq.c            | 2 +-
 arch/arm/mach-sa1100/generic.c                 | 2 +-
 arch/arm/mach-sa1100/simpad.c                  | 2 +-
 arch/arm/mach-u300/regulator.c                 | 2 +-
 arch/arm/mach-vt8500/vt8500.c                  | 2 +-
 arch/arm/xen/enlighten.c                       | 2 +-
 44 files changed, 51 insertions(+), 51 deletions(-)
arch/arm/kernel/psci.c +1 -1
index f73891b..dd58d86 100644
@@ -264,7 +264,7 @@ static int psci_0_2_init(struct device_node *np)
 
 	arm_pm_restart = psci_sys_reset;
 
-	pm_power_off = psci_sys_poweroff;
+	register_poweroff_handler_simple(psci_sys_poweroff, 128);
 
 out_put_node:
 	of_node_put(np);
arch/arm/mach-at91/board-gsia18s.c +1 -1
index b729dd1..6722e66 100644
@@ -521,7 +521,7 @@ static void gsia18s_power_off(void)
 
 static int __init gsia18s_power_off_init(void)
 {
-	pm_power_off = gsia18s_power_off;
+	register_poweroff_handler_simple(gsia18s_power_off, 128);
 	return 0;
 }
 
arch/arm/mach-at91/setup.c +2 -2
index f7a07a5..9989e88 100644
@@ -329,7 +329,7 @@ void __init at91_ioremap_shdwc(u32 base_addr)
 	at91_shdwc_base = ioremap(base_addr, 16);
 	if (!at91_shdwc_base)
 		panic("Impossible to ioremap at91_shdwc_base\n");
-	pm_power_off = at91sam9_poweroff;
+	register_poweroff_handler_simple(at91sam9_poweroff, 128);
 }
 
 void __iomem *at91_rstc_base;
@@ -482,7 +482,7 @@ static void at91_dt_shdwc(void)
 	at91_shdwc_write(AT91_SHDW_MR, wakeup_mode | mode);
 
 end:
-	pm_power_off = at91sam9_poweroff;
+	register_poweroff_handler_simple(at91sam9_poweroff, 128);
 
 	of_node_put(np);
 }
arch/arm/mach-bcm/board_bcm2835.c +1 -1
index 70f2f39..7d5784f 100644
@@ -111,7 +111,7 @@ static void __init bcm2835_init(void)
 
 	bcm2835_setup_restart();
 	if (wdt_regs)
-		pm_power_off = bcm2835_power_off;
+		register_poweroff_handler_simple(bcm2835_power_off, 0);
 
 	bcm2835_init_clocks();
 
arch/arm/mach-cns3xxx/cns3420vb.c +1 -1
index d863d87..136b7c6 100644
@@ -224,7 +224,7 @@ static void __init cns3420_init(void)
 	cns3xxx_ahci_init();
 	cns3xxx_sdhci_init();
 
-	pm_power_off = cns3xxx_power_off;
+	register_poweroff_handler_simple(cns3xxx_power_off, 128);
 }
 
 static struct map_desc cns3420_io_desc[] __initdata = {
arch/arm/mach-cns3xxx/core.c +1 -1
index f85449a..79e6ead 100644
@@ -386,7 +386,7 @@ static void __init cns3xxx_init(void)
 		cns3xxx_pwr_soft_rst(CNS3XXX_PWR_SOFTWARE_RST(SDIO));
 	}
 
-	pm_power_off = cns3xxx_power_off;
+	register_poweroff_handler_simple(cns3xxx_power_off, 128);
 
 	of_platform_populate(NULL, of_default_bus_match_table,
                         cns3xxx_auxdata, NULL);
arch/arm/mach-highbank/highbank.c +1 -1
index 8c35ae4..25d0134 100644
@@ -155,7 +155,7 @@ static void __init highbank_init(void)
 	sregs_base = of_iomap(np, 0);
 	WARN_ON(!sregs_base);
 
-	pm_power_off = highbank_power_off;
+	register_poweroff_handler_simple(highbank_power_off, 0);
 	highbank_pm_init();
 
 	bus_register_notifier(&platform_bus_type, &highbank_platform_nb);
arch/arm/mach-imx/mach-mx31moboard.c +1 -1
index bb6f8a5..9b3616f 100644
@@ -559,7 +559,7 @@ static void __init mx31moboard_init(void)
 
 	imx_add_platform_device("imx_mc13783", 0, NULL, 0, NULL, 0);
 
-	pm_power_off = mx31moboard_poweroff;
+	register_poweroff_handler_simple(mx31moboard_poweroff, 128);
 
 	switch (mx31moboard_baseboard) {
 	case MX31NOBOARD:
arch/arm/mach-iop32x/em7210.c +1 -1
index 77e1ff0..beeeb0c2 100644
@@ -201,7 +201,7 @@ static int __init em7210_request_gpios(void)
 		return 0;
 	}
 
-	pm_power_off = em7210_power_off;
+	register_poweroff_handler_simple(em7210_power_off, 128);
 
 	return 0;
 }
arch/arm/mach-iop32x/glantank.c +1 -1
index 547b234..050a8e6 100644
@@ -199,7 +199,7 @@ static void __init glantank_init_machine(void)
 	i2c_register_board_info(0, glantank_i2c_devices,
 		ARRAY_SIZE(glantank_i2c_devices));
 
-	pm_power_off = glantank_power_off;
+	register_poweroff_handler_simple(glantank_power_off, 128);
 }
 
 MACHINE_START(GLANTANK, "GLAN Tank")
arch/arm/mach-iop32x/iq31244.c +1 -1
index 0e1392b..4e9b972 100644
@@ -293,7 +293,7 @@ static void __init iq31244_init_machine(void)
 	platform_device_register(&iop3xx_dma_1_channel);
 
 	if (is_ep80219())
-		pm_power_off = ep80219_power_off;
+		register_poweroff_handler_simple(ep80219_power_off, 128);
 
 	if (!is_80219())
 		platform_device_register(&iop3xx_aau_channel);
arch/arm/mach-iop32x/n2100.c +1 -1
index c1cd80e..171d496 100644
@@ -356,7 +356,7 @@ static void __init n2100_init_machine(void)
 	i2c_register_board_info(0, n2100_i2c_devices,
 		ARRAY_SIZE(n2100_i2c_devices));
 
-	pm_power_off = n2100_power_off;
+	register_poweroff_handler_simple(n2100_power_off, 128);
 }
 
 MACHINE_START(N2100, "Thecus N2100")
arch/arm/mach-ixp4xx/dsmg600-setup.c +1 -1
index 43ee06d..6fb5072 100644
@@ -281,7 +281,7 @@ static void __init dsmg600_init(void)
 
 	platform_add_devices(dsmg600_devices, ARRAY_SIZE(dsmg600_devices));
 
-	pm_power_off = dsmg600_power_off;
+	register_poweroff_handler_simple(dsmg600_power_off, 128);
 }
 
 MACHINE_START(DSMG600, "D-Link DSM-G600 RevA")
arch/arm/mach-ixp4xx/nas100d-setup.c +1 -1
index 4e0f762..bd9a8d6 100644
@@ -292,7 +292,7 @@ static void __init nas100d_init(void)
 
 	platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
 
-	pm_power_off = nas100d_power_off;
+	register_poweroff_handler_simple(nas100d_power_off, 128);
 
 	if (request_irq(gpio_to_irq(NAS100D_RB_GPIO), &nas100d_reset_handler,
 		IRQF_TRIGGER_LOW, "NAS100D reset button", NULL) < 0) {
arch/arm/mach-ixp4xx/nslu2-setup.c +1 -1
index 88c025f..c4c5475 100644
@@ -262,7 +262,7 @@ static void __init nslu2_init(void)
 
 	platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices));
 
-	pm_power_off = nslu2_power_off;
+	register_poweroff_handler_simple(nslu2_power_off, 128);
 
 	if (request_irq(gpio_to_irq(NSLU2_RB_GPIO), &nslu2_reset_handler,
 		IRQF_TRIGGER_LOW, "NSLU2 reset button", NULL) < 0) {
arch/arm/mach-omap2/board-omap3touchbook.c +1 -1
index 70b904c..0c0a0e2 100644
@@ -344,7 +344,7 @@ static void __init omap3_touchbook_init(void)
 {
 	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
 
-	pm_power_off = omap3_touchbook_poweroff;
+	register_poweroff_handler_simple(omap3_touchbook_poweroff, 128);
 
 	if (system_rev >= 0x20 && system_rev <= 0x34301000) {
 		omap_mux_init_gpio(23, OMAP_PIN_INPUT);
arch/arm/mach-orion5x/board-mss2.c +1 -1
index 66f9c3b..3840d66 100644
@@ -86,5 +86,5 @@ static void mss2_power_off(void)
 void __init mss2_init(void)
 {
 	/* register mss2 specific power-off method */
-	pm_power_off = mss2_power_off;
+	register_poweroff_handler_simple(mss2_power_off, 0);
 }
arch/arm/mach-orion5x/dns323-setup.c +3 -3
index 56edeab..353ca3d 100644
@@ -669,7 +669,7 @@ static void __init dns323_init(void)
 		if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 ||
 		    gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0)
 			pr_err("DNS-323: failed to setup power-off GPIO\n");
-		pm_power_off = dns323a_power_off;
+		register_poweroff_handler_simple(dns323a_power_off, 128);
 		break;
 	case DNS323_REV_B1:
 		/* 5182 built-in SATA init */
@@ -686,7 +686,7 @@ static void __init dns323_init(void)
 		if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 ||
 		    gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0)
 			pr_err("DNS-323: failed to setup power-off GPIO\n");
-		pm_power_off = dns323b_power_off;
+		register_poweroff_handler_simple(dns323b_power_off, 128);
 		break;
 	case DNS323_REV_C1:
 		/* 5182 built-in SATA init */
@@ -696,7 +696,7 @@ static void __init dns323_init(void)
 		if (gpio_request(DNS323C_GPIO_POWER_OFF, "POWEROFF") != 0 ||
 		    gpio_direction_output(DNS323C_GPIO_POWER_OFF, 0) != 0)
 			pr_err("DNS-323: failed to setup power-off GPIO\n");
-		pm_power_off = dns323c_power_off;
+		register_poweroff_handler_simple(dns323c_power_off, 128);
 
 		/* Now, -this- should theorically be done by the sata_mv driver
 		 * once I figure out what's going on there. Maybe the behaviour
arch/arm/mach-orion5x/kurobox_pro-setup.c +1 -1
index fe6a48a..c4101f1 100644
@@ -376,7 +376,7 @@ static void __init kurobox_pro_init(void)
 	i2c_register_board_info(0, &kurobox_pro_i2c_rtc, 1);
 
 	/* register Kurobox Pro specific power-off method */
-	pm_power_off = kurobox_pro_power_off;
+	register_poweroff_handler_simple(kurobox_pro_power_off, 128);
 }
 
 #ifdef CONFIG_MACH_KUROBOX_PRO
arch/arm/mach-orion5x/ls-chl-setup.c +1 -1
index 028ea03..005bb04 100644
@@ -312,7 +312,7 @@ static void __init lschl_init(void)
 	gpio_set_value(LSCHL_GPIO_USB_POWER, 1);
 
 	/* register power-off method */
-	pm_power_off = lschl_power_off;
+	register_poweroff_handler_simple(lschl_power_off, 0);
 
 	pr_info("%s: finished\n", __func__);
 }
arch/arm/mach-orion5x/ls_hgl-setup.c +1 -1
index 32b7129..37c29a0 100644
@@ -259,7 +259,7 @@ static void __init ls_hgl_init(void)
 	gpio_set_value(LS_HGL_GPIO_USB_POWER, 1);
 
 	/* register power-off method */
-	pm_power_off = ls_hgl_power_off;
+	register_poweroff_handler_simple(ls_hgl_power_off, 0);
 
 	pr_info("%s: finished\n", __func__);
 }
arch/arm/mach-orion5x/lsmini-setup.c +1 -1
index a6493e7..ffec72f 100644
@@ -260,7 +260,7 @@ static void __init lsmini_init(void)
 	gpio_set_value(LSMINI_GPIO_USB_POWER, 1);
 
 	/* register power-off method */
-	pm_power_off = lsmini_power_off;
+	register_poweroff_handler_simple(lsmini_power_off, 0);
 
 	pr_info("%s: finished\n", __func__);
 }
arch/arm/mach-orion5x/mv2120-setup.c +1 -1
index e032f01..dadc2b9 100644
@@ -225,7 +225,7 @@ static void __init mv2120_init(void)
 	if (gpio_request(MV2120_GPIO_POWER_OFF, "POWEROFF") != 0 ||
 	    gpio_direction_output(MV2120_GPIO_POWER_OFF, 1) != 0)
 		pr_err("mv2120: failed to setup power-off GPIO\n");
-	pm_power_off = mv2120_power_off;
+	register_poweroff_handler_simple(mv2120_power_off, 128);
 }
 
 /* Warning: HP uses a wrong mach-type (=526) in their bootloader */
arch/arm/mach-orion5x/net2big-setup.c +1 -1
index ba73dc7..3a73dce 100644
@@ -413,7 +413,7 @@ static void __init net2big_init(void)
 
 	if (gpio_request(NET2BIG_GPIO_POWER_OFF, "power-off") == 0 &&
 	    gpio_direction_output(NET2BIG_GPIO_POWER_OFF, 0) == 0)
-		pm_power_off = net2big_power_off;
+		register_poweroff_handler_simple(net2big_power_off, 128);
 	else
 		pr_err("net2big: failed to configure power-off GPIO\n");
 
arch/arm/mach-orion5x/terastation_pro2-setup.c +1 -1
index 6208d12..2a234cb 100644
@@ -353,7 +353,7 @@ static void __init tsp2_init(void)
 	i2c_register_board_info(0, &tsp2_i2c_rtc, 1);
 
 	/* register Terastation Pro II specific power-off method */
-	pm_power_off = tsp2_power_off;
+	register_poweroff_handler_simple(tsp2_power_off, 128);
 }
 
 MACHINE_START(TERASTATION_PRO2, "Buffalo Terastation Pro II/Live")
arch/arm/mach-orion5x/ts209-setup.c +1 -1
index 9136797..50bdfbc 100644
@@ -318,7 +318,7 @@ static void __init qnap_ts209_init(void)
 	i2c_register_board_info(0, &qnap_ts209_i2c_rtc, 1);
 
 	/* register tsx09 specific power-off method */
-	pm_power_off = qnap_tsx09_power_off;
+	register_poweroff_handler_simple(qnap_tsx09_power_off, 128);
 }
 
 MACHINE_START(TS209, "QNAP TS-109/TS-209")
arch/arm/mach-orion5x/ts409-setup.c +1 -1
index 5c079d31..06a7cc0 100644
@@ -307,7 +307,7 @@ static void __init qnap_ts409_init(void)
 	platform_device_register(&ts409_leds);
 
 	/* register tsx09 specific power-off method */
-	pm_power_off = qnap_tsx09_power_off;
+	register_poweroff_handler_simple(qnap_tsx09_power_off, 128);
 }
 
 MACHINE_START(TS409, "QNAP TS-409")
arch/arm/mach-pxa/corgi.c +1 -1
index 06022b2..a93bac0 100644
@@ -718,7 +718,7 @@ static void corgi_restart(enum reboot_mode mode, const char *cmd)
 
 static void __init corgi_init(void)
 {
-	pm_power_off = corgi_poweroff;
+	register_poweroff_handler_simple(corgi_poweroff, 0);
 
 	/* Stop 3.6MHz and drive HIGH to PCMCIA and CS */
 	PCFR |= PCFR_OPDE;
arch/arm/mach-pxa/mioa701.c +1 -1
index 29997bd..c4345a4 100644
@@ -750,7 +750,7 @@ static void __init mioa701_machine_init(void)
 	pxa_set_keypad_info(&mioa701_keypad_info);
 	pxa_set_udc_info(&mioa701_udc_info);
 	pxa_set_ac97_info(&mioa701_ac97_info);
-	pm_power_off = mioa701_poweroff;
+	register_poweroff_handler_simple(mioa701_poweroff, 0);
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 	gsm_init();
 
arch/arm/mach-pxa/poodle.c +1 -1
index 1319916..c9536ed 100644
@@ -432,7 +432,7 @@ static void __init poodle_init(void)
 {
 	int ret = 0;
 
-	pm_power_off = poodle_poweroff;
+	register_poweroff_handler_simple(poodle_poweroff, 0);
 
 	PCFR |= PCFR_OPDE;
 
arch/arm/mach-pxa/spitz.c +1 -1
index 840c3a4..09f0de8 100644
@@ -944,7 +944,7 @@ static void spitz_restart(enum reboot_mode mode, const char *cmd)
 static void __init spitz_init(void)
 {
 	init_gpio_reset(SPITZ_GPIO_ON_RESET, 1, 0);
-	pm_power_off = spitz_poweroff;
+	register_poweroff_handler_simple(spitz_poweroff, 0);
 
 	PMCR = 0x00;
 
arch/arm/mach-pxa/tosa.c +1 -1
index c158a6e..3a4af1d 100644
@@ -940,7 +940,7 @@ static void __init tosa_init(void)
 
 	init_gpio_reset(TOSA_GPIO_ON_RESET, 0, 0);
 
-	pm_power_off = tosa_poweroff;
+	register_poweroff_handler_simple(tosa_poweroff, 0);
 
 	PCFR |= PCFR_OPDE;
 
arch/arm/mach-pxa/viper.c +1 -1
index de3b080..679c8ea 100644
@@ -919,7 +919,7 @@ static void __init viper_init(void)
 {
 	u8 version;
 
-	pm_power_off = viper_power_off;
+	register_poweroff_handler_simple(viper_power_off, 128);
 
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(viper_pin_config));
 
arch/arm/mach-pxa/z2.c +3 -3
index e1a121b..e0195ac 100644
@@ -693,8 +693,6 @@ static void z2_power_off(void)
 	pxa27x_set_pwrmode(PWRMODE_DEEPSLEEP);
 	pxa27x_cpu_pm_enter(PM_SUSPEND_MEM);
 }
-#else
-#define z2_power_off   NULL
 #endif
 
 /******************************************************************************
@@ -719,7 +717,9 @@ static void __init z2_init(void)
 	z2_keys_init();
 	z2_pmic_init();
 
-	pm_power_off = z2_power_off;
+#ifdef CONFIG_PM
+	register_poweroff_handler_simple(z2_power_off, 0);
+#endif
 }
 
 MACHINE_START(ZIPIT2, "Zipit Z2")
arch/arm/mach-pxa/zeus.c +3 -3
index 205f9bf..6118fd5 100644
@@ -690,8 +690,6 @@ static void zeus_power_off(void)
 	local_irq_disable();
 	cpu_suspend(PWRMODE_DEEPSLEEP, pxa27x_finish_suspend);
 }
-#else
-#define zeus_power_off   NULL
 #endif
 
 #ifdef CONFIG_APM_EMULATION
@@ -847,7 +845,9 @@ static void __init zeus_init(void)
 	__raw_writel(msc0, MSC0);
 	__raw_writel(msc1, MSC1);
 
-	pm_power_off = zeus_power_off;
+#ifdef CONFIG_PM
+	register_poweroff_handler_simple(zeus_power_off, 0);
+#endif
 	zeus_setup_apm();
 
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(zeus_pin_config));
arch/arm/mach-s3c24xx/mach-gta02.c +1 -1
index fc3a08d..ca78150 100644
@@ -579,7 +579,7 @@ static void __init gta02_machine_init(void)
 	i2c_register_board_info(0, gta02_i2c_devs, ARRAY_SIZE(gta02_i2c_devs));
 
 	platform_add_devices(gta02_devices, ARRAY_SIZE(gta02_devices));
-	pm_power_off = gta02_poweroff;
+	register_poweroff_handler_simple(gta02_poweroff, 128);
 
 	regulator_has_full_constraints();
 }
arch/arm/mach-s3c24xx/mach-jive.c +1 -1
index 7804d3c..5a828a3 100644
@@ -657,7 +657,7 @@ static void __init jive_machine_init(void)
 	s3c_i2c0_set_platdata(&jive_i2c_cfg);
 	i2c_register_board_info(0, jive_i2c_devs, ARRAY_SIZE(jive_i2c_devs));
 
-	pm_power_off = jive_power_off;
+	register_poweroff_handler_simple(jive_power_off, 128);
 
 	platform_add_devices(jive_devices, ARRAY_SIZE(jive_devices));
 }
arch/arm/mach-s3c24xx/mach-vr1000.c +1 -1
index f88c584..40d7655 100644
@@ -306,7 +306,7 @@ static void vr1000_power_off(void)
 
 static void __init vr1000_map_io(void)
 {
-	pm_power_off = vr1000_power_off;
+	register_poweroff_handler_simple(vr1000_power_off, 128);
 
 	s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc));
 	s3c24xx_init_uarts(vr1000_uartcfgs, ARRAY_SIZE(vr1000_uartcfgs));
arch/arm/mach-s3c64xx/mach-smartq.c +1 -1
index b3d1353..61f0893 100644
@@ -291,7 +291,7 @@ static int __init smartq_power_off_init(void)
 	/* leave power on */
 	gpio_direction_output(S3C64XX_GPK(15), 0);
 
-	pm_power_off = smartq_power_off;
+	register_poweroff_handler_simple(smartq_power_off, 128);
 
 	return ret;
 }
arch/arm/mach-sa1100/generic.c +1 -1
index d4ea142..6b839cf 100644
@@ -311,7 +311,7 @@ static struct platform_device *sa11x0_devices[] __initdata = {
 
 static int __init sa1100_init(void)
 {
-	pm_power_off = sa1100_power_off;
+	register_poweroff_handler_simple(sa1100_power_off, 0);
 	return platform_add_devices(sa11x0_devices, ARRAY_SIZE(sa11x0_devices));
 }
 
arch/arm/mach-sa1100/simpad.c +1 -1
index 41e476e..a65ca58 100644
@@ -373,7 +373,7 @@ static int __init simpad_init(void)
 	if (ret)
 		printk(KERN_WARNING "simpad: Unable to register cs3 GPIO device");
 
-	pm_power_off = simpad_power_off;
+	register_poweroff_handler_simple(simpad_power_off, 0);
 
 	sa11x0_ppc_configure_mcp();
 	sa11x0_register_mtd(&simpad_flash_data, simpad_flash_resources,
arch/arm/mach-u300/regulator.c +1 -1
index 0493a84..c98eb6e 100644
@@ -98,7 +98,7 @@ static int __init __u300_init_boardpower(struct platform_device *pdev)
 			   U300_SYSCON_PMCR_DCON_ENABLE, 0);
 
 	/* Register globally exported PM poweroff hook */
-	pm_power_off = u300_pm_poweroff;
+	register_poweroff_handler_simple(u300_pm_poweroff, 128);
 
 	return 0;
 }
arch/arm/mach-vt8500/vt8500.c +1 -1
index 2da7be3..515946b 100644
@@ -155,7 +155,7 @@ static void __init vt8500_init(void)
 			pr_err("%s:ioremap(power_off) failed\n", __func__);
 	}
 	if (pmc_base)
-		pm_power_off = &vt8500_power_off;
+		register_poweroff_handler_simple(vt8500_power_off, 0);
 	else
 		pr_err("%s: PMC Hibernation register could not be remapped, not enabling power off!\n", __func__);
 
arch/arm/xen/enlighten.c +1 -1
index 0e15f01..0da639b 100644
@@ -336,7 +336,7 @@ static int __init xen_pm_init(void)
 	if (!xen_domain())
 		return -ENODEV;
 
-	pm_power_off = xen_power_off;
+	register_poweroff_handler_simple(xen_power_off, 128);
 	arm_pm_restart = xen_restart;
 
 	return 0;
Signature · 1 line
1.9.1
author maintainer
#216 lore raw

PATCH 32/44 arm64: psci: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/kernel/psci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/psci.c +1 -1
index 5539547..c1f3d09 100644
@@ -286,7 +286,7 @@ static int __init psci_0_2_init(struct device_node *np)
 
 	arm_pm_restart = psci_sys_reset;
 
-	pm_power_off = psci_sys_poweroff;
+	register_poweroff_handler_simple(psci_sys_poweroff, 128);
 
 out_put_node:
 	of_node_put(np);
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer Acked-by on v1 32/44
#217 lore raw

Re: [PATCH 32/44] arm64: psci: Register with kernel poweroff handler

Quoted 15 lines · Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/kernel/psci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/psci.c +0 -0
index 5539547..c1f3d09 100644

arch/arm64/kernel/psci.c static int __init psci_0_2_init(struct device_node *np) · line 292

Quoted 8 lines
arch/arm64/kernel/psci.c +1 -1
@@ -286,7 +286,7 @@ static int __init psci_0_2_init(struct device_node *np)
 
 	arm_pm_restart = psci_sys_reset;
 
-	pm_power_off = psci_sys_poweroff;
+	register_poweroff_handler_simple(psci_sys_poweroff, 128);
 
 out_put_node:
 	of_node_put(np);
maintainer Acked-by on v1 32/44
#218 lore raw

Re: [PATCH 32/44] arm64: psci: Register with kernel poweroff handler

In reply to Guenter Roeck
Quoted 15 lines · Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/kernel/psci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/psci.c +0 -0
index 5539547..c1f3d09 100644

arch/arm64/kernel/psci.c static int __init psci_0_2_init(struct device_node *np) · line 292

Quoted 8 lines
arch/arm64/kernel/psci.c +1 -1
@@ -286,7 +286,7 @@ static int __init psci_0_2_init(struct device_node *np)
 
 	arm_pm_restart = psci_sys_reset;
 
-	pm_power_off = psci_sys_poweroff;
+	register_poweroff_handler_simple(psci_sys_poweroff, 128);
 
 out_put_node:
 	of_node_put(np);
author maintainer
#219 lore raw

PATCH 32/44 arm64: psci: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/kernel/psci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/psci.c +1 -1
index 5539547..c1f3d09 100644
@@ -286,7 +286,7 @@ static int __init psci_0_2_init(struct device_node *np)
 
 	arm_pm_restart = psci_sys_reset;
 
-	pm_power_off = psci_sys_poweroff;
+	register_poweroff_handler_simple(psci_sys_poweroff, 128);
 
 out_put_node:
 	of_node_put(np);
Signature · 1 line
1.9.1
author maintainer
#220 lore raw

PATCH 32/44 arm64: psci: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/kernel/psci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/psci.c +1 -1
index 5539547..c1f3d09 100644
@@ -286,7 +286,7 @@ static int __init psci_0_2_init(struct device_node *np)
 
 	arm_pm_restart = psci_sys_reset;
 
-	pm_power_off = psci_sys_poweroff;
+	register_poweroff_handler_simple(psci_sys_poweroff, 128);
 
 out_put_node:
 	of_node_put(np);
Signature · 1 line
1.9.1
author maintainer
#221 lore raw

PATCH 33/44 avr32: atngw100: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

Cc Haavard Skinnemoen <[email protected]>
Cc Hans-Christian Egtvedt <[email protected]>
---
 arch/avr32/boards/atngw100/mrmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/avr32/boards/atngw100/mrmt.c +1 -1
index 91146b4..54d0c27 100644
@@ -274,7 +274,7 @@ static int __init mrmt1_init(void)
 {
 	gpio_set_value( PIN_PWR_ON, 1 );	/* Ensure PWR_ON is enabled */
 
-	pm_power_off = mrmt_power_off;
+	register_poweroff_handler_simple(mrmt_power_off, 128);
 
 	/* Setup USARTS (other than console) */
 	at32_map_usart(2, 1, 0);	/* USART 2: /dev/ttyS1, RMT1:DB9M */
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-metag" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Acked-by on v1 33/44
#222 lore raw

Re: [PATCH 33/44] avr32: atngw100: Register with kernel poweroff handler

Quoted 6 lines · Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

Cc Haavard Skinnemoen <[email protected]>
Cc Hans-Christian Egtvedt <[email protected]>
Quoted 17 lines
---
 arch/avr32/boards/atngw100/mrmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/avr32/boards/atngw100/mrmt.c +1 -1
index 91146b4..54d0c27 100644
@@ -274,7 +274,7 @@ static int __init mrmt1_init(void)
 {
 	gpio_set_value( PIN_PWR_ON, 1 );	/* Ensure PWR_ON is enabled */
 
-	pm_power_off = mrmt_power_off;
+	register_poweroff_handler_simple(mrmt_power_off, 128);
 
 	/* Setup USARTS (other than console) */
 	at32_map_usart(2, 1, 0);	/* USART 2: /dev/ttyS1, RMT1:DB9M */
Signature · 2 lines
mvh
Hans-Christian Egtvedt
author maintainer
#224 lore raw

Re: [PATCH 33/44] avr32: atngw100: Register with kernel poweroff handler

In reply to Hans-Christian Egtvedt
Quoted 10 lines · Hans-Christian Egtvedt
Quoted 6 lines · Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

Cc Haavard Skinnemoen <[email protected]>
Cc Hans-Christian Egtvedt <[email protected]>

Thanks!

Guenter

author maintainer
#225 lore raw

Re: [PATCH 33/44] avr32: atngw100: Register with kernel poweroff handler

In reply to Hans-Christian Egtvedt
Quoted 10 lines · Hans-Christian Egtvedt
Quoted 6 lines · Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

Cc Haavard Skinnemoen <[email protected]>
Cc Hans-Christian Egtvedt <[email protected]>

Thanks!

Guenter

Acked-by on v1 33/44
#226 lore raw

Re: [PATCH 33/44] avr32: atngw100: Register with kernel poweroff handler

In reply to Guenter Roeck
Quoted 6 lines · Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

Cc Haavard Skinnemoen <[email protected]>
Cc Hans-Christian Egtvedt <[email protected]>
Quoted 17 lines
---
 arch/avr32/boards/atngw100/mrmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/avr32/boards/atngw100/mrmt.c +1 -1
index 91146b4..54d0c27 100644
@@ -274,7 +274,7 @@ static int __init mrmt1_init(void)
 {
 	gpio_set_value( PIN_PWR_ON, 1 );	/* Ensure PWR_ON is enabled */
 
-	pm_power_off = mrmt_power_off;
+	register_poweroff_handler_simple(mrmt_power_off, 128);
 
 	/* Setup USARTS (other than console) */
 	at32_map_usart(2, 1, 0);	/* USART 2: /dev/ttyS1, RMT1:DB9M */
Signature · 2 lines
mvh
Hans-Christian Egtvedt
Acked-by on v1 33/44
#227 lore raw

Re: [PATCH 33/44] avr32: atngw100: Register with kernel poweroff handler

In reply to Guenter Roeck
Quoted 6 lines · Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

Cc Haavard Skinnemoen <[email protected]>
Cc Hans-Christian Egtvedt <[email protected]>
Quoted 17 lines
---
 arch/avr32/boards/atngw100/mrmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/avr32/boards/atngw100/mrmt.c +1 -1
index 91146b4..54d0c27 100644
@@ -274,7 +274,7 @@ static int __init mrmt1_init(void)
 {
 	gpio_set_value( PIN_PWR_ON, 1 );	/* Ensure PWR_ON is enabled */
 
-	pm_power_off = mrmt_power_off;
+	register_poweroff_handler_simple(mrmt_power_off, 128);
 
 	/* Setup USARTS (other than console) */
 	at32_map_usart(2, 1, 0);	/* USART 2: /dev/ttyS1, RMT1:DB9M */
Signature · 2 lines
mvh
Hans-Christian Egtvedt
author maintainer
#228 lore raw

PATCH 33/44 avr32: atngw100: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

Cc Haavard Skinnemoen <[email protected]>
Cc Hans-Christian Egtvedt <[email protected]>
---
 arch/avr32/boards/atngw100/mrmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/avr32/boards/atngw100/mrmt.c +1 -1
index 91146b4..54d0c27 100644
@@ -274,7 +274,7 @@ static int __init mrmt1_init(void)
 {
 	gpio_set_value( PIN_PWR_ON, 1 );	/* Ensure PWR_ON is enabled */
 
-	pm_power_off = mrmt_power_off;
+	register_poweroff_handler_simple(mrmt_power_off, 128);
 
 	/* Setup USARTS (other than console) */
 	at32_map_usart(2, 1, 0);	/* USART 2: /dev/ttyS1, RMT1:DB9M */
Signature · 1 line
1.9.1
author maintainer
#229 lore raw

PATCH 33/44 avr32: atngw100: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

Cc Haavard Skinnemoen <[email protected]>
Cc Hans-Christian Egtvedt <[email protected]>
---
 arch/avr32/boards/atngw100/mrmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/avr32/boards/atngw100/mrmt.c +1 -1
index 91146b4..54d0c27 100644
@@ -274,7 +274,7 @@ static int __init mrmt1_init(void)
 {
 	gpio_set_value( PIN_PWR_ON, 1 );	/* Ensure PWR_ON is enabled */
 
-	pm_power_off = mrmt_power_off;
+	register_poweroff_handler_simple(mrmt_power_off, 128);
 
 	/* Setup USARTS (other than console) */
 	at32_map_usart(2, 1, 0);	/* USART 2: /dev/ttyS1, RMT1:DB9M */
Signature · 1 line
1.9.1
author maintainer
#230 lore raw

PATCH 34/44 ia64: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with lower priority of 64 to reflect that the call is expected to be replaced at some point.

---
 arch/ia64/sn/kernel/setup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/ia64/sn/kernel/setup.c +2 -2
index 36182c8..6c83425 100644
@@ -488,12 +488,12 @@ void __init sn_setup(char **cmdline_p)
 	sn_timer_init();
 
 	/*
-	 * set pm_power_off to a SAL call to allow
+	 * set poweroff handler to a SAL call to allow
 	 * sn machines to power off. The SAL call can be replaced
 	 * by an ACPI interface call when ACPI is fully implemented
 	 * for sn.
 	 */
-	pm_power_off = ia64_sn_power_down;
+	register_poweroff_handler_simple(ia64_sn_power_down, 64);
 	current->thread.flags |= IA64_THREAD_MIGRATION;
 }
 
Signature · 1 line
1.9.1
author maintainer
#231 lore raw

PATCH 34/44 ia64: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with lower priority of 64 to reflect that the call is expected to be replaced at some point.

---
 arch/ia64/sn/kernel/setup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/ia64/sn/kernel/setup.c +2 -2
index 36182c8..6c83425 100644
@@ -488,12 +488,12 @@ void __init sn_setup(char **cmdline_p)
 	sn_timer_init();
 
 	/*
-	 * set pm_power_off to a SAL call to allow
+	 * set poweroff handler to a SAL call to allow
 	 * sn machines to power off. The SAL call can be replaced
 	 * by an ACPI interface call when ACPI is fully implemented
 	 * for sn.
 	 */
-	pm_power_off = ia64_sn_power_down;
+	register_poweroff_handler_simple(ia64_sn_power_down, 64);
 	current->thread.flags |= IA64_THREAD_MIGRATION;
 }
 
Signature · 1 line
1.9.1
author maintainer
#232 lore raw

PATCH 34/44 ia64: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with lower priority of 64 to reflect that the call is expected to be replaced at some point.

---
 arch/ia64/sn/kernel/setup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/ia64/sn/kernel/setup.c +2 -2
index 36182c8..6c83425 100644
@@ -488,12 +488,12 @@ void __init sn_setup(char **cmdline_p)
 	sn_timer_init();
 
 	/*
-	 * set pm_power_off to a SAL call to allow
+	 * set poweroff handler to a SAL call to allow
 	 * sn machines to power off. The SAL call can be replaced
 	 * by an ACPI interface call when ACPI is fully implemented
 	 * for sn.
 	 */
-	pm_power_off = ia64_sn_power_down;
+	register_poweroff_handler_simple(ia64_sn_power_down, 64);
 	current->thread.flags |= IA64_THREAD_MIGRATION;
 }
 
Signature · 1 line
1.9.1
author maintainer
#233 lore raw

PATCH 35/44 m68k: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

Cc Geert Uytterhoeven <[email protected]>
Cc Joshua Thompson <[email protected]>
---
 arch/m68k/emu/natfeat.c | 2 +-
 arch/m68k/mac/config.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/m68k/emu/natfeat.c +1 -1
index 91e2ae7..c4d5bd8 100644
@@ -91,5 +91,5 @@ void __init nf_init(void)
 	pr_info("NatFeats found (%s, %lu.%lu)\n", buf, version >> 16,
 		version & 0xffff);
 
-	pm_power_off = nf_poweroff;
+	register_poweroff_handler_simple(nf_poweroff, 128);
 }
arch/m68k/mac/config.c +1 -1
index 677913ff..5d8e2e6 100644
@@ -160,7 +160,7 @@ void __init config_mac(void)
 	mach_set_clock_mmss = mac_set_clock_mmss;
 	mach_reset = mac_reset;
 	mach_halt = mac_poweroff;
-	pm_power_off = mac_poweroff;
+	register_poweroff_handler_simple(mac_poweroff, 128);
 	mach_max_dma_address = 0xffffffff;
 #if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
 	mach_beep = mac_mksound;
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-metag" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer Acked-by on v1 35/44
#234 lore raw

Re: [PATCH 35/44] m68k: Register with kernel poweroff handler

Quoted 6 lines · Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

Cc Geert Uytterhoeven <[email protected]>
Cc Joshua Thompson <[email protected]>

As someone already mentioned, having #defines instead of hardcoded numbers for the priorities would be nice.

Apart from that:

Review

Quoted 3 lines
(quoted diff) +2 -0
+       register_poweroff_handler_simple(nf_poweroff, 128);
 
+       register_poweroff_handler_simple(mac_poweroff, 128);

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

maintainer Acked-by on v1 35/44
#235 lore raw

Re: [PATCH 35/44] m68k: Register with kernel poweroff handler

In reply to Guenter Roeck
Quoted 6 lines · Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

Cc Geert Uytterhoeven <[email protected]>
Cc Joshua Thompson <[email protected]>

As someone already mentioned, having #defines instead of hardcoded numbers for the priorities would be nice.

Apart from that:

Review

Quoted 3 lines
(quoted diff) +2 -0
+       register_poweroff_handler_simple(nf_poweroff, 128);
 
+       register_poweroff_handler_simple(mac_poweroff, 128);

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

author maintainer
#236 lore raw

PATCH 35/44 m68k: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

Cc Geert Uytterhoeven <[email protected]>
Cc Joshua Thompson <[email protected]>
---
 arch/m68k/emu/natfeat.c | 2 +-
 arch/m68k/mac/config.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/m68k/emu/natfeat.c +1 -1
index 91e2ae7..c4d5bd8 100644
@@ -91,5 +91,5 @@ void __init nf_init(void)
 	pr_info("NatFeats found (%s, %lu.%lu)\n", buf, version >> 16,
 		version & 0xffff);
 
-	pm_power_off = nf_poweroff;
+	register_poweroff_handler_simple(nf_poweroff, 128);
 }
arch/m68k/mac/config.c +1 -1
index 677913ff..5d8e2e6 100644
@@ -160,7 +160,7 @@ void __init config_mac(void)
 	mach_set_clock_mmss = mac_set_clock_mmss;
 	mach_reset = mac_reset;
 	mach_halt = mac_poweroff;
-	pm_power_off = mac_poweroff;
+	register_poweroff_handler_simple(mac_poweroff, 128);
 	mach_max_dma_address = 0xffffffff;
 #if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
 	mach_beep = mac_mksound;
Signature · 1 line
1.9.1
author maintainer
#237 lore raw

PATCH 35/44 m68k: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

Cc Geert Uytterhoeven <[email protected]>
Cc Joshua Thompson <[email protected]>
---
 arch/m68k/emu/natfeat.c | 2 +-
 arch/m68k/mac/config.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/m68k/emu/natfeat.c +1 -1
index 91e2ae7..c4d5bd8 100644
@@ -91,5 +91,5 @@ void __init nf_init(void)
 	pr_info("NatFeats found (%s, %lu.%lu)\n", buf, version >> 16,
 		version & 0xffff);
 
-	pm_power_off = nf_poweroff;
+	register_poweroff_handler_simple(nf_poweroff, 128);
 }
arch/m68k/mac/config.c +1 -1
index 677913ff..5d8e2e6 100644
@@ -160,7 +160,7 @@ void __init config_mac(void)
 	mach_set_clock_mmss = mac_set_clock_mmss;
 	mach_reset = mac_reset;
 	mach_halt = mac_poweroff;
-	pm_power_off = mac_poweroff;
+	register_poweroff_handler_simple(mac_poweroff, 128);
 	mach_max_dma_address = 0xffffffff;
 #if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
 	mach_beep = mac_mksound;
Signature · 1 line
1.9.1
author maintainer
#238 lore raw

PATCH 36/44 mips: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

If there is an indication that there can be more than one poweroff handler, use register_poweroff_handler, otherwise use register_poweroff_handler_simple to register the poweroff handler.

If the poweroff handler only resets or stops the system, select a priority of 0 to indicate that the poweroff handler is one of last resort. If the poweroff handler powers off the system, select a priority of 128, unless the poweroff handler installation code suggests that there can be more than one poweroff handler and the new handler is only installed conditionally. In this case, select a priority of 64.

Cc Ralf Baechle <ralf-6z/[email protected]>
Cc Maciej W. Rozycki <macro-6z/[email protected]>
---
 arch/mips/alchemy/board-gpr.c          |  2 +-
 arch/mips/alchemy/board-mtx1.c         |  2 +-
 arch/mips/alchemy/board-xxs1500.c      |  2 +-
 arch/mips/alchemy/devboards/platform.c | 17 +++++++++++++++--
 arch/mips/ar7/setup.c                  |  2 +-
 arch/mips/ath79/setup.c                |  2 +-
 arch/mips/bcm47xx/setup.c              |  2 +-
 arch/mips/bcm63xx/setup.c              |  2 +-
 arch/mips/cobalt/setup.c               |  2 +-
 arch/mips/dec/setup.c                  |  2 +-
 arch/mips/emma/markeins/setup.c        |  2 +-
 arch/mips/jz4740/reset.c               |  2 +-
 arch/mips/lantiq/falcon/reset.c        |  2 +-
 arch/mips/lantiq/xway/reset.c          |  2 +-
 arch/mips/lasat/reset.c                |  2 +-
 arch/mips/loongson/common/reset.c      |  2 +-
 arch/mips/loongson1/common/reset.c     |  2 +-
 arch/mips/mti-malta/malta-reset.c      |  2 +-
 arch/mips/mti-sead3/sead3-reset.c      |  2 +-
 arch/mips/netlogic/xlp/setup.c         |  2 +-
 arch/mips/netlogic/xlr/setup.c         |  2 +-
 arch/mips/pmcs-msp71xx/msp_setup.c     |  2 +-
 arch/mips/pnx833x/common/setup.c       |  2 +-
 arch/mips/ralink/reset.c               |  2 +-
 arch/mips/rb532/setup.c                |  2 +-
 arch/mips/sgi-ip22/ip22-reset.c        |  2 +-
 arch/mips/sgi-ip27/ip27-reset.c        |  2 +-
 arch/mips/sgi-ip32/ip32-reset.c        |  2 +-
 arch/mips/sibyte/common/cfe.c          |  2 +-
 arch/mips/sni/setup.c                  |  2 +-
 arch/mips/txx9/generic/setup.c         |  2 +-
 arch/mips/vr41xx/common/pmu.c          |  2 +-
 32 files changed, 46 insertions(+), 33 deletions(-)
arch/mips/alchemy/board-gpr.c +1 -1
index acf9a2a..56190a3 100644
@@ -89,7 +89,7 @@ void __init board_setup(void)
 {
 	printk(KERN_INFO "Trapeze ITS GPR board\n");
 
-	pm_power_off = gpr_power_off;
+	register_poweroff_handler_simple(gpr_power_off, 0);
 	_machine_halt = gpr_power_off;
 	_machine_restart = gpr_reset;
 
arch/mips/alchemy/board-mtx1.c +1 -1
index 1e3b102..e2b06b5 100644
@@ -98,7 +98,7 @@ void __init board_setup(void)
 	alchemy_gpio_direction_output(211, 1);	/* green on */
 	alchemy_gpio_direction_output(212, 0);	/* red off */
 
-	pm_power_off = mtx1_power_off;
+	register_poweroff_handler_simple(mtx1_power_off, 0);
 	_machine_halt = mtx1_power_off;
 	_machine_restart = mtx1_reset;
 
arch/mips/alchemy/board-xxs1500.c +1 -1
index 0fc53e0..aaa5f5f 100644
@@ -79,7 +79,7 @@ void __init board_setup(void)
 {
 	u32 pin_func;
 
-	pm_power_off = xxs1500_power_off;
+	register_poweroff_handler_simple(xxs1500_power_off, 0);
 	_machine_halt = xxs1500_power_off;
 	_machine_restart = xxs1500_reset;
 
arch/mips/alchemy/devboards/platform.c +15 -2
index 8df86eb..1734f72 100644
@@ -6,6 +6,7 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/physmap.h>
+#include <linux/notifier.h>
 #include <linux/slab.h>
 #include <linux/platform_device.h>
 #include <linux/pm.h>
@@ -61,10 +62,22 @@ static void db1x_reset(char *c)
 	bcsr_write(BCSR_SYSTEM, 0);
 }
 
+static int db1x_power_off_notify(struct notifier *this,
+				 unsigned long unused1, void *unused2)
+{
+	db1x_power_off();
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block db1x_poweroff_nb = {
+	.notifier_call = db1x_power_off_notify,
+	.priority = 64,
+}
+
 static int __init db1x_late_setup(void)
 {
-	if (!pm_power_off)
-		pm_power_off = db1x_power_off;
+	if (register_poweroff_handler(&db1x_poweroff_nb))
+		pr_err("dbx1: Failed to register poweroff handler\n");
 	if (!_machine_halt)
 		_machine_halt = db1x_power_off;
 	if (!_machine_restart)
arch/mips/ar7/setup.c +1 -1
index 820b7a3..464067e 100644
@@ -91,7 +91,7 @@ void __init plat_mem_setup(void)
 
 	_machine_restart = ar7_machine_restart;
 	_machine_halt = ar7_machine_halt;
-	pm_power_off = ar7_machine_power_off;
+	register_poweroff_handler_simple(ar7_machine_power_off, 128);
 
 	io_base = (unsigned long)ioremap(AR7_REGS_BASE, 0x10000);
 	if (!io_base)
arch/mips/ath79/setup.c +1 -1
index 64807a4..ce9754e 100644
@@ -203,7 +203,7 @@ void __init plat_mem_setup(void)
 
 	_machine_restart = ath79_restart;
 	_machine_halt = ath79_halt;
-	pm_power_off = ath79_halt;
+	register_poweroff_handler_simple(ath79_halt, 0);
 }
 
 void __init plat_time_init(void)
arch/mips/bcm47xx/setup.c +1 -1
index ad439c2..d0841f6 100644
@@ -242,7 +242,7 @@ void __init plat_mem_setup(void)
 
 	_machine_restart = bcm47xx_machine_restart;
 	_machine_halt = bcm47xx_machine_halt;
-	pm_power_off = bcm47xx_machine_halt;
+	register_poweroff_handler_simple(bcm47xx_machine_halt, 0);
 	bcm47xx_board_detect();
 	mips_set_machine_name(bcm47xx_board_get_name());
 }
arch/mips/bcm63xx/setup.c +1 -1
index 6660c7d..80a5893 100644
@@ -149,7 +149,7 @@ void __init plat_mem_setup(void)
 
 	_machine_halt = bcm63xx_machine_halt;
 	_machine_restart = __bcm63xx_machine_reboot;
-	pm_power_off = bcm63xx_machine_halt;
+	register_poweroff_handler_simple(bcm63xx_machine_halt, 0);
 
 	set_io_port_base(0);
 	ioport_resource.start = 0;
arch/mips/cobalt/setup.c +1 -1
index 9a8c2fe..146406f 100644
@@ -78,7 +78,7 @@ void __init plat_mem_setup(void)
 
 	_machine_restart = cobalt_machine_restart;
 	_machine_halt = cobalt_machine_halt;
-	pm_power_off = cobalt_machine_halt;
+	register_poweroff_handler_simple(cobalt_machine_halt, 0);
 
 	set_io_port_base(CKSEG1ADDR(GT_DEF_PCI0_IO_BASE));
 
arch/mips/dec/setup.c +1 -1
index 41bbffd..8aea997 100644
@@ -158,7 +158,7 @@ void __init plat_mem_setup(void)
 
 	_machine_restart = dec_machine_restart;
 	_machine_halt = dec_machine_halt;
-	pm_power_off = dec_machine_power_off;
+	register_poweroff_handler_simple(dec_machine_power_off, 128);
 
 	ioport_resource.start = ~0UL;
 	ioport_resource.end = 0UL;
arch/mips/emma/markeins/setup.c +1 -1
index 9100122..e2ec2e5 100644
@@ -103,7 +103,7 @@ void __init plat_mem_setup(void)
 
 	_machine_restart = markeins_machine_restart;
 	_machine_halt = markeins_machine_halt;
-	pm_power_off = markeins_machine_power_off;
+	register_poweroff_handler_simple(markeins_machine_power_off, 0);
 
 	/* setup resource limits */
 	ioport_resource.start = EMMA2RH_PCI_IO_BASE;
arch/mips/jz4740/reset.c +1 -1
index b6c6343..3659e62 100644
@@ -114,5 +114,5 @@ void jz4740_reset_init(void)
 {
 	_machine_restart = jz4740_restart;
 	_machine_halt = jz4740_halt;
-	pm_power_off = jz4740_power_off;
+	register_poweroff_handler_simple(jz4740_power_off, 128);
 }
arch/mips/lantiq/falcon/reset.c +1 -1
index 5682482..efd4ee2 100644
@@ -83,7 +83,7 @@ static int __init mips_reboot_setup(void)
 {
 	_machine_restart = machine_restart;
 	_machine_halt = machine_halt;
-	pm_power_off = machine_power_off;
+	register_poweroff_handler_simple(machine_power_off, 0);
 	return 0;
 }
 
arch/mips/lantiq/xway/reset.c +1 -1
index 1fa0f17..b698032 100644
@@ -157,7 +157,7 @@ static int __init mips_reboot_setup(void)
 
 	_machine_restart = ltq_machine_restart;
 	_machine_halt = ltq_machine_halt;
-	pm_power_off = ltq_machine_power_off;
+	register_poweroff_handler_simple(ltq_machine_power_off, 0);
 
 	return 0;
 }
arch/mips/lasat/reset.c +1 -1
index e21f0b9..9a07a88 100644
@@ -56,5 +56,5 @@ void lasat_reboot_setup(void)
 {
 	_machine_restart = lasat_machine_restart;
 	_machine_halt = lasat_machine_halt;
-	pm_power_off = lasat_machine_halt;
+	register_poweroff_handler_simple(lasat_machine_halt, 0);
 }
arch/mips/loongson/common/reset.c +1 -1
index a60715e..e251519 100644
@@ -84,7 +84,7 @@ static int __init mips_reboot_setup(void)
 {
 	_machine_restart = loongson_restart;
 	_machine_halt = loongson_halt;
-	pm_power_off = loongson_poweroff;
+	register_poweroff_handler_simple(loongson_poweroff, 128);
 
 	return 0;
 }
arch/mips/loongson1/common/reset.c +1 -1
index 547f34b..fbb563a 100644
@@ -38,7 +38,7 @@ static int __init ls1x_reboot_setup(void)
 {
 	_machine_restart = ls1x_restart;
 	_machine_halt = ls1x_halt;
-	pm_power_off = ls1x_power_off;
+	register_poweroff_handler_simple(ls1x_power_off, 0);
 
 	return 0;
 }
arch/mips/mti-malta/malta-reset.c +1 -1
index 2fd2cc2..632ce7c 100644
@@ -40,7 +40,7 @@ static int __init mips_reboot_setup(void)
 {
 	_machine_restart = mips_machine_restart;
 	_machine_halt = mips_machine_halt;
-	pm_power_off = mips_machine_power_off;
+	register_poweroff_handler_simple(mips_machine_power_off, 128);
 
 	return 0;
 }
arch/mips/mti-sead3/sead3-reset.c +1 -1
index e6fb244..d1df04f 100644
@@ -33,7 +33,7 @@ static int __init mips_reboot_setup(void)
 {
 	_machine_restart = mips_machine_restart;
 	_machine_halt = mips_machine_halt;
-	pm_power_off = mips_machine_halt;
+	register_poweroff_handler_simple(mips_machine_halt, 0);
 
 	return 0;
 }
arch/mips/netlogic/xlp/setup.c +1 -1
index 4fdd9fd..4982302 100644
@@ -106,7 +106,7 @@ void __init plat_mem_setup(void)
 #endif
 	_machine_restart = (void (*)(char *))nlm_linux_exit;
 	_machine_halt	= nlm_linux_exit;
-	pm_power_off	= nlm_linux_exit;
+	register_poweroff_handler_simple(nlm_linux_exit, 0);
 
 	/* memory and bootargs from DT */
 	xlp_early_init_devtree();
arch/mips/netlogic/xlr/setup.c +1 -1
index d118b9a..5149dd4 100644
@@ -75,7 +75,7 @@ void __init plat_mem_setup(void)
 {
 	_machine_restart = (void (*)(char *))nlm_linux_exit;
 	_machine_halt	= nlm_linux_exit;
-	pm_power_off	= nlm_linux_exit;
+	register_poweroff_handler_simple(nlm_linux_exit, 0);
 }
 
 const char *get_system_type(void)
arch/mips/pmcs-msp71xx/msp_setup.c +1 -1
index 4f925e0..67699e30 100644
@@ -144,7 +144,7 @@ void __init plat_mem_setup(void)
 {
 	_machine_restart = msp_restart;
 	_machine_halt = msp_halt;
-	pm_power_off = msp_power_off;
+	register_poweroff_handler_simple(msp_power_off, 0);
 }
 
 void __init prom_init(void)
arch/mips/pnx833x/common/setup.c +1 -1
index 99b4d94..7c12665 100644
@@ -51,7 +51,7 @@ int __init plat_mem_setup(void)
 
 	_machine_restart = pnx833x_machine_restart;
 	_machine_halt = pnx833x_machine_halt;
-	pm_power_off = pnx833x_machine_power_off;
+	register_poweroff_handler_simple(pnx833x_machine_power_off, 128);
 
 	/* IO/MEM resources. */
 	set_io_port_base(KSEG1);
arch/mips/ralink/reset.c +1 -1
index 55c7ec5..e640e9e 100644
@@ -98,7 +98,7 @@ static int __init mips_reboot_setup(void)
 {
 	_machine_restart = ralink_restart;
 	_machine_halt = ralink_halt;
-	pm_power_off = ralink_halt;
+	register_poweroff_handler_simple(ralink_halt, 0);
 
 	return 0;
 }
arch/mips/rb532/setup.c +1 -1
index d0c64e7..c71a623 100644
@@ -44,7 +44,7 @@ void __init plat_mem_setup(void)
 
 	_machine_restart = rb_machine_restart;
 	_machine_halt = rb_machine_halt;
-	pm_power_off = rb_machine_halt;
+	register_poweroff_handler-simple(rb_machine_halt, 0);
 
 	set_io_port_base(KSEG1);
 
arch/mips/sgi-ip22/ip22-reset.c +1 -1
index 063c2dd..466e710 100644
@@ -188,7 +188,7 @@ static int __init reboot_setup(void)
 
 	_machine_restart = sgi_machine_restart;
 	_machine_halt = sgi_machine_halt;
-	pm_power_off = sgi_machine_power_off;
+	register_poweroff_handler_simple(sgi_machine_power_off, 128);
 
 	res = request_irq(SGI_PANEL_IRQ, panel_int, 0, "Front Panel", NULL);
 	if (res) {
arch/mips/sgi-ip27/ip27-reset.c +1 -1
index ac37e54..c26f04a 100644
@@ -76,5 +76,5 @@ void ip27_reboot_setup(void)
 {
 	_machine_restart = ip27_machine_restart;
 	_machine_halt = ip27_machine_halt;
-	pm_power_off = ip27_machine_power_off;
+	register_poweroff_handler_simple(ip27_machine_power_off, 0);
 }
arch/mips/sgi-ip32/ip32-reset.c +1 -1
index 1f823da..88d8692 100644
@@ -189,7 +189,7 @@ static __init int ip32_reboot_setup(void)
 
 	_machine_restart = ip32_machine_restart;
 	_machine_halt = ip32_machine_halt;
-	pm_power_off = ip32_machine_power_off;
+	register_poweroff_handler_simple(ip32_machine_power_off, 0);
 
 	init_timer(&blink_timer);
 	blink_timer.function = blink_timeout;
arch/mips/sibyte/common/cfe.c +1 -1
index 588e180..069de27 100644
@@ -245,7 +245,7 @@ void __init prom_init(void)
 
 	_machine_restart   = cfe_linux_restart;
 	_machine_halt	   = cfe_linux_halt;
-	pm_power_off = cfe_linux_halt;
+	register_poweroff_handler_simple(cfe_linux_halt, 0);
 
 	/*
 	 * Check if a loader was used; if NOT, the 4 arguments are
arch/mips/sni/setup.c +1 -1
index efad85c..5242bd9 100644
@@ -225,7 +225,7 @@ void __init plat_mem_setup(void)
 	}
 
 	_machine_restart = sni_machine_restart;
-	pm_power_off = sni_machine_power_off;
+	register_poweroff_handler_simple(sni_machine_power_off, 128);
 
 	sni_display_setup();
 	sni_console_setup();
arch/mips/txx9/generic/setup.c +1 -1
index 9ff200a..c429a4f 100644
@@ -555,7 +555,7 @@ void __init plat_mem_setup(void)
 	/* fallback restart/halt routines */
 	_machine_restart = (void (*)(char *))txx9_machine_halt;
 	_machine_halt = txx9_machine_halt;
-	pm_power_off = txx9_machine_halt;
+	register_poweroff_handler_simple(txx9_machine_halt, 0);
 
 #ifdef CONFIG_PCI
 	pcibios_plat_setup = txx9_pcibios_setup;
arch/mips/vr41xx/common/pmu.c +1 -1
index d7f7558..4d947ab 100644
@@ -127,7 +127,7 @@ static int __init vr41xx_pmu_init(void)
 	cpu_wait = vr41xx_cpu_wait;
 	_machine_restart = vr41xx_restart;
 	_machine_halt = vr41xx_halt;
-	pm_power_off = vr41xx_halt;
+	register_poweroff_handler_simple(vr41xx_halt, 0);
 
 	return 0;
 }
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-metag" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author maintainer
#239 lore raw

PATCH 36/44 mips: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

If there is an indication that there can be more than one poweroff handler, use register_poweroff_handler, otherwise use register_poweroff_handler_simple to register the poweroff handler.

If the poweroff handler only resets or stops the system, select a priority of 0 to indicate that the poweroff handler is one of last resort. If the poweroff handler powers off the system, select a priority of 128, unless the poweroff handler installation code suggests that there can be more than one poweroff handler and the new handler is only installed conditionally. In this case, select a priority of 64.

Cc Ralf Baechle <[email protected]>
Cc Maciej W. Rozycki <[email protected]>
---
 arch/mips/alchemy/board-gpr.c          |  2 +-
 arch/mips/alchemy/board-mtx1.c         |  2 +-
 arch/mips/alchemy/board-xxs1500.c      |  2 +-
 arch/mips/alchemy/devboards/platform.c | 17 +++++++++++++++--
 arch/mips/ar7/setup.c                  |  2 +-
 arch/mips/ath79/setup.c                |  2 +-
 arch/mips/bcm47xx/setup.c              |  2 +-
 arch/mips/bcm63xx/setup.c              |  2 +-
 arch/mips/cobalt/setup.c               |  2 +-
 arch/mips/dec/setup.c                  |  2 +-
 arch/mips/emma/markeins/setup.c        |  2 +-
 arch/mips/jz4740/reset.c               |  2 +-
 arch/mips/lantiq/falcon/reset.c        |  2 +-
 arch/mips/lantiq/xway/reset.c          |  2 +-
 arch/mips/lasat/reset.c                |  2 +-
 arch/mips/loongson/common/reset.c      |  2 +-
 arch/mips/loongson1/common/reset.c     |  2 +-
 arch/mips/mti-malta/malta-reset.c      |  2 +-
 arch/mips/mti-sead3/sead3-reset.c      |  2 +-
 arch/mips/netlogic/xlp/setup.c         |  2 +-
 arch/mips/netlogic/xlr/setup.c         |  2 +-
 arch/mips/pmcs-msp71xx/msp_setup.c     |  2 +-
 arch/mips/pnx833x/common/setup.c       |  2 +-
 arch/mips/ralink/reset.c               |  2 +-
 arch/mips/rb532/setup.c                |  2 +-
 arch/mips/sgi-ip22/ip22-reset.c        |  2 +-
 arch/mips/sgi-ip27/ip27-reset.c        |  2 +-
 arch/mips/sgi-ip32/ip32-reset.c        |  2 +-
 arch/mips/sibyte/common/cfe.c          |  2 +-
 arch/mips/sni/setup.c                  |  2 +-
 arch/mips/txx9/generic/setup.c         |  2 +-
 arch/mips/vr41xx/common/pmu.c          |  2 +-
 32 files changed, 46 insertions(+), 33 deletions(-)
arch/mips/alchemy/board-gpr.c +1 -1
index acf9a2a..56190a3 100644
@@ -89,7 +89,7 @@ void __init board_setup(void)
 {
 	printk(KERN_INFO "Trapeze ITS GPR board\n");
 
-	pm_power_off = gpr_power_off;
+	register_poweroff_handler_simple(gpr_power_off, 0);
 	_machine_halt = gpr_power_off;
 	_machine_restart = gpr_reset;
 
arch/mips/alchemy/board-mtx1.c +1 -1
index 1e3b102..e2b06b5 100644
@@ -98,7 +98,7 @@ void __init board_setup(void)
 	alchemy_gpio_direction_output(211, 1);	/* green on */
 	alchemy_gpio_direction_output(212, 0);	/* red off */
 
-	pm_power_off = mtx1_power_off;
+	register_poweroff_handler_simple(mtx1_power_off, 0);
 	_machine_halt = mtx1_power_off;
 	_machine_restart = mtx1_reset;
 
arch/mips/alchemy/board-xxs1500.c +1 -1
index 0fc53e0..aaa5f5f 100644
@@ -79,7 +79,7 @@ void __init board_setup(void)
 {
 	u32 pin_func;
 
-	pm_power_off = xxs1500_power_off;
+	register_poweroff_handler_simple(xxs1500_power_off, 0);
 	_machine_halt = xxs1500_power_off;
 	_machine_restart = xxs1500_reset;
 
arch/mips/alchemy/devboards/platform.c +15 -2
index 8df86eb..1734f72 100644
@@ -6,6 +6,7 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/physmap.h>
+#include <linux/notifier.h>
 #include <linux/slab.h>
 #include <linux/platform_device.h>
 #include <linux/pm.h>
@@ -61,10 +62,22 @@ static void db1x_reset(char *c)
 	bcsr_write(BCSR_SYSTEM, 0);
 }
 
+static int db1x_power_off_notify(struct notifier *this,
+				 unsigned long unused1, void *unused2)
+{
+	db1x_power_off();
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block db1x_poweroff_nb = {
+	.notifier_call = db1x_power_off_notify,
+	.priority = 64,
+}
+
 static int __init db1x_late_setup(void)
 {
-	if (!pm_power_off)
-		pm_power_off = db1x_power_off;
+	if (register_poweroff_handler(&db1x_poweroff_nb))
+		pr_err("dbx1: Failed to register poweroff handler\n");
 	if (!_machine_halt)
 		_machine_halt = db1x_power_off;
 	if (!_machine_restart)
arch/mips/ar7/setup.c +1 -1
index 820b7a3..464067e 100644
@@ -91,7 +91,7 @@ void __init plat_mem_setup(void)
 
 	_machine_restart = ar7_machine_restart;
 	_machine_halt = ar7_machine_halt;
-	pm_power_off = ar7_machine_power_off;
+	register_poweroff_handler_simple(ar7_machine_power_off, 128);
 
 	io_base = (unsigned long)ioremap(AR7_REGS_BASE, 0x10000);
 	if (!io_base)
arch/mips/ath79/setup.c +1 -1
index 64807a4..ce9754e 100644
@@ -203,7 +203,7 @@ void __init plat_mem_setup(void)
 
 	_machine_restart = ath79_restart;
 	_machine_halt = ath79_halt;
-	pm_power_off = ath79_halt;
+	register_poweroff_handler_simple(ath79_halt, 0);
 }
 
 void __init plat_time_init(void)
arch/mips/bcm47xx/setup.c +1 -1
index ad439c2..d0841f6 100644
@@ -242,7 +242,7 @@ void __init plat_mem_setup(void)
 
 	_machine_restart = bcm47xx_machine_restart;
 	_machine_halt = bcm47xx_machine_halt;
-	pm_power_off = bcm47xx_machine_halt;
+	register_poweroff_handler_simple(bcm47xx_machine_halt, 0);
 	bcm47xx_board_detect();
 	mips_set_machine_name(bcm47xx_board_get_name());
 }
arch/mips/bcm63xx/setup.c +1 -1
index 6660c7d..80a5893 100644
@@ -149,7 +149,7 @@ void __init plat_mem_setup(void)
 
 	_machine_halt = bcm63xx_machine_halt;
 	_machine_restart = __bcm63xx_machine_reboot;
-	pm_power_off = bcm63xx_machine_halt;
+	register_poweroff_handler_simple(bcm63xx_machine_halt, 0);
 
 	set_io_port_base(0);
 	ioport_resource.start = 0;
arch/mips/cobalt/setup.c +1 -1
index 9a8c2fe..146406f 100644
@@ -78,7 +78,7 @@ void __init plat_mem_setup(void)
 
 	_machine_restart = cobalt_machine_restart;
 	_machine_halt = cobalt_machine_halt;
-	pm_power_off = cobalt_machine_halt;
+	register_poweroff_handler_simple(cobalt_machine_halt, 0);
 
 	set_io_port_base(CKSEG1ADDR(GT_DEF_PCI0_IO_BASE));
 
arch/mips/dec/setup.c +1 -1
index 41bbffd..8aea997 100644
@@ -158,7 +158,7 @@ void __init plat_mem_setup(void)
 
 	_machine_restart = dec_machine_restart;
 	_machine_halt = dec_machine_halt;
-	pm_power_off = dec_machine_power_off;
+	register_poweroff_handler_simple(dec_machine_power_off, 128);
 
 	ioport_resource.start = ~0UL;
 	ioport_resource.end = 0UL;
arch/mips/emma/markeins/setup.c +1 -1
index 9100122..e2ec2e5 100644
@@ -103,7 +103,7 @@ void __init plat_mem_setup(void)
 
 	_machine_restart = markeins_machine_restart;
 	_machine_halt = markeins_machine_halt;
-	pm_power_off = markeins_machine_power_off;
+	register_poweroff_handler_simple(markeins_machine_power_off, 0);
 
 	/* setup resource limits */
 	ioport_resource.start = EMMA2RH_PCI_IO_BASE;
arch/mips/jz4740/reset.c +1 -1
index b6c6343..3659e62 100644
@@ -114,5 +114,5 @@ void jz4740_reset_init(void)
 {
 	_machine_restart = jz4740_restart;
 	_machine_halt = jz4740_halt;
-	pm_power_off = jz4740_power_off;
+	register_poweroff_handler_simple(jz4740_power_off, 128);
 }
arch/mips/lantiq/falcon/reset.c +1 -1
index 5682482..efd4ee2 100644
@@ -83,7 +83,7 @@ static int __init mips_reboot_setup(void)
 {
 	_machine_restart = machine_restart;
 	_machine_halt = machine_halt;
-	pm_power_off = machine_power_off;
+	register_poweroff_handler_simple(machine_power_off, 0);
 	return 0;
 }
 
arch/mips/lantiq/xway/reset.c +1 -1
index 1fa0f17..b698032 100644
@@ -157,7 +157,7 @@ static int __init mips_reboot_setup(void)
 
 	_machine_restart = ltq_machine_restart;
 	_machine_halt = ltq_machine_halt;
-	pm_power_off = ltq_machine_power_off;
+	register_poweroff_handler_simple(ltq_machine_power_off, 0);
 
 	return 0;
 }
arch/mips/lasat/reset.c +1 -1
index e21f0b9..9a07a88 100644
@@ -56,5 +56,5 @@ void lasat_reboot_setup(void)
 {
 	_machine_restart = lasat_machine_restart;
 	_machine_halt = lasat_machine_halt;
-	pm_power_off = lasat_machine_halt;
+	register_poweroff_handler_simple(lasat_machine_halt, 0);
 }
arch/mips/loongson/common/reset.c +1 -1
index a60715e..e251519 100644
@@ -84,7 +84,7 @@ static int __init mips_reboot_setup(void)
 {
 	_machine_restart = loongson_restart;
 	_machine_halt = loongson_halt;
-	pm_power_off = loongson_poweroff;
+	register_poweroff_handler_simple(loongson_poweroff, 128);
 
 	return 0;
 }
arch/mips/loongson1/common/reset.c +1 -1
index 547f34b..fbb563a 100644
@@ -38,7 +38,7 @@ static int __init ls1x_reboot_setup(void)
 {
 	_machine_restart = ls1x_restart;
 	_machine_halt = ls1x_halt;
-	pm_power_off = ls1x_power_off;
+	register_poweroff_handler_simple(ls1x_power_off, 0);
 
 	return 0;
 }
arch/mips/mti-malta/malta-reset.c +1 -1
index 2fd2cc2..632ce7c 100644
@@ -40,7 +40,7 @@ static int __init mips_reboot_setup(void)
 {
 	_machine_restart = mips_machine_restart;
 	_machine_halt = mips_machine_halt;
-	pm_power_off = mips_machine_power_off;
+	register_poweroff_handler_simple(mips_machine_power_off, 128);
 
 	return 0;
 }
arch/mips/mti-sead3/sead3-reset.c +1 -1
index e6fb244..d1df04f 100644
@@ -33,7 +33,7 @@ static int __init mips_reboot_setup(void)
 {
 	_machine_restart = mips_machine_restart;
 	_machine_halt = mips_machine_halt;
-	pm_power_off = mips_machine_halt;
+	register_poweroff_handler_simple(mips_machine_halt, 0);
 
 	return 0;
 }
arch/mips/netlogic/xlp/setup.c +1 -1
index 4fdd9fd..4982302 100644
@@ -106,7 +106,7 @@ void __init plat_mem_setup(void)
 #endif
 	_machine_restart = (void (*)(char *))nlm_linux_exit;
 	_machine_halt	= nlm_linux_exit;
-	pm_power_off	= nlm_linux_exit;
+	register_poweroff_handler_simple(nlm_linux_exit, 0);
 
 	/* memory and bootargs from DT */
 	xlp_early_init_devtree();
arch/mips/netlogic/xlr/setup.c +1 -1
index d118b9a..5149dd4 100644
@@ -75,7 +75,7 @@ void __init plat_mem_setup(void)
 {
 	_machine_restart = (void (*)(char *))nlm_linux_exit;
 	_machine_halt	= nlm_linux_exit;
-	pm_power_off	= nlm_linux_exit;
+	register_poweroff_handler_simple(nlm_linux_exit, 0);
 }
 
 const char *get_system_type(void)
arch/mips/pmcs-msp71xx/msp_setup.c +1 -1
index 4f925e0..67699e30 100644
@@ -144,7 +144,7 @@ void __init plat_mem_setup(void)
 {
 	_machine_restart = msp_restart;
 	_machine_halt = msp_halt;
-	pm_power_off = msp_power_off;
+	register_poweroff_handler_simple(msp_power_off, 0);
 }
 
 void __init prom_init(void)
arch/mips/pnx833x/common/setup.c +1 -1
index 99b4d94..7c12665 100644
@@ -51,7 +51,7 @@ int __init plat_mem_setup(void)
 
 	_machine_restart = pnx833x_machine_restart;
 	_machine_halt = pnx833x_machine_halt;
-	pm_power_off = pnx833x_machine_power_off;
+	register_poweroff_handler_simple(pnx833x_machine_power_off, 128);
 
 	/* IO/MEM resources. */
 	set_io_port_base(KSEG1);
arch/mips/ralink/reset.c +1 -1
index 55c7ec5..e640e9e 100644
@@ -98,7 +98,7 @@ static int __init mips_reboot_setup(void)
 {
 	_machine_restart = ralink_restart;
 	_machine_halt = ralink_halt;
-	pm_power_off = ralink_halt;
+	register_poweroff_handler_simple(ralink_halt, 0);
 
 	return 0;
 }
arch/mips/rb532/setup.c +1 -1
index d0c64e7..c71a623 100644
@@ -44,7 +44,7 @@ void __init plat_mem_setup(void)
 
 	_machine_restart = rb_machine_restart;
 	_machine_halt = rb_machine_halt;
-	pm_power_off = rb_machine_halt;
+	register_poweroff_handler-simple(rb_machine_halt, 0);
 
 	set_io_port_base(KSEG1);
 
arch/mips/sgi-ip22/ip22-reset.c +1 -1
index 063c2dd..466e710 100644
@@ -188,7 +188,7 @@ static int __init reboot_setup(void)
 
 	_machine_restart = sgi_machine_restart;
 	_machine_halt = sgi_machine_halt;
-	pm_power_off = sgi_machine_power_off;
+	register_poweroff_handler_simple(sgi_machine_power_off, 128);
 
 	res = request_irq(SGI_PANEL_IRQ, panel_int, 0, "Front Panel", NULL);
 	if (res) {
arch/mips/sgi-ip27/ip27-reset.c +1 -1
index ac37e54..c26f04a 100644
@@ -76,5 +76,5 @@ void ip27_reboot_setup(void)
 {
 	_machine_restart = ip27_machine_restart;
 	_machine_halt = ip27_machine_halt;
-	pm_power_off = ip27_machine_power_off;
+	register_poweroff_handler_simple(ip27_machine_power_off, 0);
 }
arch/mips/sgi-ip32/ip32-reset.c +1 -1
index 1f823da..88d8692 100644
@@ -189,7 +189,7 @@ static __init int ip32_reboot_setup(void)
 
 	_machine_restart = ip32_machine_restart;
 	_machine_halt = ip32_machine_halt;
-	pm_power_off = ip32_machine_power_off;
+	register_poweroff_handler_simple(ip32_machine_power_off, 0);
 
 	init_timer(&blink_timer);
 	blink_timer.function = blink_timeout;
arch/mips/sibyte/common/cfe.c +1 -1
index 588e180..069de27 100644
@@ -245,7 +245,7 @@ void __init prom_init(void)
 
 	_machine_restart   = cfe_linux_restart;
 	_machine_halt	   = cfe_linux_halt;
-	pm_power_off = cfe_linux_halt;
+	register_poweroff_handler_simple(cfe_linux_halt, 0);
 
 	/*
 	 * Check if a loader was used; if NOT, the 4 arguments are
arch/mips/sni/setup.c +1 -1
index efad85c..5242bd9 100644
@@ -225,7 +225,7 @@ void __init plat_mem_setup(void)
 	}
 
 	_machine_restart = sni_machine_restart;
-	pm_power_off = sni_machine_power_off;
+	register_poweroff_handler_simple(sni_machine_power_off, 128);
 
 	sni_display_setup();
 	sni_console_setup();
arch/mips/txx9/generic/setup.c +1 -1
index 9ff200a..c429a4f 100644
@@ -555,7 +555,7 @@ void __init plat_mem_setup(void)
 	/* fallback restart/halt routines */
 	_machine_restart = (void (*)(char *))txx9_machine_halt;
 	_machine_halt = txx9_machine_halt;
-	pm_power_off = txx9_machine_halt;
+	register_poweroff_handler_simple(txx9_machine_halt, 0);
 
 #ifdef CONFIG_PCI
 	pcibios_plat_setup = txx9_pcibios_setup;
arch/mips/vr41xx/common/pmu.c +1 -1
index d7f7558..4d947ab 100644
@@ -127,7 +127,7 @@ static int __init vr41xx_pmu_init(void)
 	cpu_wait = vr41xx_cpu_wait;
 	_machine_restart = vr41xx_restart;
 	_machine_halt = vr41xx_halt;
-	pm_power_off = vr41xx_halt;
+	register_poweroff_handler_simple(vr41xx_halt, 0);
 
 	return 0;
 }
Signature · 1 line
1.9.1
author maintainer
#240 lore raw

PATCH 36/44 mips: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

If there is an indication that there can be more than one poweroff handler, use register_poweroff_handler, otherwise use register_poweroff_handler_simple to register the poweroff handler.

If the poweroff handler only resets or stops the system, select a priority of 0 to indicate that the poweroff handler is one of last resort. If the poweroff handler powers off the system, select a priority of 128, unless the poweroff handler installation code suggests that there can be more than one poweroff handler and the new handler is only installed conditionally. In this case, select a priority of 64.

Cc Ralf Baechle <[email protected]>
Cc Maciej W. Rozycki <[email protected]>
---
 arch/mips/alchemy/board-gpr.c          |  2 +-
 arch/mips/alchemy/board-mtx1.c         |  2 +-
 arch/mips/alchemy/board-xxs1500.c      |  2 +-
 arch/mips/alchemy/devboards/platform.c | 17 +++++++++++++++--
 arch/mips/ar7/setup.c                  |  2 +-
 arch/mips/ath79/setup.c                |  2 +-
 arch/mips/bcm47xx/setup.c              |  2 +-
 arch/mips/bcm63xx/setup.c              |  2 +-
 arch/mips/cobalt/setup.c               |  2 +-
 arch/mips/dec/setup.c                  |  2 +-
 arch/mips/emma/markeins/setup.c        |  2 +-
 arch/mips/jz4740/reset.c               |  2 +-
 arch/mips/lantiq/falcon/reset.c        |  2 +-
 arch/mips/lantiq/xway/reset.c          |  2 +-
 arch/mips/lasat/reset.c                |  2 +-
 arch/mips/loongson/common/reset.c      |  2 +-
 arch/mips/loongson1/common/reset.c     |  2 +-
 arch/mips/mti-malta/malta-reset.c      |  2 +-
 arch/mips/mti-sead3/sead3-reset.c      |  2 +-
 arch/mips/netlogic/xlp/setup.c         |  2 +-
 arch/mips/netlogic/xlr/setup.c         |  2 +-
 arch/mips/pmcs-msp71xx/msp_setup.c     |  2 +-
 arch/mips/pnx833x/common/setup.c       |  2 +-
 arch/mips/ralink/reset.c               |  2 +-
 arch/mips/rb532/setup.c                |  2 +-
 arch/mips/sgi-ip22/ip22-reset.c        |  2 +-
 arch/mips/sgi-ip27/ip27-reset.c        |  2 +-
 arch/mips/sgi-ip32/ip32-reset.c        |  2 +-
 arch/mips/sibyte/common/cfe.c          |  2 +-
 arch/mips/sni/setup.c                  |  2 +-
 arch/mips/txx9/generic/setup.c         |  2 +-
 arch/mips/vr41xx/common/pmu.c          |  2 +-
 32 files changed, 46 insertions(+), 33 deletions(-)
arch/mips/alchemy/board-gpr.c +1 -1
index acf9a2a..56190a3 100644
@@ -89,7 +89,7 @@ void __init board_setup(void)
 {
 	printk(KERN_INFO "Trapeze ITS GPR board\n");
 
-	pm_power_off = gpr_power_off;
+	register_poweroff_handler_simple(gpr_power_off, 0);
 	_machine_halt = gpr_power_off;
 	_machine_restart = gpr_reset;
 
arch/mips/alchemy/board-mtx1.c +1 -1
index 1e3b102..e2b06b5 100644
@@ -98,7 +98,7 @@ void __init board_setup(void)
 	alchemy_gpio_direction_output(211, 1);	/* green on */
 	alchemy_gpio_direction_output(212, 0);	/* red off */
 
-	pm_power_off = mtx1_power_off;
+	register_poweroff_handler_simple(mtx1_power_off, 0);
 	_machine_halt = mtx1_power_off;
 	_machine_restart = mtx1_reset;
 
arch/mips/alchemy/board-xxs1500.c +1 -1
index 0fc53e0..aaa5f5f 100644
@@ -79,7 +79,7 @@ void __init board_setup(void)
 {
 	u32 pin_func;
 
-	pm_power_off = xxs1500_power_off;
+	register_poweroff_handler_simple(xxs1500_power_off, 0);
 	_machine_halt = xxs1500_power_off;
 	_machine_restart = xxs1500_reset;
 
arch/mips/alchemy/devboards/platform.c +15 -2
index 8df86eb..1734f72 100644
@@ -6,6 +6,7 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/physmap.h>
+#include <linux/notifier.h>
 #include <linux/slab.h>
 #include <linux/platform_device.h>
 #include <linux/pm.h>
@@ -61,10 +62,22 @@ static void db1x_reset(char *c)
 	bcsr_write(BCSR_SYSTEM, 0);
 }
 
+static int db1x_power_off_notify(struct notifier *this,
+				 unsigned long unused1, void *unused2)
+{
+	db1x_power_off();
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block db1x_poweroff_nb = {
+	.notifier_call = db1x_power_off_notify,
+	.priority = 64,
+}
+
 static int __init db1x_late_setup(void)
 {
-	if (!pm_power_off)
-		pm_power_off = db1x_power_off;
+	if (register_poweroff_handler(&db1x_poweroff_nb))
+		pr_err("dbx1: Failed to register poweroff handler\n");
 	if (!_machine_halt)
 		_machine_halt = db1x_power_off;
 	if (!_machine_restart)
arch/mips/ar7/setup.c +1 -1
index 820b7a3..464067e 100644
@@ -91,7 +91,7 @@ void __init plat_mem_setup(void)
 
 	_machine_restart = ar7_machine_restart;
 	_machine_halt = ar7_machine_halt;
-	pm_power_off = ar7_machine_power_off;
+	register_poweroff_handler_simple(ar7_machine_power_off, 128);
 
 	io_base = (unsigned long)ioremap(AR7_REGS_BASE, 0x10000);
 	if (!io_base)
arch/mips/ath79/setup.c +1 -1
index 64807a4..ce9754e 100644
@@ -203,7 +203,7 @@ void __init plat_mem_setup(void)
 
 	_machine_restart = ath79_restart;
 	_machine_halt = ath79_halt;
-	pm_power_off = ath79_halt;
+	register_poweroff_handler_simple(ath79_halt, 0);
 }
 
 void __init plat_time_init(void)
arch/mips/bcm47xx/setup.c +1 -1
index ad439c2..d0841f6 100644
@@ -242,7 +242,7 @@ void __init plat_mem_setup(void)
 
 	_machine_restart = bcm47xx_machine_restart;
 	_machine_halt = bcm47xx_machine_halt;
-	pm_power_off = bcm47xx_machine_halt;
+	register_poweroff_handler_simple(bcm47xx_machine_halt, 0);
 	bcm47xx_board_detect();
 	mips_set_machine_name(bcm47xx_board_get_name());
 }
arch/mips/bcm63xx/setup.c +1 -1
index 6660c7d..80a5893 100644
@@ -149,7 +149,7 @@ void __init plat_mem_setup(void)
 
 	_machine_halt = bcm63xx_machine_halt;
 	_machine_restart = __bcm63xx_machine_reboot;
-	pm_power_off = bcm63xx_machine_halt;
+	register_poweroff_handler_simple(bcm63xx_machine_halt, 0);
 
 	set_io_port_base(0);
 	ioport_resource.start = 0;
arch/mips/cobalt/setup.c +1 -1
index 9a8c2fe..146406f 100644
@@ -78,7 +78,7 @@ void __init plat_mem_setup(void)
 
 	_machine_restart = cobalt_machine_restart;
 	_machine_halt = cobalt_machine_halt;
-	pm_power_off = cobalt_machine_halt;
+	register_poweroff_handler_simple(cobalt_machine_halt, 0);
 
 	set_io_port_base(CKSEG1ADDR(GT_DEF_PCI0_IO_BASE));
 
arch/mips/dec/setup.c +1 -1
index 41bbffd..8aea997 100644
@@ -158,7 +158,7 @@ void __init plat_mem_setup(void)
 
 	_machine_restart = dec_machine_restart;
 	_machine_halt = dec_machine_halt;
-	pm_power_off = dec_machine_power_off;
+	register_poweroff_handler_simple(dec_machine_power_off, 128);
 
 	ioport_resource.start = ~0UL;
 	ioport_resource.end = 0UL;
arch/mips/emma/markeins/setup.c +1 -1
index 9100122..e2ec2e5 100644
@@ -103,7 +103,7 @@ void __init plat_mem_setup(void)
 
 	_machine_restart = markeins_machine_restart;
 	_machine_halt = markeins_machine_halt;
-	pm_power_off = markeins_machine_power_off;
+	register_poweroff_handler_simple(markeins_machine_power_off, 0);
 
 	/* setup resource limits */
 	ioport_resource.start = EMMA2RH_PCI_IO_BASE;
arch/mips/jz4740/reset.c +1 -1
index b6c6343..3659e62 100644
@@ -114,5 +114,5 @@ void jz4740_reset_init(void)
 {
 	_machine_restart = jz4740_restart;
 	_machine_halt = jz4740_halt;
-	pm_power_off = jz4740_power_off;
+	register_poweroff_handler_simple(jz4740_power_off, 128);
 }
arch/mips/lantiq/falcon/reset.c +1 -1
index 5682482..efd4ee2 100644
@@ -83,7 +83,7 @@ static int __init mips_reboot_setup(void)
 {
 	_machine_restart = machine_restart;
 	_machine_halt = machine_halt;
-	pm_power_off = machine_power_off;
+	register_poweroff_handler_simple(machine_power_off, 0);
 	return 0;
 }
 
arch/mips/lantiq/xway/reset.c +1 -1
index 1fa0f17..b698032 100644
@@ -157,7 +157,7 @@ static int __init mips_reboot_setup(void)
 
 	_machine_restart = ltq_machine_restart;
 	_machine_halt = ltq_machine_halt;
-	pm_power_off = ltq_machine_power_off;
+	register_poweroff_handler_simple(ltq_machine_power_off, 0);
 
 	return 0;
 }
arch/mips/lasat/reset.c +1 -1
index e21f0b9..9a07a88 100644
@@ -56,5 +56,5 @@ void lasat_reboot_setup(void)
 {
 	_machine_restart = lasat_machine_restart;
 	_machine_halt = lasat_machine_halt;
-	pm_power_off = lasat_machine_halt;
+	register_poweroff_handler_simple(lasat_machine_halt, 0);
 }
arch/mips/loongson/common/reset.c +1 -1
index a60715e..e251519 100644
@@ -84,7 +84,7 @@ static int __init mips_reboot_setup(void)
 {
 	_machine_restart = loongson_restart;
 	_machine_halt = loongson_halt;
-	pm_power_off = loongson_poweroff;
+	register_poweroff_handler_simple(loongson_poweroff, 128);
 
 	return 0;
 }
arch/mips/loongson1/common/reset.c +1 -1
index 547f34b..fbb563a 100644
@@ -38,7 +38,7 @@ static int __init ls1x_reboot_setup(void)
 {
 	_machine_restart = ls1x_restart;
 	_machine_halt = ls1x_halt;
-	pm_power_off = ls1x_power_off;
+	register_poweroff_handler_simple(ls1x_power_off, 0);
 
 	return 0;
 }
arch/mips/mti-malta/malta-reset.c +1 -1
index 2fd2cc2..632ce7c 100644
@@ -40,7 +40,7 @@ static int __init mips_reboot_setup(void)
 {
 	_machine_restart = mips_machine_restart;
 	_machine_halt = mips_machine_halt;
-	pm_power_off = mips_machine_power_off;
+	register_poweroff_handler_simple(mips_machine_power_off, 128);
 
 	return 0;
 }
arch/mips/mti-sead3/sead3-reset.c +1 -1
index e6fb244..d1df04f 100644
@@ -33,7 +33,7 @@ static int __init mips_reboot_setup(void)
 {
 	_machine_restart = mips_machine_restart;
 	_machine_halt = mips_machine_halt;
-	pm_power_off = mips_machine_halt;
+	register_poweroff_handler_simple(mips_machine_halt, 0);
 
 	return 0;
 }
arch/mips/netlogic/xlp/setup.c +1 -1
index 4fdd9fd..4982302 100644
@@ -106,7 +106,7 @@ void __init plat_mem_setup(void)
 #endif
 	_machine_restart = (void (*)(char *))nlm_linux_exit;
 	_machine_halt	= nlm_linux_exit;
-	pm_power_off	= nlm_linux_exit;
+	register_poweroff_handler_simple(nlm_linux_exit, 0);
 
 	/* memory and bootargs from DT */
 	xlp_early_init_devtree();
arch/mips/netlogic/xlr/setup.c +1 -1
index d118b9a..5149dd4 100644
@@ -75,7 +75,7 @@ void __init plat_mem_setup(void)
 {
 	_machine_restart = (void (*)(char *))nlm_linux_exit;
 	_machine_halt	= nlm_linux_exit;
-	pm_power_off	= nlm_linux_exit;
+	register_poweroff_handler_simple(nlm_linux_exit, 0);
 }
 
 const char *get_system_type(void)
arch/mips/pmcs-msp71xx/msp_setup.c +1 -1
index 4f925e0..67699e30 100644
@@ -144,7 +144,7 @@ void __init plat_mem_setup(void)
 {
 	_machine_restart = msp_restart;
 	_machine_halt = msp_halt;
-	pm_power_off = msp_power_off;
+	register_poweroff_handler_simple(msp_power_off, 0);
 }
 
 void __init prom_init(void)
arch/mips/pnx833x/common/setup.c +1 -1
index 99b4d94..7c12665 100644
@@ -51,7 +51,7 @@ int __init plat_mem_setup(void)
 
 	_machine_restart = pnx833x_machine_restart;
 	_machine_halt = pnx833x_machine_halt;
-	pm_power_off = pnx833x_machine_power_off;
+	register_poweroff_handler_simple(pnx833x_machine_power_off, 128);
 
 	/* IO/MEM resources. */
 	set_io_port_base(KSEG1);
arch/mips/ralink/reset.c +1 -1
index 55c7ec5..e640e9e 100644
@@ -98,7 +98,7 @@ static int __init mips_reboot_setup(void)
 {
 	_machine_restart = ralink_restart;
 	_machine_halt = ralink_halt;
-	pm_power_off = ralink_halt;
+	register_poweroff_handler_simple(ralink_halt, 0);
 
 	return 0;
 }
arch/mips/rb532/setup.c +1 -1
index d0c64e7..c71a623 100644
@@ -44,7 +44,7 @@ void __init plat_mem_setup(void)
 
 	_machine_restart = rb_machine_restart;
 	_machine_halt = rb_machine_halt;
-	pm_power_off = rb_machine_halt;
+	register_poweroff_handler-simple(rb_machine_halt, 0);
 
 	set_io_port_base(KSEG1);
 
arch/mips/sgi-ip22/ip22-reset.c +1 -1
index 063c2dd..466e710 100644
@@ -188,7 +188,7 @@ static int __init reboot_setup(void)
 
 	_machine_restart = sgi_machine_restart;
 	_machine_halt = sgi_machine_halt;
-	pm_power_off = sgi_machine_power_off;
+	register_poweroff_handler_simple(sgi_machine_power_off, 128);
 
 	res = request_irq(SGI_PANEL_IRQ, panel_int, 0, "Front Panel", NULL);
 	if (res) {
arch/mips/sgi-ip27/ip27-reset.c +1 -1
index ac37e54..c26f04a 100644
@@ -76,5 +76,5 @@ void ip27_reboot_setup(void)
 {
 	_machine_restart = ip27_machine_restart;
 	_machine_halt = ip27_machine_halt;
-	pm_power_off = ip27_machine_power_off;
+	register_poweroff_handler_simple(ip27_machine_power_off, 0);
 }
arch/mips/sgi-ip32/ip32-reset.c +1 -1
index 1f823da..88d8692 100644
@@ -189,7 +189,7 @@ static __init int ip32_reboot_setup(void)
 
 	_machine_restart = ip32_machine_restart;
 	_machine_halt = ip32_machine_halt;
-	pm_power_off = ip32_machine_power_off;
+	register_poweroff_handler_simple(ip32_machine_power_off, 0);
 
 	init_timer(&blink_timer);
 	blink_timer.function = blink_timeout;
arch/mips/sibyte/common/cfe.c +1 -1
index 588e180..069de27 100644
@@ -245,7 +245,7 @@ void __init prom_init(void)
 
 	_machine_restart   = cfe_linux_restart;
 	_machine_halt	   = cfe_linux_halt;
-	pm_power_off = cfe_linux_halt;
+	register_poweroff_handler_simple(cfe_linux_halt, 0);
 
 	/*
 	 * Check if a loader was used; if NOT, the 4 arguments are
arch/mips/sni/setup.c +1 -1
index efad85c..5242bd9 100644
@@ -225,7 +225,7 @@ void __init plat_mem_setup(void)
 	}
 
 	_machine_restart = sni_machine_restart;
-	pm_power_off = sni_machine_power_off;
+	register_poweroff_handler_simple(sni_machine_power_off, 128);
 
 	sni_display_setup();
 	sni_console_setup();
arch/mips/txx9/generic/setup.c +1 -1
index 9ff200a..c429a4f 100644
@@ -555,7 +555,7 @@ void __init plat_mem_setup(void)
 	/* fallback restart/halt routines */
 	_machine_restart = (void (*)(char *))txx9_machine_halt;
 	_machine_halt = txx9_machine_halt;
-	pm_power_off = txx9_machine_halt;
+	register_poweroff_handler_simple(txx9_machine_halt, 0);
 
 #ifdef CONFIG_PCI
 	pcibios_plat_setup = txx9_pcibios_setup;
arch/mips/vr41xx/common/pmu.c +1 -1
index d7f7558..4d947ab 100644
@@ -127,7 +127,7 @@ static int __init vr41xx_pmu_init(void)
 	cpu_wait = vr41xx_cpu_wait;
 	_machine_restart = vr41xx_restart;
 	_machine_halt = vr41xx_halt;
-	pm_power_off = vr41xx_halt;
+	register_poweroff_handler_simple(vr41xx_halt, 0);
 
 	return 0;
 }
Signature · 1 line
1.9.1
author maintainer
#241 lore raw

PATCH 37/44 sh: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

---
 arch/sh/boards/board-sh7785lcr.c       | 2 +-
 arch/sh/boards/board-urquell.c         | 2 +-
 arch/sh/boards/mach-highlander/setup.c | 2 +-
 arch/sh/boards/mach-landisk/setup.c    | 2 +-
 arch/sh/boards/mach-r2d/setup.c        | 2 +-
 arch/sh/boards/mach-sdk7786/setup.c    | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)
arch/sh/boards/board-sh7785lcr.c +1 -1
index 2c4771e..c092402 100644
@@ -332,7 +332,7 @@ static void __init sh7785lcr_setup(char **cmdline_p)
 
 	printk(KERN_INFO "Renesas Technology Corp. R0P7785LC0011RL support.\n");
 
-	pm_power_off = sh7785lcr_power_off;
+	register_poweroff_handler_simple(sh7785lcr_power_off, 128);
 
 	/* sm501 DRAM configuration */
 	sm501_reg = ioremap_nocache(SM107_REG_ADDR, SM501_DRAM_CONTROL);
arch/sh/boards/board-urquell.c +1 -1
index b52abcc..b3fa56f 100644
@@ -204,7 +204,7 @@ static void __init urquell_setup(char **cmdline_p)
 {
 	printk(KERN_INFO "Renesas Technology Corp. Urquell support.\n");
 
-	pm_power_off = urquell_power_off;
+	register_poweroff_handler_simple(urquell_power_off, 128);
 
 	register_smp_ops(&shx3_smp_ops);
 }
arch/sh/boards/mach-highlander/setup.c +1 -1
index 4a52590..998f1a5 100644
@@ -385,7 +385,7 @@ static void __init highlander_setup(char **cmdline_p)
 
 	__raw_writew(__raw_readw(PA_IVDRCTL) | 0x01, PA_IVDRCTL);	/* Si13112 */
 
-	pm_power_off = r7780rp_power_off;
+	register_poweroff_handler_simple(r7780rp_power_off, 128);
 }
 
 static unsigned char irl2irq[HL_NR_IRL];
arch/sh/boards/mach-landisk/setup.c +1 -1
index f1147ca..c817d80 100644
@@ -89,7 +89,7 @@ static void __init landisk_setup(char **cmdline_p)
 	__raw_writeb(__raw_readb(PA_LED) | 0x03, PA_LED);
 
 	printk(KERN_INFO "I-O DATA DEVICE, INC. \"LANDISK Series\" support.\n");
-	pm_power_off = landisk_power_off;
+	register_poweroff_handler_simple(landisk_power_off, 128);
 }
 
 /*
arch/sh/boards/mach-r2d/setup.c +1 -1
index 4b98a52..a759d39 100644
@@ -279,7 +279,7 @@ static void __init rts7751r2d_setup(char **cmdline_p)
 					(ver >> 4) & 0xf, ver & 0xf);
 
 	__raw_writew(0x0000, PA_OUTPORT);
-	pm_power_off = rts7751r2d_power_off;
+	register_poweroff_handler_simple(rts7751r2d_power_off, 128);
 
 	/* sm501 dram configuration:
 	 * ColSizeX = 11 - External Memory Column Size: 256 words.
arch/sh/boards/mach-sdk7786/setup.c +1 -1
index c29268b..cb26336 100644
@@ -252,7 +252,7 @@ static void __init sdk7786_setup(char **cmdline_p)
 	pr_info("\tPCB revision:\t%d\n", fpga_read_reg(PCBRR) & 0xf);
 
 	machine_ops.restart = sdk7786_restart;
-	pm_power_off = sdk7786_power_off;
+	register_poweroff_handler_simple(sdk7786_power_off, 128);
 
 	register_smp_ops(&shx3_smp_ops);
 }
Signature · 1 line
1.9.1
author maintainer
#242 lore raw

PATCH 37/44 sh: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

---
 arch/sh/boards/board-sh7785lcr.c       | 2 +-
 arch/sh/boards/board-urquell.c         | 2 +-
 arch/sh/boards/mach-highlander/setup.c | 2 +-
 arch/sh/boards/mach-landisk/setup.c    | 2 +-
 arch/sh/boards/mach-r2d/setup.c        | 2 +-
 arch/sh/boards/mach-sdk7786/setup.c    | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)
arch/sh/boards/board-sh7785lcr.c +1 -1
index 2c4771e..c092402 100644
@@ -332,7 +332,7 @@ static void __init sh7785lcr_setup(char **cmdline_p)
 
 	printk(KERN_INFO "Renesas Technology Corp. R0P7785LC0011RL support.\n");
 
-	pm_power_off = sh7785lcr_power_off;
+	register_poweroff_handler_simple(sh7785lcr_power_off, 128);
 
 	/* sm501 DRAM configuration */
 	sm501_reg = ioremap_nocache(SM107_REG_ADDR, SM501_DRAM_CONTROL);
arch/sh/boards/board-urquell.c +1 -1
index b52abcc..b3fa56f 100644
@@ -204,7 +204,7 @@ static void __init urquell_setup(char **cmdline_p)
 {
 	printk(KERN_INFO "Renesas Technology Corp. Urquell support.\n");
 
-	pm_power_off = urquell_power_off;
+	register_poweroff_handler_simple(urquell_power_off, 128);
 
 	register_smp_ops(&shx3_smp_ops);
 }
arch/sh/boards/mach-highlander/setup.c +1 -1
index 4a52590..998f1a5 100644
@@ -385,7 +385,7 @@ static void __init highlander_setup(char **cmdline_p)
 
 	__raw_writew(__raw_readw(PA_IVDRCTL) | 0x01, PA_IVDRCTL);	/* Si13112 */
 
-	pm_power_off = r7780rp_power_off;
+	register_poweroff_handler_simple(r7780rp_power_off, 128);
 }
 
 static unsigned char irl2irq[HL_NR_IRL];
arch/sh/boards/mach-landisk/setup.c +1 -1
index f1147ca..c817d80 100644
@@ -89,7 +89,7 @@ static void __init landisk_setup(char **cmdline_p)
 	__raw_writeb(__raw_readb(PA_LED) | 0x03, PA_LED);
 
 	printk(KERN_INFO "I-O DATA DEVICE, INC. \"LANDISK Series\" support.\n");
-	pm_power_off = landisk_power_off;
+	register_poweroff_handler_simple(landisk_power_off, 128);
 }
 
 /*
arch/sh/boards/mach-r2d/setup.c +1 -1
index 4b98a52..a759d39 100644
@@ -279,7 +279,7 @@ static void __init rts7751r2d_setup(char **cmdline_p)
 					(ver >> 4) & 0xf, ver & 0xf);
 
 	__raw_writew(0x0000, PA_OUTPORT);
-	pm_power_off = rts7751r2d_power_off;
+	register_poweroff_handler_simple(rts7751r2d_power_off, 128);
 
 	/* sm501 dram configuration:
 	 * ColSizeX = 11 - External Memory Column Size: 256 words.
arch/sh/boards/mach-sdk7786/setup.c +1 -1
index c29268b..cb26336 100644
@@ -252,7 +252,7 @@ static void __init sdk7786_setup(char **cmdline_p)
 	pr_info("\tPCB revision:\t%d\n", fpga_read_reg(PCBRR) & 0xf);
 
 	machine_ops.restart = sdk7786_restart;
-	pm_power_off = sdk7786_power_off;
+	register_poweroff_handler_simple(sdk7786_power_off, 128);
 
 	register_smp_ops(&shx3_smp_ops);
 }
Signature · 1 line
1.9.1
author maintainer
#243 lore raw

PATCH 38/44 x86: lguest: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

Cc Rusty Russell <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc H. Peter Anvin <[email protected]>
---
 arch/x86/lguest/boot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/lguest/boot.c +1 -1
index aae9413..083a999 100644
@@ -1441,7 +1441,7 @@ __init void lguest_init(void)
 	 * the Guest routine to power off, and the reboot hook to our restart
 	 * routine.
 	 */
-	pm_power_off = lguest_power_off;
+	register_poweroff_handler_simple(lguest_power_off, 128);
 	machine_ops.restart = lguest_restart;
 
 	/*
Signature · 1 line
1.9.1
author maintainer
#244 lore raw

PATCH 38/44 x86: lguest: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

Cc Rusty Russell <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc H. Peter Anvin <[email protected]>
---
 arch/x86/lguest/boot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/lguest/boot.c +1 -1
index aae9413..083a999 100644
@@ -1441,7 +1441,7 @@ __init void lguest_init(void)
 	 * the Guest routine to power off, and the reboot hook to our restart
 	 * routine.
 	 */
-	pm_power_off = lguest_power_off;
+	register_poweroff_handler_simple(lguest_power_off, 128);
 	machine_ops.restart = lguest_restart;
 
 	/*
Signature · 1 line
1.9.1
author maintainer
#245 lore raw

PATCH 38/44 x86: lguest: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

Cc Rusty Russell <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc H. Peter Anvin <[email protected]>
---
 arch/x86/lguest/boot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/lguest/boot.c +1 -1
index aae9413..083a999 100644
@@ -1441,7 +1441,7 @@ __init void lguest_init(void)
 	 * the Guest routine to power off, and the reboot hook to our restart
 	 * routine.
 	 */
-	pm_power_off = lguest_power_off;
+	register_poweroff_handler_simple(lguest_power_off, 128);
 	machine_ops.restart = lguest_restart;
 
 	/*
Signature · 1 line
1.9.1
author maintainer
#246 lore raw

PATCH 39/44 x86: ce4100: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc H. Peter Anvin <[email protected]>
---
 arch/x86/platform/ce4100/ce4100.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/platform/ce4100/ce4100.c +1 -1
index 701fd58..4a7f3d6 100644
@@ -164,5 +164,5 @@ void __init x86_ce4100_early_setup(void)
 	 */
 	reboot_type = BOOT_KBD;
 
-	pm_power_off = ce4100_power_off;
+	register_poweroff_handler_simple(ce4100_power_off, 128);
 }
Signature · 1 line
1.9.1
author maintainer
#247 lore raw

PATCH 39/44 x86: ce4100: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc H. Peter Anvin <[email protected]>
---
 arch/x86/platform/ce4100/ce4100.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/platform/ce4100/ce4100.c +1 -1
index 701fd58..4a7f3d6 100644
@@ -164,5 +164,5 @@ void __init x86_ce4100_early_setup(void)
 	 */
 	reboot_type = BOOT_KBD;
 
-	pm_power_off = ce4100_power_off;
+	register_poweroff_handler_simple(ce4100_power_off, 128);
 }
Signature · 1 line
1.9.1
author maintainer
#248 lore raw

PATCH 39/44 x86: ce4100: Register with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc H. Peter Anvin <[email protected]>
---
 arch/x86/platform/ce4100/ce4100.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/platform/ce4100/ce4100.c +1 -1
index 701fd58..4a7f3d6 100644
@@ -164,5 +164,5 @@ void __init x86_ce4100_early_setup(void)
 	 */
 	reboot_type = BOOT_KBD;
 
-	pm_power_off = ce4100_power_off;
+	register_poweroff_handler_simple(ce4100_power_off, 128);
 }
Signature · 1 line
1.9.1
author maintainer
#249 lore raw

PATCH 40/44 x86: intel-mid: Drop registration of dummy poweroff handlers

In reply to Guenter Roeck

A dummy poweroff handler does not serve any purpose. Drop it.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc H. Peter Anvin <[email protected]>
---
 arch/x86/platform/intel-mid/intel-mid.c | 5 -----
 arch/x86/platform/intel-mid/mfld.c      | 5 -----
 2 files changed, 10 deletions(-)
arch/x86/platform/intel-mid/intel-mid.c +0 -5
index 1bbedc4..4b70666 100644
@@ -67,10 +67,6 @@ static void *(*get_intel_mid_ops[])(void) = INTEL_MID_OPS_INIT;
 enum intel_mid_cpu_type __intel_mid_cpu_chip;
 EXPORT_SYMBOL_GPL(__intel_mid_cpu_chip);
 
-static void intel_mid_power_off(void)
-{
-};
-
 static void intel_mid_reboot(void)
 {
 	intel_scu_ipc_simple_command(IPCMSG_COLD_BOOT, 0);
@@ -183,7 +179,6 @@ void __init x86_intel_mid_early_setup(void)
 
 	legacy_pic = &null_legacy_pic;
 
-	pm_power_off = intel_mid_power_off;
 	machine_ops.emergency_restart  = intel_mid_reboot;
 
 	/* Avoid searching for BIOS MP tables */
arch/x86/platform/intel-mid/mfld.c +0 -5
index 23381d2..cf6842f 100644
@@ -23,10 +23,6 @@ static struct intel_mid_ops penwell_ops = {
 	.arch_setup = penwell_arch_setup,
 };
 
-static void mfld_power_off(void)
-{
-}
-
 static unsigned long __init mfld_calibrate_tsc(void)
 {
 	unsigned long fast_calibrate;
@@ -61,7 +57,6 @@ static unsigned long __init mfld_calibrate_tsc(void)
 static void __init penwell_arch_setup(void)
 {
 	x86_platform.calibrate_tsc = mfld_calibrate_tsc;
-	pm_power_off = mfld_power_off;
 }
 
 void *get_penwell_ops(void)
Signature · 1 line
1.9.1
author maintainer
#250 lore raw

PATCH 40/44 x86: intel-mid: Drop registration of dummy poweroff handlers

In reply to Guenter Roeck

A dummy poweroff handler does not serve any purpose. Drop it.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc H. Peter Anvin <[email protected]>
---
 arch/x86/platform/intel-mid/intel-mid.c | 5 -----
 arch/x86/platform/intel-mid/mfld.c      | 5 -----
 2 files changed, 10 deletions(-)
arch/x86/platform/intel-mid/intel-mid.c +0 -5
index 1bbedc4..4b70666 100644
@@ -67,10 +67,6 @@ static void *(*get_intel_mid_ops[])(void) = INTEL_MID_OPS_INIT;
 enum intel_mid_cpu_type __intel_mid_cpu_chip;
 EXPORT_SYMBOL_GPL(__intel_mid_cpu_chip);
 
-static void intel_mid_power_off(void)
-{
-};
-
 static void intel_mid_reboot(void)
 {
 	intel_scu_ipc_simple_command(IPCMSG_COLD_BOOT, 0);
@@ -183,7 +179,6 @@ void __init x86_intel_mid_early_setup(void)
 
 	legacy_pic = &null_legacy_pic;
 
-	pm_power_off = intel_mid_power_off;
 	machine_ops.emergency_restart  = intel_mid_reboot;
 
 	/* Avoid searching for BIOS MP tables */
arch/x86/platform/intel-mid/mfld.c +0 -5
index 23381d2..cf6842f 100644
@@ -23,10 +23,6 @@ static struct intel_mid_ops penwell_ops = {
 	.arch_setup = penwell_arch_setup,
 };
 
-static void mfld_power_off(void)
-{
-}
-
 static unsigned long __init mfld_calibrate_tsc(void)
 {
 	unsigned long fast_calibrate;
@@ -61,7 +57,6 @@ static unsigned long __init mfld_calibrate_tsc(void)
 static void __init penwell_arch_setup(void)
 {
 	x86_platform.calibrate_tsc = mfld_calibrate_tsc;
-	pm_power_off = mfld_power_off;
 }
 
 void *get_penwell_ops(void)
Signature · 1 line
1.9.1
author maintainer
#251 lore raw

PATCH 40/44 x86: intel-mid: Drop registration of dummy poweroff handlers

In reply to Guenter Roeck

A dummy poweroff handler does not serve any purpose. Drop it.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc H. Peter Anvin <[email protected]>
---
 arch/x86/platform/intel-mid/intel-mid.c | 5 -----
 arch/x86/platform/intel-mid/mfld.c      | 5 -----
 2 files changed, 10 deletions(-)
arch/x86/platform/intel-mid/intel-mid.c +0 -5
index 1bbedc4..4b70666 100644
@@ -67,10 +67,6 @@ static void *(*get_intel_mid_ops[])(void) = INTEL_MID_OPS_INIT;
 enum intel_mid_cpu_type __intel_mid_cpu_chip;
 EXPORT_SYMBOL_GPL(__intel_mid_cpu_chip);
 
-static void intel_mid_power_off(void)
-{
-};
-
 static void intel_mid_reboot(void)
 {
 	intel_scu_ipc_simple_command(IPCMSG_COLD_BOOT, 0);
@@ -183,7 +179,6 @@ void __init x86_intel_mid_early_setup(void)
 
 	legacy_pic = &null_legacy_pic;
 
-	pm_power_off = intel_mid_power_off;
 	machine_ops.emergency_restart  = intel_mid_reboot;
 
 	/* Avoid searching for BIOS MP tables */
arch/x86/platform/intel-mid/mfld.c +0 -5
index 23381d2..cf6842f 100644
@@ -23,10 +23,6 @@ static struct intel_mid_ops penwell_ops = {
 	.arch_setup = penwell_arch_setup,
 };
 
-static void mfld_power_off(void)
-{
-}
-
 static unsigned long __init mfld_calibrate_tsc(void)
 {
 	unsigned long fast_calibrate;
@@ -61,7 +57,6 @@ static unsigned long __init mfld_calibrate_tsc(void)
 static void __init penwell_arch_setup(void)
 {
 	x86_platform.calibrate_tsc = mfld_calibrate_tsc;
-	pm_power_off = mfld_power_off;
 }
 
 void *get_penwell_ops(void)
Signature · 1 line
1.9.1
author maintainer
#252 lore raw

PATCH 41/44 x86: pmc_atom: Register poweroff handler with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with a low priority value of 64 to reflect that the original code only sets pm_power_off if it was not already set.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc H. Peter Anvin <[email protected]>
---
 arch/x86/kernel/pmc_atom.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
arch/x86/kernel/pmc_atom.c +17 -3
index 0c424a6..79331a2 100644
@@ -20,6 +20,8 @@
 #include <linux/pci.h>
 #include <linux/device.h>
 #include <linux/debugfs.h>
+#include <linux/notifier.h>
+#include <linux/pm.h>
 #include <linux/seq_file.h>
 #include <linux/io.h>
 
@@ -92,7 +94,8 @@ static inline void pmc_reg_write(struct pmc_dev *pmc, int reg_offset, u32 val)
 	writel(val, pmc->regmap + reg_offset);
 }
 
-static void pmc_power_off(void)
+static int pmc_power_off(struct notifier_block *this, unsigned long unused1,
+			 void *unused2)
 {
 	u16	pm1_cnt_port;
 	u32	pm1_cnt_value;
@@ -107,8 +110,15 @@ static void pmc_power_off(void)
 	pm1_cnt_value |= SLEEP_ENABLE;
 
 	outl(pm1_cnt_value, pm1_cnt_port);
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block pmc_poweroff_nb = {
+	.notifier_call = pmc_power_off,
+	.priority = 64,
+};
+
 static void pmc_hw_reg_setup(struct pmc_dev *pmc)
 {
 	/*
@@ -247,8 +257,12 @@ static int pmc_setup_dev(struct pci_dev *pdev)
 	acpi_base_addr &= ACPI_BASE_ADDR_MASK;
 
 	/* Install power off function */
-	if (acpi_base_addr != 0 && pm_power_off == NULL)
-		pm_power_off = pmc_power_off;
+	if (acpi_base_addr != 0) {
+		ret = register_poweroff_handler(&pmc_poweroff_nb);
+		if (ret)
+			dev_err(&pdev->dev,
+				"Failed to install poweroff handler\n");
+	}
 
 	pci_read_config_dword(pdev, PMC_BASE_ADDR_OFFSET, &pmc->base_addr);
 	pmc->base_addr &= PMC_BASE_ADDR_MASK;
Signature · 1 line
1.9.1
author maintainer
#253 lore raw

PATCH 41/44 x86: pmc_atom: Register poweroff handler with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with a low priority value of 64 to reflect that the original code only sets pm_power_off if it was not already set.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc H. Peter Anvin <[email protected]>
---
 arch/x86/kernel/pmc_atom.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
arch/x86/kernel/pmc_atom.c +17 -3
index 0c424a6..79331a2 100644
@@ -20,6 +20,8 @@
 #include <linux/pci.h>
 #include <linux/device.h>
 #include <linux/debugfs.h>
+#include <linux/notifier.h>
+#include <linux/pm.h>
 #include <linux/seq_file.h>
 #include <linux/io.h>
 
@@ -92,7 +94,8 @@ static inline void pmc_reg_write(struct pmc_dev *pmc, int reg_offset, u32 val)
 	writel(val, pmc->regmap + reg_offset);
 }
 
-static void pmc_power_off(void)
+static int pmc_power_off(struct notifier_block *this, unsigned long unused1,
+			 void *unused2)
 {
 	u16	pm1_cnt_port;
 	u32	pm1_cnt_value;
@@ -107,8 +110,15 @@ static void pmc_power_off(void)
 	pm1_cnt_value |= SLEEP_ENABLE;
 
 	outl(pm1_cnt_value, pm1_cnt_port);
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block pmc_poweroff_nb = {
+	.notifier_call = pmc_power_off,
+	.priority = 64,
+};
+
 static void pmc_hw_reg_setup(struct pmc_dev *pmc)
 {
 	/*
@@ -247,8 +257,12 @@ static int pmc_setup_dev(struct pci_dev *pdev)
 	acpi_base_addr &= ACPI_BASE_ADDR_MASK;
 
 	/* Install power off function */
-	if (acpi_base_addr != 0 && pm_power_off == NULL)
-		pm_power_off = pmc_power_off;
+	if (acpi_base_addr != 0) {
+		ret = register_poweroff_handler(&pmc_poweroff_nb);
+		if (ret)
+			dev_err(&pdev->dev,
+				"Failed to install poweroff handler\n");
+	}
 
 	pci_read_config_dword(pdev, PMC_BASE_ADDR_OFFSET, &pmc->base_addr);
 	pmc->base_addr &= PMC_BASE_ADDR_MASK;
Signature · 1 line
1.9.1
author maintainer
#254 lore raw

PATCH 41/44 x86: pmc_atom: Register poweroff handler with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with a low priority value of 64 to reflect that the original code only sets pm_power_off if it was not already set.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc H. Peter Anvin <[email protected]>
---
 arch/x86/kernel/pmc_atom.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
arch/x86/kernel/pmc_atom.c +17 -3
index 0c424a6..79331a2 100644
@@ -20,6 +20,8 @@
 #include <linux/pci.h>
 #include <linux/device.h>
 #include <linux/debugfs.h>
+#include <linux/notifier.h>
+#include <linux/pm.h>
 #include <linux/seq_file.h>
 #include <linux/io.h>
 
@@ -92,7 +94,8 @@ static inline void pmc_reg_write(struct pmc_dev *pmc, int reg_offset, u32 val)
 	writel(val, pmc->regmap + reg_offset);
 }
 
-static void pmc_power_off(void)
+static int pmc_power_off(struct notifier_block *this, unsigned long unused1,
+			 void *unused2)
 {
 	u16	pm1_cnt_port;
 	u32	pm1_cnt_value;
@@ -107,8 +110,15 @@ static void pmc_power_off(void)
 	pm1_cnt_value |= SLEEP_ENABLE;
 
 	outl(pm1_cnt_value, pm1_cnt_port);
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block pmc_poweroff_nb = {
+	.notifier_call = pmc_power_off,
+	.priority = 64,
+};
+
 static void pmc_hw_reg_setup(struct pmc_dev *pmc)
 {
 	/*
@@ -247,8 +257,12 @@ static int pmc_setup_dev(struct pci_dev *pdev)
 	acpi_base_addr &= ACPI_BASE_ADDR_MASK;
 
 	/* Install power off function */
-	if (acpi_base_addr != 0 && pm_power_off == NULL)
-		pm_power_off = pmc_power_off;
+	if (acpi_base_addr != 0) {
+		ret = register_poweroff_handler(&pmc_poweroff_nb);
+		if (ret)
+			dev_err(&pdev->dev,
+				"Failed to install poweroff handler\n");
+	}
 
 	pci_read_config_dword(pdev, PMC_BASE_ADDR_OFFSET, &pmc->base_addr);
 	pmc->base_addr &= PMC_BASE_ADDR_MASK;
Signature · 1 line
1.9.1
author maintainer
#255 lore raw

PATCH 42/44 efi: Register poweroff handler with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with low priority value of 64 since the efi code states that this is a poweroff handler of last resort.

---
 drivers/firmware/efi/reboot.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
drivers/firmware/efi/reboot.c +19 -4
index 9c59d1c..c082439 100644
@@ -3,6 +3,8 @@
  * Copyright (c) 2014 Red Hat, Inc., Mark Salter <[email protected]>
  */
 #include <linux/efi.h>
+#include <linux/notifier.h>
+#include <linux/pm.h>
 #include <linux/reboot.h>
 
 int efi_reboot_quirk_mode = -1;
@@ -38,19 +40,32 @@ bool __weak efi_poweroff_required(void)
 	return false;
 }
 
-static void efi_power_off(void)
+static int efi_power_off(struct notifier_block *this,
+			 unsigned long unused1, void *unused2)
 {
 	efi.reset_system(EFI_RESET_SHUTDOWN, EFI_SUCCESS, 0, NULL);
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block efi_poweroff_nb = {
+	.notifier_call = efi_power_off,
+	.priority = 64,
+};
+
 static int __init efi_shutdown_init(void)
 {
+	int ret = 0;
+
 	if (!efi_enabled(EFI_RUNTIME_SERVICES))
 		return -ENODEV;
 
-	if (efi_poweroff_required())
-		pm_power_off = efi_power_off;
+	if (efi_poweroff_required()) {
+		ret = register_poweroff_handler(&efi_poweroff_nb);
+		if (ret)
+			pr_err("efi: Failed to register poweroff handler\n");
+	}
 
-	return 0;
+	return ret;
 }
 late_initcall(efi_shutdown_init);
Signature · 1 line
1.9.1
#256 lore raw

Re: [PATCH 42/44] efi: Register poweroff handler with kernel poweroff handler

Quoted 9 lines · Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with low priority value of 64 since the efi code states that this is a poweroff handler of last resort.

---
 drivers/firmware/efi/reboot.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

Looks OK to me. Mark?

Quoted 52 lines
drivers/firmware/efi/reboot.c +19 -4
index 9c59d1c..c082439 100644
@@ -3,6 +3,8 @@
  * Copyright (c) 2014 Red Hat, Inc., Mark Salter <[email protected]>
  */
 #include <linux/efi.h>
+#include <linux/notifier.h>
+#include <linux/pm.h>
 #include <linux/reboot.h>
 
 int efi_reboot_quirk_mode = -1;
@@ -38,19 +40,32 @@ bool __weak efi_poweroff_required(void)
 	return false;
 }
 
-static void efi_power_off(void)
+static int efi_power_off(struct notifier_block *this,
+			 unsigned long unused1, void *unused2)
 {
 	efi.reset_system(EFI_RESET_SHUTDOWN, EFI_SUCCESS, 0, NULL);
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block efi_poweroff_nb = {
+	.notifier_call = efi_power_off,
+	.priority = 64,
+};
+
 static int __init efi_shutdown_init(void)
 {
+	int ret = 0;
+
 	if (!efi_enabled(EFI_RUNTIME_SERVICES))
 		return -ENODEV;
 
-	if (efi_poweroff_required())
-		pm_power_off = efi_power_off;
+	if (efi_poweroff_required()) {
+		ret = register_poweroff_handler(&efi_poweroff_nb);
+		if (ret)
+			pr_err("efi: Failed to register poweroff handler\n");
+	}
 
-	return 0;
+	return ret;
 }
 late_initcall(efi_shutdown_init);
Signature · 1 line
1.9.1
Signature · 1 line
Matt Fleming, Intel Open Source Technology Center
Acked-by
#257 lore raw

Re: [PATCH 42/44] efi: Register poweroff handler with kernel poweroff handler

Quoted 5 lines · Matt Fleming
Quoted 4 lines · Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with low priority value of 64 since the efi code states that this is a poweroff handler of last resort.

Quoted 7 lines
Quoted 5 lines
---
 drivers/firmware/efi/reboot.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

Looks OK to me. Mark?

Me too.

Quoted 55 lines
Quoted 53 lines
drivers/firmware/efi/reboot.c +19 -4
index 9c59d1c..c082439 100644
@@ -3,6 +3,8 @@
  * Copyright (c) 2014 Red Hat, Inc., Mark Salter <[email protected]>
  */
 #include <linux/efi.h>
+#include <linux/notifier.h>
+#include <linux/pm.h>
 #include <linux/reboot.h>
 
 int efi_reboot_quirk_mode = -1;
@@ -38,19 +40,32 @@ bool __weak efi_poweroff_required(void)
 	return false;
 }
 
-static void efi_power_off(void)
+static int efi_power_off(struct notifier_block *this,
+			 unsigned long unused1, void *unused2)
 {
 	efi.reset_system(EFI_RESET_SHUTDOWN, EFI_SUCCESS, 0, NULL);
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block efi_poweroff_nb = {
+	.notifier_call = efi_power_off,
+	.priority = 64,
+};
+
 static int __init efi_shutdown_init(void)
 {
+	int ret = 0;
+
 	if (!efi_enabled(EFI_RUNTIME_SERVICES))
 		return -ENODEV;
 
-	if (efi_poweroff_required())
-		pm_power_off = efi_power_off;
+	if (efi_poweroff_required()) {
+		ret = register_poweroff_handler(&efi_poweroff_nb);
+		if (ret)
+			pr_err("efi: Failed to register poweroff handler\n");
+	}
 
-	return 0;
+	return ret;
 }
 late_initcall(efi_shutdown_init);
Signature · 1 line
1.9.1
author maintainer
#258 lore raw

Re: [PATCH 42/44] efi: Register poweroff handler with kernel poweroff handler

Quoted 12 lines · Mark Salter
Quoted 11 lines · Matt Fleming
Quoted 9 lines · Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with low priority value of 64 since the efi code states that this is a poweroff handler of last resort.

---
 drivers/firmware/efi/reboot.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
Quoted 6 lines
Quoted 1 line

Looks OK to me. Mark?

Me too.

Great, thanks a lot for the feedback.

Matt, is it ok for me to add your Acked-by: ?

Thanks,
Guenter

Quoted 57 lines
Quoted 55 lines
Quoted 53 lines
drivers/firmware/efi/reboot.c +19 -4
index 9c59d1c..c082439 100644
@@ -3,6 +3,8 @@
  * Copyright (c) 2014 Red Hat, Inc., Mark Salter <[email protected]>
  */
 #include <linux/efi.h>
+#include <linux/notifier.h>
+#include <linux/pm.h>
 #include <linux/reboot.h>
 
 int efi_reboot_quirk_mode = -1;
@@ -38,19 +40,32 @@ bool __weak efi_poweroff_required(void)
 	return false;
 }
 
-static void efi_power_off(void)
+static int efi_power_off(struct notifier_block *this,
+			 unsigned long unused1, void *unused2)
 {
 	efi.reset_system(EFI_RESET_SHUTDOWN, EFI_SUCCESS, 0, NULL);
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block efi_poweroff_nb = {
+	.notifier_call = efi_power_off,
+	.priority = 64,
+};
+
 static int __init efi_shutdown_init(void)
 {
+	int ret = 0;
+
 	if (!efi_enabled(EFI_RUNTIME_SERVICES))
 		return -ENODEV;
 
-	if (efi_poweroff_required())
-		pm_power_off = efi_power_off;
+	if (efi_poweroff_required()) {
+		ret = register_poweroff_handler(&efi_poweroff_nb);
+		if (ret)
+			pr_err("efi: Failed to register poweroff handler\n");
+	}
 
-	return 0;
+	return ret;
 }
 late_initcall(efi_shutdown_init);
Signature · 1 line
1.9.1
Acked-by
#259 lore raw

Re: [PATCH 42/44] efi: Register poweroff handler with kernel poweroff handler

Quoted 3 lines · Guenter Roeck

Great, thanks a lot for the feedback.

Matt, is it ok for me to add your Acked-by: ?

Sorry, yes.

Signature · 1 line
Matt Fleming, Intel Open Source Technology Center
author maintainer
#260 lore raw

Re: [PATCH 42/44] efi: Register poweroff handler with kernel poweroff handler

Quoted 9 lines · Matt Fleming
Quoted 3 lines · Guenter Roeck

Great, thanks a lot for the feedback.

Matt, is it ok for me to add your Acked-by: ?

Sorry, yes.

No worries. Thanks a lot!

Guenter

author maintainer
#261 lore raw

PATCH 42/44 efi: Register poweroff handler with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with low priority value of 64 since the efi code states that this is a poweroff handler of last resort.

---
 drivers/firmware/efi/reboot.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
drivers/firmware/efi/reboot.c +19 -4
index 9c59d1c..c082439 100644
@@ -3,6 +3,8 @@
  * Copyright (c) 2014 Red Hat, Inc., Mark Salter <[email protected]>
  */
 #include <linux/efi.h>
+#include <linux/notifier.h>
+#include <linux/pm.h>
 #include <linux/reboot.h>
 
 int efi_reboot_quirk_mode = -1;
@@ -38,19 +40,32 @@ bool __weak efi_poweroff_required(void)
 	return false;
 }
 
-static void efi_power_off(void)
+static int efi_power_off(struct notifier_block *this,
+			 unsigned long unused1, void *unused2)
 {
 	efi.reset_system(EFI_RESET_SHUTDOWN, EFI_SUCCESS, 0, NULL);
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block efi_poweroff_nb = {
+	.notifier_call = efi_power_off,
+	.priority = 64,
+};
+
 static int __init efi_shutdown_init(void)
 {
+	int ret = 0;
+
 	if (!efi_enabled(EFI_RUNTIME_SERVICES))
 		return -ENODEV;
 
-	if (efi_poweroff_required())
-		pm_power_off = efi_power_off;
+	if (efi_poweroff_required()) {
+		ret = register_poweroff_handler(&efi_poweroff_nb);
+		if (ret)
+			pr_err("efi: Failed to register poweroff handler\n");
+	}
 
-	return 0;
+	return ret;
 }
 late_initcall(efi_shutdown_init);
Signature · 1 line
1.9.1
author maintainer
#262 lore raw

PATCH 42/44 efi: Register poweroff handler with kernel poweroff handler

In reply to Guenter Roeck

Register with kernel poweroff handler instead of setting pm_power_off directly. Register with low priority value of 64 since the efi code states that this is a poweroff handler of last resort.

---
 drivers/firmware/efi/reboot.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
drivers/firmware/efi/reboot.c +19 -4
index 9c59d1c..c082439 100644
@@ -3,6 +3,8 @@
  * Copyright (c) 2014 Red Hat, Inc., Mark Salter <[email protected]>
  */
 #include <linux/efi.h>
+#include <linux/notifier.h>
+#include <linux/pm.h>
 #include <linux/reboot.h>
 
 int efi_reboot_quirk_mode = -1;
@@ -38,19 +40,32 @@ bool __weak efi_poweroff_required(void)
 	return false;
 }
 
-static void efi_power_off(void)
+static int efi_power_off(struct notifier_block *this,
+			 unsigned long unused1, void *unused2)
 {
 	efi.reset_system(EFI_RESET_SHUTDOWN, EFI_SUCCESS, 0, NULL);
+
+	return NOTIFY_DONE;
 }
 
+static struct notifier_block efi_poweroff_nb = {
+	.notifier_call = efi_power_off,
+	.priority = 64,
+};
+
 static int __init efi_shutdown_init(void)
 {
+	int ret = 0;
+
 	if (!efi_enabled(EFI_RUNTIME_SERVICES))
 		return -ENODEV;
 
-	if (efi_poweroff_required())
-		pm_power_off = efi_power_off;
+	if (efi_poweroff_required()) {
+		ret = register_poweroff_handler(&efi_poweroff_nb);
+		if (ret)
+			pr_err("efi: Failed to register poweroff handler\n");
+	}
 
-	return 0;
+	return ret;
 }
 late_initcall(efi_shutdown_init);
Signature · 1 line
1.9.1
author maintainer
#263 lore raw

PATCH 43/44 hwmon: (ab8500) Call kernel_power_off instead of pm_power_off

In reply to Guenter Roeck

Drivers should not call pm_power_off directly; it is not guaranteed to be non-NULL. Call kernel_power_off instead.

---
 drivers/hwmon/ab8500.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/hwmon/ab8500.c +3 -2
index d844dc8..8b6a4f4 100644
@@ -6,7 +6,7 @@
  *
  * When the AB8500 thermal warning temperature is reached (threshold cannot
  * be changed by SW), an interrupt is set, and if no further action is taken
- * within a certain time frame, pm_power off will be called.
+ * within a certain time frame, kernel_power_off will be called.
  *
  * When AB8500 thermal shutdown temperature is reached a hardware shutdown of
  * the AB8500 will occur.
@@ -21,6 +21,7 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/power/ab8500.h>
+#include <linux/reboot.h>
 #include <linux/slab.h>
 #include <linux/sysfs.h>
 #include "abx500.h"
@@ -106,7 +107,7 @@ static void ab8500_thermal_power_off(struct work_struct *work)
 
 	dev_warn(&abx500_data->pdev->dev, "Power off due to critical temp\n");
 
-	pm_power_off();
+	kernel_power_off();
 }
 
 static ssize_t ab8500_show_name(struct device *dev,
Signature · 1 line
1.9.1
author maintainer
#264 lore raw

PATCH 43/44 hwmon: (ab8500) Call kernel_power_off instead of pm_power_off

In reply to Guenter Roeck

Drivers should not call pm_power_off directly; it is not guaranteed to be non-NULL. Call kernel_power_off instead.

---
 drivers/hwmon/ab8500.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/hwmon/ab8500.c +3 -2
index d844dc8..8b6a4f4 100644
@@ -6,7 +6,7 @@
  *
  * When the AB8500 thermal warning temperature is reached (threshold cannot
  * be changed by SW), an interrupt is set, and if no further action is taken
- * within a certain time frame, pm_power off will be called.
+ * within a certain time frame, kernel_power_off will be called.
  *
  * When AB8500 thermal shutdown temperature is reached a hardware shutdown of
  * the AB8500 will occur.
@@ -21,6 +21,7 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/power/ab8500.h>
+#include <linux/reboot.h>
 #include <linux/slab.h>
 #include <linux/sysfs.h>
 #include "abx500.h"
@@ -106,7 +107,7 @@ static void ab8500_thermal_power_off(struct work_struct *work)
 
 	dev_warn(&abx500_data->pdev->dev, "Power off due to critical temp\n");
 
-	pm_power_off();
+	kernel_power_off();
 }
 
 static ssize_t ab8500_show_name(struct device *dev,
Signature · 1 line
1.9.1
author maintainer
#265 lore raw

PATCH 43/44 hwmon: (ab8500) Call kernel_power_off instead of pm_power_off

In reply to Guenter Roeck

Drivers should not call pm_power_off directly; it is not guaranteed to be non-NULL. Call kernel_power_off instead.

---
 drivers/hwmon/ab8500.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/hwmon/ab8500.c +3 -2
index d844dc8..8b6a4f4 100644
@@ -6,7 +6,7 @@
  *
  * When the AB8500 thermal warning temperature is reached (threshold cannot
  * be changed by SW), an interrupt is set, and if no further action is taken
- * within a certain time frame, pm_power off will be called.
+ * within a certain time frame, kernel_power_off will be called.
  *
  * When AB8500 thermal shutdown temperature is reached a hardware shutdown of
  * the AB8500 will occur.
@@ -21,6 +21,7 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/power/ab8500.h>
+#include <linux/reboot.h>
 #include <linux/slab.h>
 #include <linux/sysfs.h>
 #include "abx500.h"
@@ -106,7 +107,7 @@ static void ab8500_thermal_power_off(struct work_struct *work)
 
 	dev_warn(&abx500_data->pdev->dev, "Power off due to critical temp\n");
 
-	pm_power_off();
+	kernel_power_off();
 }
 
 static ssize_t ab8500_show_name(struct device *dev,
Signature · 1 line
1.9.1
author maintainer
#266 lore raw

PATCH 44/44 kernel: Remove pm_power_off

In reply to Guenter Roeck

No users of pm_power_off are left, so it is safe to remove the function.

Cc Rafael J. Wysocki <[email protected]>
Cc Pavel Machek <[email protected]>
Cc Len Brown <[email protected]>
---
 include/linux/pm.h              |  1 -
 kernel/power/poweroff_handler.c | 10 +---------
 2 files changed, 1 insertion(+), 10 deletions(-)
include/linux/pm.h +0 -1
index 45271b5..fce7645 100644
@@ -31,7 +31,6 @@
 /*
  * Callbacks for platform drivers to implement.
  */
-extern void (*pm_power_off)(void);
 extern void (*pm_power_off_prepare)(void);
 
 /*
kernel/power/poweroff_handler.c +1 -9
index 96f59ef..01a3a39 100644
@@ -20,12 +20,6 @@
 #include <linux/types.h>
 
 /*
- * If set, calling this function will power off the system immediately.
- */
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
-/*
  *	Notifier list for kernel code which wants to be called
  *	to power off the system.
  */
@@ -163,8 +157,6 @@ int register_poweroff_handler_simple(void (*handler)(void), int priority)
  */
 void do_kernel_poweroff(void)
 {
-	if (pm_power_off)
-		pm_power_off();
 	atomic_notifier_call_chain(&poweroff_handler_list, 0, NULL);
 }
 
@@ -175,6 +167,6 @@ void do_kernel_poweroff(void)
  */
 bool have_kernel_poweroff(void)
 {
-	return pm_power_off != NULL || poweroff_handler_list.head != NULL;
+	return poweroff_handler_list.head != NULL;
 }
 EXPORT_SYMBOL(have_kernel_poweroff);
Signature · 1 line
1.9.1
#267 lore raw

Re: [PATCH 44/44] kernel: Remove pm_power_off

Quoted 6 lines · Guenter Roeck

No users of pm_power_off are left, so it is safe to remove the function.

Cc Rafael J. Wysocki <[email protected]>
Cc Pavel Machek <[email protected]>
Cc Len Brown <[email protected]>

ACK

Quoted 52 lines
---
 include/linux/pm.h              |  1 -
 kernel/power/poweroff_handler.c | 10 +---------
 2 files changed, 1 insertion(+), 10 deletions(-)
include/linux/pm.h +0 -1
index 45271b5..fce7645 100644
@@ -31,7 +31,6 @@
 /*
  * Callbacks for platform drivers to implement.
  */
-extern void (*pm_power_off)(void);
 extern void (*pm_power_off_prepare)(void);
 
 /*
kernel/power/poweroff_handler.c +1 -9
index 96f59ef..01a3a39 100644
@@ -20,12 +20,6 @@
 #include <linux/types.h>
 
 /*
- * If set, calling this function will power off the system immediately.
- */
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
-/*
  *	Notifier list for kernel code which wants to be called
  *	to power off the system.
  */
@@ -163,8 +157,6 @@ int register_poweroff_handler_simple(void (*handler)(void), int priority)
  */
 void do_kernel_poweroff(void)
 {
-	if (pm_power_off)
-		pm_power_off();
 	atomic_notifier_call_chain(&poweroff_handler_list, 0, NULL);
 }
 
@@ -175,6 +167,6 @@ void do_kernel_poweroff(void)
  */
 bool have_kernel_poweroff(void)
 {
-	return pm_power_off != NULL || poweroff_handler_list.head != NULL;
+	return poweroff_handler_list.head != NULL;
 }
 EXPORT_SYMBOL(have_kernel_poweroff);
Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
#268 lore raw

Re: [PATCH 44/44] kernel: Remove pm_power_off

In reply to Guenter Roeck
Quoted 6 lines · Guenter Roeck

No users of pm_power_off are left, so it is safe to remove the function.

Cc Rafael J. Wysocki <[email protected]>
Cc Pavel Machek <[email protected]>
Cc Len Brown <[email protected]>

ACK

Quoted 52 lines
---
 include/linux/pm.h              |  1 -
 kernel/power/poweroff_handler.c | 10 +---------
 2 files changed, 1 insertion(+), 10 deletions(-)
include/linux/pm.h +0 -1
index 45271b5..fce7645 100644
@@ -31,7 +31,6 @@
 /*
  * Callbacks for platform drivers to implement.
  */
-extern void (*pm_power_off)(void);
 extern void (*pm_power_off_prepare)(void);
 
 /*
kernel/power/poweroff_handler.c +1 -9
index 96f59ef..01a3a39 100644
@@ -20,12 +20,6 @@
 #include <linux/types.h>
 
 /*
- * If set, calling this function will power off the system immediately.
- */
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
-/*
  *	Notifier list for kernel code which wants to be called
  *	to power off the system.
  */
@@ -163,8 +157,6 @@ int register_poweroff_handler_simple(void (*handler)(void), int priority)
  */
 void do_kernel_poweroff(void)
 {
-	if (pm_power_off)
-		pm_power_off();
 	atomic_notifier_call_chain(&poweroff_handler_list, 0, NULL);
 }
 
@@ -175,6 +167,6 @@ void do_kernel_poweroff(void)
  */
 bool have_kernel_poweroff(void)
 {
-	return pm_power_off != NULL || poweroff_handler_list.head != NULL;
+	return poweroff_handler_list.head != NULL;
 }
 EXPORT_SYMBOL(have_kernel_poweroff);
Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
author maintainer
#269 lore raw

PATCH 44/44 kernel: Remove pm_power_off

In reply to Guenter Roeck

No users of pm_power_off are left, so it is safe to remove the function.

Cc Rafael J. Wysocki <[email protected]>
Cc Pavel Machek <[email protected]>
Cc Len Brown <[email protected]>
---
 include/linux/pm.h              |  1 -
 kernel/power/poweroff_handler.c | 10 +---------
 2 files changed, 1 insertion(+), 10 deletions(-)
include/linux/pm.h +0 -1
index 45271b5..fce7645 100644
@@ -31,7 +31,6 @@
 /*
  * Callbacks for platform drivers to implement.
  */
-extern void (*pm_power_off)(void);
 extern void (*pm_power_off_prepare)(void);
 
 /*
kernel/power/poweroff_handler.c +1 -9
index 96f59ef..01a3a39 100644
@@ -20,12 +20,6 @@
 #include <linux/types.h>
 
 /*
- * If set, calling this function will power off the system immediately.
- */
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
-/*
  *	Notifier list for kernel code which wants to be called
  *	to power off the system.
  */
@@ -163,8 +157,6 @@ int register_poweroff_handler_simple(void (*handler)(void), int priority)
  */
 void do_kernel_poweroff(void)
 {
-	if (pm_power_off)
-		pm_power_off();
 	atomic_notifier_call_chain(&poweroff_handler_list, 0, NULL);
 }
 
@@ -175,6 +167,6 @@ void do_kernel_poweroff(void)
  */
 bool have_kernel_poweroff(void)
 {
-	return pm_power_off != NULL || poweroff_handler_list.head != NULL;
+	return poweroff_handler_list.head != NULL;
 }
 EXPORT_SYMBOL(have_kernel_poweroff);
Signature · 1 line
1.9.1
author maintainer
#270 lore raw

PATCH 44/44 kernel: Remove pm_power_off

In reply to Guenter Roeck

No users of pm_power_off are left, so it is safe to remove the function.

Cc Rafael J. Wysocki <[email protected]>
Cc Pavel Machek <[email protected]>
Cc Len Brown <[email protected]>
---
 include/linux/pm.h              |  1 -
 kernel/power/poweroff_handler.c | 10 +---------
 2 files changed, 1 insertion(+), 10 deletions(-)
include/linux/pm.h +0 -1
index 45271b5..fce7645 100644
@@ -31,7 +31,6 @@
 /*
  * Callbacks for platform drivers to implement.
  */
-extern void (*pm_power_off)(void);
 extern void (*pm_power_off_prepare)(void);
 
 /*
kernel/power/poweroff_handler.c +1 -9
index 96f59ef..01a3a39 100644
@@ -20,12 +20,6 @@
 #include <linux/types.h>
 
 /*
- * If set, calling this function will power off the system immediately.
- */
-void (*pm_power_off)(void);
-EXPORT_SYMBOL(pm_power_off);
-
-/*
  *	Notifier list for kernel code which wants to be called
  *	to power off the system.
  */
@@ -163,8 +157,6 @@ int register_poweroff_handler_simple(void (*handler)(void), int priority)
  */
 void do_kernel_poweroff(void)
 {
-	if (pm_power_off)
-		pm_power_off();
 	atomic_notifier_call_chain(&poweroff_handler_list, 0, NULL);
 }
 
@@ -175,6 +167,6 @@ void do_kernel_poweroff(void)
  */
 bool have_kernel_poweroff(void)
 {
-	return pm_power_off != NULL || poweroff_handler_list.head != NULL;
+	return poweroff_handler_list.head != NULL;
 }
 EXPORT_SYMBOL(have_kernel_poweroff);
Signature · 1 line
1.9.1