kernel: Add support for poweroff handler call chain
Subsystems (59)
Guenter Roeck
maintainerPATCH 23/44 power/reset: qnap-poweroff: Register with kernel poweroff handler
In reply to Guenter RoeckRegister 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.
--- drivers/power/reset/qnap-poweroff.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/power/reset/qnap-poweroff.c +14 -14
@@ -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
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_offdirectly. 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]>Signed-off-by Guenter Roeck <[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@@ -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
Re: [PATCH 23/44] power/reset: qnap-poweroff: Register with kernel poweroff handler
In reply to Guenter RoeckQuoted 9 lines · Guenter Roeck
Register with kernel poweroff handler instead of setting
pm_power_offdirectly. 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]>Signed-off-by Guenter Roeck <[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@@ -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
Re: [PATCH 23/44] power/reset: qnap-poweroff: Register with kernel poweroff handler
In reply to Guenter RoeckQuoted 9 lines · Guenter Roeck
Register with kernel poweroff handler instead of setting
pm_power_offdirectly. 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]>Signed-off-by Guenter Roeck <[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@@ -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
Guenter Roeck
maintainerPATCH 23/44 power/reset: qnap-poweroff: Register with kernel poweroff handler
In reply to Guenter RoeckRegister 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.
--- drivers/power/reset/qnap-poweroff.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/power/reset/qnap-poweroff.c +14 -14
@@ -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
Guenter Roeck
maintainerPATCH 24/44 power/reset: msm-powroff: Register with kernel poweroff handler
In reply to Guenter RoeckRegister 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
@@ -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
Guenter Roeck
maintainerPATCH 24/44 power/reset: msm-powroff: Register with kernel poweroff handler
In reply to Guenter RoeckRegister 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
@@ -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
Guenter Roeck
maintainerPATCH 24/44 power/reset: msm-powroff: Register with kernel poweroff handler
In reply to Guenter RoeckRegister 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
@@ -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
Guenter Roeck
maintainerPATCH 25/44 power/reset: vexpress-poweroff: Register with kernel poweroff handler
In reply to Guenter RoeckRegister 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
@@ -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
Guenter Roeck
maintainerPATCH 25/44 power/reset: vexpress-poweroff: Register with kernel poweroff handler
In reply to Guenter RoeckRegister 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
@@ -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
Guenter Roeck
maintainerPATCH 25/44 power/reset: vexpress-poweroff: Register with kernel poweroff handler
In reply to Guenter RoeckRegister 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
@@ -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
Guenter Roeck
maintainerPATCH 26/44 x86: iris: Register with kernel poweroff handler
In reply to Guenter RoeckRegister 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.
--- arch/x86/platform/iris/iris.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
arch/x86/platform/iris/iris.c +19 -6
@@ -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
Guenter Roeck
maintainerPATCH 26/44 x86: iris: Register with kernel poweroff handler
In reply to Guenter RoeckRegister 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.
--- arch/x86/platform/iris/iris.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
arch/x86/platform/iris/iris.c +19 -6
@@ -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
Guenter Roeck
maintainerPATCH 26/44 x86: iris: Register with kernel poweroff handler
In reply to Guenter RoeckRegister 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.
--- arch/x86/platform/iris/iris.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
arch/x86/platform/iris/iris.c +19 -6
@@ -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
Guenter Roeck
maintainerPATCH 27/44 x86: apm: Register with kernel poweroff handler
In reply to Guenter RoeckRegister 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.
--- arch/x86/kernel/apm_32.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
arch/x86/kernel/apm_32.c +15 -5
@@ -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
Guenter Roeck
maintainerPATCH 27/44 x86: apm: Register with kernel poweroff handler
In reply to Guenter RoeckRegister 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.
--- arch/x86/kernel/apm_32.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
arch/x86/kernel/apm_32.c +15 -5
@@ -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
Guenter Roeck
maintainerPATCH 27/44 x86: apm: Register with kernel poweroff handler
In reply to Guenter RoeckRegister 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.
--- arch/x86/kernel/apm_32.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
arch/x86/kernel/apm_32.c +15 -5
@@ -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
Guenter Roeck
maintainerPATCH 28/44 x86: olpc: Register xo1 poweroff handler with kernel poweroff handler
In reply to Guenter RoeckRegister 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.
--- 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
@@ -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
Guenter Roeck
maintainerPATCH 28/44 x86: olpc: Register xo1 poweroff handler with kernel poweroff handler
In reply to Guenter RoeckRegister 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.
--- 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
@@ -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
Guenter Roeck
maintainerPATCH 29/44 staging: nvec: Register with kernel poweroff handler
In reply to Guenter RoeckRegister 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.
--- 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
@@ -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
@@ -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
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_offdirectly. 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]>Signed-off-by Guenter Roeck <[email protected]>--- drivers/staging/nvec/nvec.c | 24 +++++++++++++++--------- drivers/staging/nvec/nvec.h | 2 ++ 2 files changed, 17 insertions(+), 9 deletions(-)
Re: [PATCH 29/44] staging: nvec: Register with kernel poweroff handler
In reply to Guenter RoeckQuoted 4 lines · Guenter Roeck
Register with kernel poweroff handler instead of setting
pm_power_offdirectly. 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]>Signed-off-by Guenter Roeck <[email protected]>--- drivers/staging/nvec/nvec.c | 24 +++++++++++++++--------- drivers/staging/nvec/nvec.h | 2 ++ 2 files changed, 17 insertions(+), 9 deletions(-)
Marc Dietrich
maintainerRe: [PATCH 29/44] staging: nvec: Register with kernel poweroff handler
In reply to Guenter RoeckAm Montag 06 Oktober 2014, 22:28:31 schrieb Guenter Roeck:
Quoted 3 lines
Register with kernel poweroff handler instead of setting
pm_power_offdirectly. 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
Guenter Roeck
maintainerPATCH 29/44 staging: nvec: Register with kernel poweroff handler
In reply to Guenter RoeckRegister 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.
--- 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
@@ -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
@@ -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
Guenter Roeck
maintainerPATCH 30/44 acpi: Register poweroff handler with kernel poweroff handler
In reply to Guenter RoeckRegister 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.
--- drivers/acpi/sleep.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/acpi/sleep.c +13 -2
@@ -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
Guenter Roeck
maintainerPATCH 30/44 acpi: Register poweroff handler with kernel poweroff handler
In reply to Guenter RoeckRegister 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.
--- drivers/acpi/sleep.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/acpi/sleep.c +13 -2
@@ -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
Guenter Roeck
maintainerPATCH 30/44 acpi: Register poweroff handler with kernel poweroff handler
In reply to Guenter RoeckRegister 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.
--- drivers/acpi/sleep.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/acpi/sleep.c +13 -2
@@ -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
Guenter Roeck
maintainerPATCH 31/44 arm: Register with kernel poweroff handler
In reply to Guenter RoeckRegister 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.
--- 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
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_offdirectly. Always useregister_poweroff_handler_simpleas 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]>Signed-off-by Guenter Roeck <[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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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
Re: [PATCH 31/44] arm: Register with kernel poweroff handler
In reply to Guenter RoeckOn 07/10/2014 07:28, Guenter Roeck :
Quoted 36 lines
Register with kernel poweroff handler instead of setting
pm_power_offdirectly. Always useregister_poweroff_handler_simpleas 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]>Signed-off-by Guenter Roeck <[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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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
Re: [PATCH 31/44] arm: Register with kernel poweroff handler
In reply to Guenter RoeckOn 07/10/2014 07:28, Guenter Roeck :
Quoted 36 lines
Register with kernel poweroff handler instead of setting
pm_power_offdirectly. Always useregister_poweroff_handler_simpleas 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]>Signed-off-by Guenter Roeck <[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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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@@ -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
Guenter Roeck
maintainerPATCH 31/44 arm: Register with kernel poweroff handler
In reply to Guenter RoeckRegister 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.
--- 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
Guenter Roeck
maintainerPATCH 31/44 arm: Register with kernel poweroff handler
In reply to Guenter RoeckRegister 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.
--- 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
Guenter Roeck
maintainerPATCH 32/44 arm64: psci: Register with kernel poweroff handler
In reply to Guenter RoeckRegister with kernel poweroff handler instead of setting pm_power_off directly.
--- arch/arm64/kernel/psci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
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);
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
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_offdirectly.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Signed-off-by Guenter Roeck <[email protected]>--- arch/arm64/kernel/psci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm64/kernel/psci.c +0
-0
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);
Re: [PATCH 32/44] arm64: psci: Register with kernel poweroff handler
In reply to Guenter RoeckQuoted 15 lines · Guenter Roeck
Register with kernel poweroff handler instead of setting
pm_power_offdirectly.Cc Catalin Marinas <[email protected]>Cc Will Deacon <[email protected]>Signed-off-by Guenter Roeck <[email protected]>--- arch/arm64/kernel/psci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm64/kernel/psci.c +0
-0
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);
Guenter Roeck
maintainerPATCH 32/44 arm64: psci: Register with kernel poweroff handler
In reply to Guenter RoeckRegister with kernel poweroff handler instead of setting pm_power_off directly.
--- arch/arm64/kernel/psci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
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);
Signature · 1 line
1.9.1
Guenter Roeck
maintainerPATCH 32/44 arm64: psci: Register with kernel poweroff handler
In reply to Guenter RoeckRegister with kernel poweroff handler instead of setting pm_power_off directly.
--- arch/arm64/kernel/psci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
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);
Signature · 1 line
1.9.1
Guenter Roeck
maintainerPATCH 33/44 avr32: atngw100: Register with kernel poweroff handler
In reply to Guenter RoeckRegister with kernel poweroff handler instead of setting pm_power_off directly.
--- arch/avr32/boards/atngw100/mrmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/avr32/boards/atngw100/mrmt.c +1 -1
@@ -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
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_offdirectly.Cc Haavard Skinnemoen <[email protected]>Cc Hans-Christian Egtvedt <[email protected]>Signed-off-by Guenter Roeck <[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@@ -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
Guenter Roeck
maintainerRe: [PATCH 33/44] avr32: atngw100: Register with kernel poweroff handler
Quoted 10 lines · Hans-Christian Egtvedt
Quoted 6 lines · Guenter Roeck
Register with kernel poweroff handler instead of setting
pm_power_offdirectly.Cc Haavard Skinnemoen <[email protected]>Cc Hans-Christian Egtvedt <[email protected]>Signed-off-by Guenter Roeck <[email protected]>
Thanks!
Guenter
Guenter Roeck
maintainerRe: [PATCH 33/44] avr32: atngw100: Register with kernel poweroff handler
In reply to Hans-Christian EgtvedtQuoted 10 lines · Hans-Christian Egtvedt
Quoted 6 lines · Guenter Roeck
Register with kernel poweroff handler instead of setting
pm_power_offdirectly.Cc Haavard Skinnemoen <[email protected]>Cc Hans-Christian Egtvedt <[email protected]>Signed-off-by Guenter Roeck <[email protected]>
Thanks!
Guenter
Guenter Roeck
maintainerRe: [PATCH 33/44] avr32: atngw100: Register with kernel poweroff handler
In reply to Hans-Christian EgtvedtQuoted 10 lines · Hans-Christian Egtvedt
Quoted 6 lines · Guenter Roeck
Register with kernel poweroff handler instead of setting
pm_power_offdirectly.Cc Haavard Skinnemoen <[email protected]>Cc Hans-Christian Egtvedt <[email protected]>Signed-off-by Guenter Roeck <[email protected]>
Thanks!
Guenter
Re: [PATCH 33/44] avr32: atngw100: Register with kernel poweroff handler
In reply to Guenter RoeckQuoted 6 lines · Guenter Roeck
Register with kernel poweroff handler instead of setting
pm_power_offdirectly.Cc Haavard Skinnemoen <[email protected]>Cc Hans-Christian Egtvedt <[email protected]>Signed-off-by Guenter Roeck <[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@@ -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
Re: [PATCH 33/44] avr32: atngw100: Register with kernel poweroff handler
In reply to Guenter RoeckQuoted 6 lines · Guenter Roeck
Register with kernel poweroff handler instead of setting
pm_power_offdirectly.Cc Haavard Skinnemoen <[email protected]>Cc Hans-Christian Egtvedt <[email protected]>Signed-off-by Guenter Roeck <[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@@ -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
Guenter Roeck
maintainerPATCH 33/44 avr32: atngw100: Register with kernel poweroff handler
In reply to Guenter RoeckRegister with kernel poweroff handler instead of setting pm_power_off directly.
--- arch/avr32/boards/atngw100/mrmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/avr32/boards/atngw100/mrmt.c +1 -1
@@ -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
Guenter Roeck
maintainerPATCH 33/44 avr32: atngw100: Register with kernel poweroff handler
In reply to Guenter RoeckRegister with kernel poweroff handler instead of setting pm_power_off directly.
--- arch/avr32/boards/atngw100/mrmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/avr32/boards/atngw100/mrmt.c +1 -1
@@ -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
Guenter Roeck
maintainerPATCH 34/44 ia64: Register with kernel poweroff handler
In reply to Guenter RoeckRegister 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
@@ -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
Guenter Roeck
maintainerPATCH 34/44 ia64: Register with kernel poweroff handler
In reply to Guenter RoeckRegister 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
@@ -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
Guenter Roeck
maintainerPATCH 34/44 ia64: Register with kernel poweroff handler
In reply to Guenter RoeckRegister 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
@@ -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
Guenter Roeck
maintainerPATCH 35/44 m68k: Register with kernel poweroff handler
In reply to Guenter RoeckRegister with kernel poweroff handler instead of setting pm_power_off directly.
--- 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
@@ -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
@@ -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
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_offdirectly.Cc Geert Uytterhoeven <[email protected]>Cc Joshua Thompson <[email protected]>Signed-off-by Guenter Roeck <[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
Re: [PATCH 35/44] m68k: Register with kernel poweroff handler
In reply to Guenter RoeckQuoted 6 lines · Guenter Roeck
Register with kernel poweroff handler instead of setting
pm_power_offdirectly.Cc Geert Uytterhoeven <[email protected]>Cc Joshua Thompson <[email protected]>Signed-off-by Guenter Roeck <[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
Guenter Roeck
maintainerPATCH 35/44 m68k: Register with kernel poweroff handler
In reply to Guenter RoeckRegister with kernel poweroff handler instead of setting pm_power_off directly.
--- 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
@@ -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
@@ -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
Guenter Roeck
maintainerPATCH 35/44 m68k: Register with kernel poweroff handler
In reply to Guenter RoeckRegister with kernel poweroff handler instead of setting pm_power_off directly.
--- 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
@@ -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
@@ -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
Guenter Roeck
maintainerPATCH 36/44 mips: Register with kernel poweroff handler
In reply to Guenter RoeckRegister 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.
--- 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
Guenter Roeck
maintainerPATCH 36/44 mips: Register with kernel poweroff handler
In reply to Guenter RoeckRegister 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.
--- 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
Guenter Roeck
maintainerPATCH 36/44 mips: Register with kernel poweroff handler
In reply to Guenter RoeckRegister 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.
--- 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
Guenter Roeck
maintainerPATCH 37/44 sh: Register with kernel poweroff handler
In reply to Guenter RoeckRegister 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
Guenter Roeck
maintainerPATCH 37/44 sh: Register with kernel poweroff handler
In reply to Guenter RoeckRegister 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
Guenter Roeck
maintainerPATCH 38/44 x86: lguest: Register with kernel poweroff handler
In reply to Guenter RoeckRegister with kernel poweroff handler instead of setting pm_power_off directly.
--- arch/x86/lguest/boot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/lguest/boot.c +1 -1
@@ -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
Guenter Roeck
maintainerPATCH 38/44 x86: lguest: Register with kernel poweroff handler
In reply to Guenter RoeckRegister with kernel poweroff handler instead of setting pm_power_off directly.
--- arch/x86/lguest/boot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/lguest/boot.c +1 -1
@@ -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
Guenter Roeck
maintainerPATCH 38/44 x86: lguest: Register with kernel poweroff handler
In reply to Guenter RoeckRegister with kernel poweroff handler instead of setting pm_power_off directly.
--- arch/x86/lguest/boot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/lguest/boot.c +1 -1
@@ -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
Guenter Roeck
maintainerPATCH 39/44 x86: ce4100: Register with kernel poweroff handler
In reply to Guenter RoeckRegister with kernel poweroff handler instead of setting pm_power_off directly.
--- arch/x86/platform/ce4100/ce4100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/platform/ce4100/ce4100.c +1 -1
@@ -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
Guenter Roeck
maintainerPATCH 39/44 x86: ce4100: Register with kernel poweroff handler
In reply to Guenter RoeckRegister with kernel poweroff handler instead of setting pm_power_off directly.
--- arch/x86/platform/ce4100/ce4100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/platform/ce4100/ce4100.c +1 -1
@@ -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
Guenter Roeck
maintainerPATCH 39/44 x86: ce4100: Register with kernel poweroff handler
In reply to Guenter RoeckRegister with kernel poweroff handler instead of setting pm_power_off directly.
--- arch/x86/platform/ce4100/ce4100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/platform/ce4100/ce4100.c +1 -1
@@ -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
Guenter Roeck
maintainerPATCH 40/44 x86: intel-mid: Drop registration of dummy poweroff handlers
In reply to Guenter RoeckA dummy poweroff handler does not serve any purpose. Drop it.
--- 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
@@ -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
@@ -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
Guenter Roeck
maintainerPATCH 40/44 x86: intel-mid: Drop registration of dummy poweroff handlers
In reply to Guenter RoeckA dummy poweroff handler does not serve any purpose. Drop it.
--- 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
@@ -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
@@ -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
Guenter Roeck
maintainerPATCH 40/44 x86: intel-mid: Drop registration of dummy poweroff handlers
In reply to Guenter RoeckA dummy poweroff handler does not serve any purpose. Drop it.
--- 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
@@ -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
@@ -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
Guenter Roeck
maintainerPATCH 41/44 x86: pmc_atom: Register poweroff handler with kernel poweroff handler
In reply to Guenter RoeckRegister 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.
--- arch/x86/kernel/pmc_atom.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
arch/x86/kernel/pmc_atom.c +17 -3
@@ -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
Guenter Roeck
maintainerPATCH 41/44 x86: pmc_atom: Register poweroff handler with kernel poweroff handler
In reply to Guenter RoeckRegister 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.
--- arch/x86/kernel/pmc_atom.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
arch/x86/kernel/pmc_atom.c +17 -3
@@ -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
Guenter Roeck
maintainerPATCH 41/44 x86: pmc_atom: Register poweroff handler with kernel poweroff handler
In reply to Guenter RoeckRegister 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.
--- arch/x86/kernel/pmc_atom.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
arch/x86/kernel/pmc_atom.c +17 -3
@@ -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
Guenter Roeck
maintainerPATCH 42/44 efi: Register poweroff handler with kernel poweroff handler
In reply to Guenter RoeckRegister 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
@@ -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
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_offdirectly. Register with low priority value of 64 since the efi code states that this is a poweroff handler of last resort.Cc Matt Fleming <[email protected]>Signed-off-by Guenter Roeck <[email protected]>--- 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@@ -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
Mark Salter
Acked-byRe: [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_offdirectly. 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
Cc Matt Fleming <[email protected]>Signed-off-by Guenter Roeck <[email protected]>--- 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@@ -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
Guenter Roeck
maintainerRe: [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_offdirectly. Register with low priority value of 64 since the efi code states that this is a poweroff handler of last resort.Cc Matt Fleming <[email protected]>Signed-off-by Guenter Roeck <[email protected]>--- 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.
Acked-by Mark Salter <[email protected]>
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@@ -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
Matt Fleming
Acked-byRe: [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
Guenter Roeck
maintainerRe: [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.
Acked-by Matt Fleming <[email protected]>
No worries. Thanks a lot!
Guenter
Guenter Roeck
maintainerPATCH 42/44 efi: Register poweroff handler with kernel poweroff handler
In reply to Guenter RoeckRegister 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
@@ -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
Guenter Roeck
maintainerPATCH 42/44 efi: Register poweroff handler with kernel poweroff handler
In reply to Guenter RoeckRegister 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
@@ -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
Guenter Roeck
maintainerPATCH 43/44 hwmon: (ab8500) Call kernel_power_off instead of pm_power_off
In reply to Guenter RoeckDrivers 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
@@ -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
Guenter Roeck
maintainerPATCH 43/44 hwmon: (ab8500) Call kernel_power_off instead of pm_power_off
In reply to Guenter RoeckDrivers 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
@@ -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
Guenter Roeck
maintainerPATCH 43/44 hwmon: (ab8500) Call kernel_power_off instead of pm_power_off
In reply to Guenter RoeckDrivers 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
@@ -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
Guenter Roeck
maintainerPATCH 44/44 kernel: Remove pm_power_off
In reply to Guenter RoeckNo users of pm_power_off are left, so it is safe to remove the function.
--- include/linux/pm.h | 1 - kernel/power/poweroff_handler.c | 10 +--------- 2 files changed, 1 insertion(+), 10 deletions(-)
include/linux/pm.h +0 -1
@@ -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
@@ -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
Re: [PATCH 44/44] kernel: Remove pm_power_off
Quoted 6 lines · Guenter Roeck
No users of
pm_power_offare 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]>Signed-off-by Guenter Roeck <[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@@ -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@@ -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.
Re: [PATCH 44/44] kernel: Remove pm_power_off
In reply to Guenter RoeckQuoted 6 lines · Guenter Roeck
No users of
pm_power_offare 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]>Signed-off-by Guenter Roeck <[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@@ -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@@ -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.
Guenter Roeck
maintainerPATCH 44/44 kernel: Remove pm_power_off
In reply to Guenter RoeckNo users of pm_power_off are left, so it is safe to remove the function.
--- include/linux/pm.h | 1 - kernel/power/poweroff_handler.c | 10 +--------- 2 files changed, 1 insertion(+), 10 deletions(-)
include/linux/pm.h +0 -1
@@ -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
@@ -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
Guenter Roeck
maintainerPATCH 44/44 kernel: Remove pm_power_off
In reply to Guenter RoeckNo users of pm_power_off are left, so it is safe to remove the function.
--- include/linux/pm.h | 1 - kernel/power/poweroff_handler.c | 10 +--------- 2 files changed, 1 insertion(+), 10 deletions(-)
include/linux/pm.h +0 -1
@@ -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
@@ -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