]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
xtensa: drop platform_halt and platform_power_off
authorMax Filippov <jcmvbkbc@gmail.com>
Wed, 7 Jun 2023 15:59:38 +0000 (08:59 -0700)
committerMax Filippov <jcmvbkbc@gmail.com>
Tue, 13 Jun 2023 02:48:56 +0000 (19:48 -0700)
Instead of using xtensa-specific platform_halt and platform_power_off
callbacks use do_kernel_power_off in the machine_halt and
machine_power_off and reimplement existing platform_halt and
platform_power_off users with register_sys_off_handler.

Drop platform_halt and platform_power_off declarations and default
implementations.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
arch/xtensa/include/asm/platform.h
arch/xtensa/kernel/platform.c
arch/xtensa/kernel/setup.c
arch/xtensa/platforms/iss/setup.c
arch/xtensa/platforms/xt2000/setup.c
arch/xtensa/platforms/xtfpga/setup.c

index 5b3c1f96f7b503aefaa6a5c431c7409aed82e5ad..94f13fabf7cd7c3f2c17fb3491b92de6702c7fec 100644 (file)
@@ -27,16 +27,6 @@ extern void platform_init(bp_tag_t*);
  */
 extern void platform_setup (char **);
 
-/*
- * platform_halt is called to stop the system and halt.
- */
-extern void platform_halt (void);
-
-/*
- * platform_power_off is called to stop the system and power it off.
- */
-extern void platform_power_off (void);
-
 /*
  * platform_idle is called from the idle function.
  */
index 526ab744271f6feb91b0e02c1177615192f8817e..29fa5d6592741a7bf890e3bb21ecff6140350b40 100644 (file)
@@ -28,8 +28,6 @@
 
 _F(void, init, (bp_tag_t *first), { });
 _F(void, setup, (char** cmd), { });
-_F(void, halt, (void), { while(1); });
-_F(void, power_off, (void), { while(1); });
 _F(void, idle, (void), { __asm__ __volatile__ ("waiti 0" ::: "memory"); });
 
 #ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
index 8f72039335c25524c2e803de4a23b5ec7f5f2105..5680391d7e35f4e8796c95b916005725ca2b78d9 100644 (file)
@@ -533,14 +533,20 @@ void machine_restart(char * cmd)
 
 void machine_halt(void)
 {
-       platform_halt();
-       while (1);
+       local_irq_disable();
+       smp_send_stop();
+       do_kernel_power_off();
+       while (1)
+               cpu_relax();
 }
 
 void machine_power_off(void)
 {
-       platform_power_off();
-       while (1);
+       local_irq_disable();
+       smp_send_stop();
+       do_kernel_power_off();
+       while (1)
+               cpu_relax();
 }
 #ifdef CONFIG_PROC_FS
 
index a7009f223ef2d4f6b290d11e7da936ac63524315..0f1fe132691e26195d5834cb061be3d0fb9257e7 100644 (file)
 #include <platform/simcall.h>
 
 
-void platform_halt(void)
-{
-       pr_info(" ** Called platform_halt() **\n");
-       simc_exit(0);
-}
-
-void platform_power_off(void)
+static int iss_power_off(struct sys_off_data *unused)
 {
        pr_info(" ** Called platform_power_off() **\n");
        simc_exit(0);
+       return NOTIFY_DONE;
 }
 
 static int iss_restart(struct notifier_block *this,
@@ -90,4 +85,7 @@ void __init platform_setup(char **p_cmdline)
 
        atomic_notifier_chain_register(&panic_notifier_list, &iss_panic_block);
        register_restart_handler(&iss_restart_block);
+       register_sys_off_handler(SYS_OFF_MODE_POWER_OFF,
+                                SYS_OFF_PRIO_PLATFORM,
+                                iss_power_off, NULL);
 }
index 71b57ab50599424e4993167729449ac99649197e..258e01a51fd88e60a4b610d317d7e6db1dfa0996 100644 (file)
@@ -42,18 +42,12 @@ static void led_print (int f, char *s)
                    break;
 }
 
-void platform_halt(void)
-{
-       led_print (0, "  HALT  ");
-       local_irq_disable();
-       while (1);
-}
-
-void platform_power_off(void)
+static int xt2000_power_off(struct sys_off_data *unused)
 {
        led_print (0, "POWEROFF");
        local_irq_disable();
        while (1);
+       return NOTIFY_DONE;
 }
 
 static int xt2000_restart(struct notifier_block *this,
@@ -147,6 +141,9 @@ static int __init xt2000_setup_devinit(void)
        platform_device_register(&xt2000_sonic_device);
        mod_timer(&heartbeat_timer, jiffies + HZ / 2);
        register_restart_handler(&xt2000_restart_block);
+       register_sys_off_handler(SYS_OFF_MODE_POWER_OFF,
+                                SYS_OFF_PRIO_DEFAULT,
+                                xt2000_power_off, NULL);
        return 0;
 }
 
index 1690232c003e79538054a8625cc15bec44886947..a2432f0817101005d6cf995ce1cc5217d403bb57 100644 (file)
 #include <platform/lcd.h>
 #include <platform/hardware.h>
 
-void platform_halt(void)
-{
-       lcd_disp_at_pos(" HALT ", 0);
-       local_irq_disable();
-       while (1)
-               cpu_relax();
-}
-
-void platform_power_off(void)
+static int xtfpga_power_off(struct sys_off_data *unused)
 {
        lcd_disp_at_pos("POWEROFF", 0);
        local_irq_disable();
        while (1)
                cpu_relax();
+       return NOTIFY_DONE;
 }
 
 static int xtfpga_restart(struct notifier_block *this,
@@ -79,6 +72,9 @@ void __init platform_calibrate_ccount(void)
 static void __init xtfpga_register_handlers(void)
 {
        register_restart_handler(&xtfpga_restart_block);
+       register_sys_off_handler(SYS_OFF_MODE_POWER_OFF,
+                                SYS_OFF_PRIO_DEFAULT,
+                                xtfpga_power_off, NULL);
 }
 
 #ifdef CONFIG_USE_OF