Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

power/reset: arm-versatile: Register with kernel restart handler

Register with kernel restart handler instead of setting arm_pm_restart
directly. Select high priority since the restart handler is instantiated
through devicetree, indicating that it should be used if configured.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sebastian Reichel <sre@kernel.org>

authored by

Guenter Roeck and committed by
Sebastian Reichel
25a5b57d a30067bb

+14 -3
+14 -3
drivers/power/reset/arm-versatile-reboot.c
··· 13 13 #include <linux/reboot.h> 14 14 #include <linux/regmap.h> 15 15 #include <linux/of.h> 16 - #include <asm/system_misc.h> 17 16 18 17 #define INTEGRATOR_HDR_CTRL_OFFSET 0x0C 19 18 #define INTEGRATOR_HDR_LOCK_OFFSET 0x14 ··· 68 69 {}, 69 70 }; 70 71 71 - static void versatile_reboot(enum reboot_mode mode, const char *cmd) 72 + static int versatile_reboot(struct notifier_block *this, unsigned long mode, 73 + void *cmd) 72 74 { 73 75 /* Unlock the reset register */ 74 76 /* Then hit reset on the different machines */ ··· 113 113 break; 114 114 } 115 115 dsb(); 116 + 117 + return NOTIFY_DONE; 116 118 } 119 + 120 + static struct notifier_block versatile_reboot_nb = { 121 + .notifier_call = versatile_reboot, 122 + .priority = 192, 123 + }; 117 124 118 125 static int __init versatile_reboot_probe(void) 119 126 { 120 127 const struct of_device_id *reboot_id; 121 128 struct device_node *np; 129 + int err; 122 130 123 131 np = of_find_matching_node_and_match(NULL, versatile_reboot_of_match, 124 132 &reboot_id); ··· 138 130 if (IS_ERR(syscon_regmap)) 139 131 return PTR_ERR(syscon_regmap); 140 132 141 - arm_pm_restart = versatile_reboot; 133 + err = register_restart_handler(&versatile_reboot_nb); 134 + if (err) 135 + return err; 136 + 142 137 pr_info("versatile reboot driver registered\n"); 143 138 return 0; 144 139 }