OSDN Git Service

powerpc: Make ppc_md.{halt, restart} __noreturn
authorDaniel Axtens <dja@axtens.net>
Tue, 12 Jul 2016 00:54:52 +0000 (10:54 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 14 Jul 2016 11:12:06 +0000 (21:12 +1000)
powernv marks it's halt and restart calls as __noreturn. However,
ppc_md does not have this annotation. Add the annotation to ppc_md,
and then to every halt/restart function that is missing it.

Additionally, I have verified that all of these functions do not
return. Occasionally I have added a spin loop to be sure.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
33 files changed:
arch/powerpc/include/asm/machdep.h
arch/powerpc/include/asm/mpc52xx.h
arch/powerpc/include/asm/ppc4xx.h
arch/powerpc/include/asm/rtas.h
arch/powerpc/kernel/rtas.c
arch/powerpc/platforms/44x/ppc476.c
arch/powerpc/platforms/512x/mpc512x.h
arch/powerpc/platforms/512x/mpc512x_shared.c
arch/powerpc/platforms/52xx/mpc52xx_common.c
arch/powerpc/platforms/82xx/pq2.c
arch/powerpc/platforms/82xx/pq2.h
arch/powerpc/platforms/83xx/misc.c
arch/powerpc/platforms/83xx/mpc83xx.h
arch/powerpc/platforms/85xx/ksi8560.c
arch/powerpc/platforms/85xx/mpc85xx_cds.c
arch/powerpc/platforms/8xx/m8xx_setup.c
arch/powerpc/platforms/8xx/mpc8xx.h
arch/powerpc/platforms/amigaone/setup.c
arch/powerpc/platforms/chrp/setup.c
arch/powerpc/platforms/embedded6xx/c2k.c
arch/powerpc/platforms/embedded6xx/gamecube.c
arch/powerpc/platforms/embedded6xx/holly.c
arch/powerpc/platforms/embedded6xx/linkstation.c
arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
arch/powerpc/platforms/embedded6xx/mvme5100.c
arch/powerpc/platforms/embedded6xx/storcenter.c
arch/powerpc/platforms/embedded6xx/wii.c
arch/powerpc/platforms/maple/setup.c
arch/powerpc/platforms/pasemi/setup.c
arch/powerpc/platforms/powermac/setup.c
arch/powerpc/platforms/ps3/setup.c
arch/powerpc/sysdev/fsl_soc.c
arch/powerpc/sysdev/fsl_soc.h

index 6bdcd0d..a9af1bd 100644 (file)
@@ -111,8 +111,8 @@ struct machdep_calls {
        /* To setup PHBs when using automatic OF platform driver for PCI */
        int             (*pci_setup_phb)(struct pci_controller *host);
 
-       void            (*restart)(char *cmd);
-       void            (*halt)(void);
+       void __noreturn (*restart)(char *cmd);
+       void __noreturn (*halt)(void);
        void            (*panic)(char *str);
        void            (*cpu_die)(void);
 
index 0acc7c7..e94cede 100644 (file)
@@ -275,7 +275,7 @@ extern int mpc5200_psc_ac97_gpio_reset(int psc_number);
 extern void mpc52xx_map_common_devices(void);
 extern int mpc52xx_set_psc_clkdiv(int psc_id, int clkdiv);
 extern unsigned int mpc52xx_get_xtal_freq(struct device_node *node);
-extern void mpc52xx_restart(char *cmd);
+extern void __noreturn mpc52xx_restart(char *cmd);
 
 /* mpc52xx_gpt.c */
 struct mpc52xx_gpt_priv;
index 033039a..610a511 100644 (file)
@@ -13,6 +13,6 @@
 #ifndef __ASM_POWERPC_PPC4xx_H__
 #define __ASM_POWERPC_PPC4xx_H__
 
-extern void ppc4xx_reset_system(char *cmd);
+extern void __noreturn ppc4xx_reset_system(char *cmd);
 
 #endif /* __ASM_POWERPC_PPC4xx_H__ */
index 51400ba..fa3e3c4 100644 (file)
@@ -339,9 +339,9 @@ extern int rtas_service_present(const char *service);
 extern int rtas_call(int token, int, int, int *, ...);
 void rtas_call_unlocked(struct rtas_args *args, int token, int nargs,
                        int nret, ...);
-extern void rtas_restart(char *cmd);
+extern void __noreturn rtas_restart(char *cmd);
 extern void rtas_power_off(void);
-extern void rtas_halt(void);
+extern void __noreturn rtas_halt(void);
 extern void rtas_os_term(char *str);
 extern int rtas_get_sensor(int sensor, int index, int *state);
 extern int rtas_get_sensor_fast(int sensor, int index, int *state);
index 286354f..6a3e5de 100644 (file)
@@ -685,7 +685,7 @@ int rtas_set_indicator_fast(int indicator, int index, int new_value)
        return rc;
 }
 
-void rtas_restart(char *cmd)
+void __noreturn rtas_restart(char *cmd)
 {
        if (rtas_flash_term_hook)
                rtas_flash_term_hook(SYS_RESTART);
@@ -704,7 +704,7 @@ void rtas_power_off(void)
        for (;;);
 }
 
-void rtas_halt(void)
+void __noreturn rtas_halt(void)
 {
        if (rtas_flash_term_hook)
                rtas_flash_term_hook(SYS_HALT);
index c11ce65..003973f 100644 (file)
@@ -68,7 +68,7 @@ DECLARE_PCI_FIXUP_HEADER(0x1033, 0x0035, quirk_ppc_currituck_usb_fixup);
 #define AVR_PWRCTL_RESET (0x02)
 
 static struct i2c_client *avr_i2c_client;
-static void avr_halt_system(int pwrctl_flags)
+static void __noreturn avr_halt_system(int pwrctl_flags)
 {
        /* Request the AVR to reset the system */
        i2c_smbus_write_byte_data(avr_i2c_client,
@@ -84,7 +84,7 @@ static void avr_power_off_system(void)
        avr_halt_system(AVR_PWRCTL_PWROFF);
 }
 
-static void avr_reset_system(char *cmd)
+static void __noreturn avr_reset_system(char *cmd)
 {
        avr_halt_system(AVR_PWRCTL_RESET);
 }
index cc97f02..14ba49f 100644 (file)
@@ -18,6 +18,6 @@ extern void __init mpc512x_setup_arch(void);
 extern int __init mpc5121_clk_init(void);
 extern const char *mpc512x_select_psc_compat(void);
 extern const char *mpc512x_select_reset_compat(void);
-extern void mpc512x_restart(char *cmd);
+extern void __noreturn mpc512x_restart(char *cmd);
 
 #endif                         /* __MPC512X_H__ */
index 452da23..6b4f4cb 100644 (file)
@@ -47,7 +47,7 @@ static void __init mpc512x_restart_init(void)
        of_node_put(np);
 }
 
-void mpc512x_restart(char *cmd)
+void __noreturn mpc512x_restart(char *cmd)
 {
        if (reset_module_base) {
                /* Enable software reset "RSTE" */
index 2699382..565e3a8 100644 (file)
@@ -243,8 +243,7 @@ EXPORT_SYMBOL(mpc52xx_get_xtal_freq);
 /**
  * mpc52xx_restart: ppc_md->restart hook for mpc5200 using the watchdog timer
  */
-void
-mpc52xx_restart(char *cmd)
+void __noreturn mpc52xx_restart(char *cmd)
 {
        local_irq_disable();
 
index fc8b2d6..c4f7029 100644 (file)
@@ -22,7 +22,7 @@
 
 #define RMR_CSRE 0x00000001
 
-void pq2_restart(char *cmd)
+void __noreturn pq2_restart(char *cmd)
 {
        local_irq_disable();
        setbits32(&cpm2_immr->im_clkrst.car_rmr, RMR_CSRE);
index a41f84a..3080ce3 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef _PQ2_H
 #define _PQ2_H
 
-void pq2_restart(char *cmd);
+void __noreturn pq2_restart(char *cmd);
 
 #ifdef CONFIG_PCI
 int pq2ads_pci_init_irq(void);
index 7e923ca..8899aa9 100644 (file)
@@ -35,7 +35,7 @@ static int __init mpc83xx_restart_init(void)
 
 arch_initcall(mpc83xx_restart_init);
 
-void mpc83xx_restart(char *cmd)
+void __noreturn mpc83xx_restart(char *cmd)
 {
 #define RST_OFFSET     0x00000900
 #define RST_PROT_REG   0x00000018
index 0cf74d7..ad48419 100644 (file)
@@ -65,7 +65,7 @@
  * mpc83xx_* files. Mostly for use by mpc83xx_setup
  */
 
-extern void mpc83xx_restart(char *cmd);
+extern void __noreturn mpc83xx_restart(char *cmd);
 extern long mpc83xx_time_init(void);
 extern int mpc837x_usb_cfg(void);
 extern int mpc834x_usb_cfg(void);
index 3dc1bda..867a107 100644 (file)
@@ -44,7 +44,7 @@
 
 static void __iomem *cpld_base = NULL;
 
-static void machine_restart(char *cmd)
+static void __noreturn machine_restart(char *cmd)
 {
        if (cpld_base)
                out_8(cpld_base + KSI8560_CPLD_RCR1, KSI8560_CPLD_RCR1_CPUHR);
index d7e87ff..5e0a0a2 100644 (file)
@@ -83,7 +83,7 @@ static int mpc85xx_exclude_device(struct pci_controller *hose,
                return PCIBIOS_SUCCESSFUL;
 }
 
-static void mpc85xx_cds_restart(char *cmd)
+static void __noreturn mpc85xx_cds_restart(char *cmd)
 {
        struct pci_dev *dev;
        u_char tmp;
index c289fc7..b1ab6e9 100644 (file)
@@ -198,7 +198,7 @@ void mpc8xx_get_rtc_time(struct rtc_time *tm)
        return;
 }
 
-void mpc8xx_restart(char *cmd)
+void __noreturn mpc8xx_restart(char *cmd)
 {
        car8xx_t __iomem *clk_r = immr_map(im_clkrst);
 
index 239a243..31cc2ec 100644 (file)
@@ -11,7 +11,7 @@
 #ifndef __MPC8xx_H
 #define __MPC8xx_H
 
-extern void mpc8xx_restart(char *cmd);
+extern void __noreturn mpc8xx_restart(char *cmd);
 extern void mpc8xx_calibrate_decr(void);
 extern int mpc8xx_set_rtc_time(struct rtc_time *tm);
 extern void mpc8xx_get_rtc_time(struct rtc_time *tm);
index 2fe1204..3e12d87 100644 (file)
@@ -123,7 +123,7 @@ static int __init request_isa_regions(void)
 }
 machine_device_initcall(amigaone, request_isa_regions);
 
-void amigaone_restart(char *cmd)
+void __noreturn amigaone_restart(char *cmd)
 {
        local_irq_disable();
 
index 987d1b8..c55002f 100644 (file)
@@ -239,7 +239,7 @@ out:
        of_node_put(np);
 }
 
-static void briq_restart(char *cmd)
+static void __noreturn briq_restart(char *cmd)
 {
        local_irq_disable();
        if (briq_SPOR)
index ebd3963..7820662 100644 (file)
@@ -99,7 +99,7 @@ static void c2k_reset_board(void)
        out_le32(mv64x60_gpp_reg_base + MV64x60_GPP_VALUE_SET, 0x00080004);
 }
 
-static void c2k_restart(char *cmd)
+static void __noreturn c2k_restart(char *cmd)
 {
        c2k_reset_board();
        msleep(100);
index fe0ed6e..b17705c 100644 (file)
 #include "usbgecko_udbg.h"
 
 
-static void gamecube_spin(void)
+static void __noreturn gamecube_spin(void)
 {
        /* spin until power button pressed */
        for (;;)
                cpu_relax();
 }
 
-static void gamecube_restart(char *cmd)
+static void __noreturn gamecube_restart(char *cmd)
 {
        local_irq_disable();
        flipper_platform_reset();
@@ -49,7 +49,7 @@ static void gamecube_power_off(void)
        gamecube_spin();
 }
 
-static void gamecube_halt(void)
+static void __noreturn gamecube_halt(void)
 {
        gamecube_restart(NULL);
 }
index 8c305c7..8b6e761 100644 (file)
@@ -193,7 +193,7 @@ void holly_show_cpuinfo(struct seq_file *m)
        seq_printf(m, "machine\t\t: PPC750 GX/CL\n");
 }
 
-void holly_restart(char *cmd)
+void __noreturn holly_restart(char *cmd)
 {
        __be32 __iomem *ocn_bar1 = NULL;
        unsigned long bar;
index 540eeb5..4c5089f 100644 (file)
@@ -100,7 +100,7 @@ static void __init linkstation_init_IRQ(void)
 extern void avr_uart_configure(void);
 extern void avr_uart_send(const char);
 
-static void linkstation_restart(char *cmd)
+static void __noreturn linkstation_restart(char *cmd)
 {
        local_irq_disable();
 
@@ -113,7 +113,7 @@ static void linkstation_restart(char *cmd)
                avr_uart_send('G');     /* "kick" */
 }
 
-static void linkstation_power_off(void)
+static void __noreturn linkstation_power_off(void)
 {
        local_irq_disable();
 
@@ -127,7 +127,7 @@ static void linkstation_power_off(void)
        /* NOTREACHED */
 }
 
-static void linkstation_halt(void)
+static void __noreturn linkstation_halt(void)
 {
        linkstation_power_off();
        /* NOTREACHED */
index df4ad95..3eda5df 100644 (file)
@@ -146,7 +146,7 @@ void mpc7448_hpc2_show_cpuinfo(struct seq_file *m)
        seq_printf(m, "vendor\t\t: Freescale Semiconductor\n");
 }
 
-void mpc7448_hpc2_restart(char *cmd)
+static void __noreturn mpc7448_hpc2_restart(char *cmd)
 {
        local_irq_disable();
 
index 8f65aa3..1382e1f 100644 (file)
@@ -177,7 +177,7 @@ static void mvme5100_show_cpuinfo(struct seq_file *m)
        seq_puts(m, "Machine\t\t: MVME5100\n");
 }
 
-static void mvme5100_restart(char *cmd)
+static void __noreturn mvme5100_restart(char *cmd)
 {
 
        local_irq_disable();
index d572833..4596cba 100644 (file)
@@ -96,7 +96,7 @@ static void __init storcenter_init_IRQ(void)
        mpic_init(mpic);
 }
 
-static void storcenter_restart(char *cmd)
+static void __noreturn storcenter_restart(char *cmd)
 {
        local_irq_disable();
 
index 352592d..ebaecb8 100644 (file)
@@ -112,7 +112,7 @@ unsigned long __init wii_mmu_mapin_mem2(unsigned long top)
        return delta + bl;
 }
 
-static void wii_spin(void)
+static void __noreturn wii_spin(void)
 {
        local_irq_disable();
        for (;;)
@@ -160,7 +160,7 @@ static void __init wii_setup_arch(void)
        }
 }
 
-static void wii_restart(char *cmd)
+static void __noreturn wii_restart(char *cmd)
 {
        local_irq_disable();
 
@@ -185,7 +185,7 @@ static void wii_power_off(void)
        wii_spin();
 }
 
-static void wii_halt(void)
+static void __noreturn wii_halt(void)
 {
        if (ppc_md.restart)
                ppc_md.restart(NULL);
index a837188..5f8f6f9 100644 (file)
@@ -94,7 +94,7 @@ static unsigned long maple_find_nvram_base(void)
        return result;
 }
 
-static void maple_restart(char *cmd)
+static void __noreturn maple_restart(char *cmd)
 {
        unsigned int maple_nvram_base;
        const unsigned int *maple_nvram_offset, *maple_nvram_command;
@@ -119,9 +119,10 @@ static void maple_restart(char *cmd)
        for (;;) ;
  fail:
        printk(KERN_EMERG "Maple: Manual Restart Required\n");
+       for (;;) ;
 }
 
-static void maple_power_off(void)
+static void __noreturn maple_power_off(void)
 {
        unsigned int maple_nvram_base;
        const unsigned int *maple_nvram_offset, *maple_nvram_command;
@@ -146,9 +147,10 @@ static void maple_power_off(void)
        for (;;) ;
  fail:
        printk(KERN_EMERG "Maple: Manual Power-Down Required\n");
+       for (;;) ;
 }
 
-static void maple_halt(void)
+static void __noreturn maple_halt(void)
 {
        maple_power_off();
 }
index d71b2c7..7349644 100644 (file)
@@ -62,7 +62,7 @@ static int num_mce_regs;
 static int nmi_virq = NO_IRQ;
 
 
-static void pas_restart(char *cmd)
+static void __noreturn pas_restart(char *cmd)
 {
        /* Need to put others cpu in hold loop so they're not sleeping */
        smp_send_stop();
index 8dd78f4..bd83b52 100644 (file)
@@ -383,7 +383,7 @@ void __init_refok note_bootable_part(dev_t dev, int part, int goodness)
 }
 
 #ifdef CONFIG_ADB_CUDA
-static void cuda_restart(void)
+static void __noreturn cuda_restart(void)
 {
        struct adb_request req;
 
@@ -392,7 +392,7 @@ static void cuda_restart(void)
                cuda_poll();
 }
 
-static void cuda_shutdown(void)
+static void __noreturn cuda_shutdown(void)
 {
        struct adb_request req;
 
@@ -416,7 +416,7 @@ static void cuda_shutdown(void)
 #define smu_shutdown()
 #endif
 
-static void pmac_restart(char *cmd)
+static void __noreturn pmac_restart(char *cmd)
 {
        switch (sys_ctrler) {
        case SYS_CTRLER_CUDA:
@@ -430,9 +430,10 @@ static void pmac_restart(char *cmd)
                break;
        default: ;
        }
+       while (1) ;
 }
 
-static void pmac_power_off(void)
+static void __noreturn pmac_power_off(void)
 {
        switch (sys_ctrler) {
        case SYS_CTRLER_CUDA:
@@ -446,9 +447,10 @@ static void pmac_power_off(void)
                break;
        default: ;
        }
+       while (1) ;
 }
 
-static void
+static void __noreturn
 pmac_halt(void)
 {
        pmac_power_off();
index 799c858..486ecd0 100644 (file)
@@ -80,7 +80,7 @@ static void ps3_power_save(void)
        lv1_pause(0);
 }
 
-static void ps3_restart(char *cmd)
+static void __noreturn ps3_restart(char *cmd)
 {
        DBG("%s:%d cmd '%s'\n", __func__, __LINE__, cmd);
 
@@ -96,7 +96,7 @@ static void ps3_power_off(void)
        ps3_sys_manager_power_off(); /* never returns */
 }
 
-static void ps3_halt(void)
+static void __noreturn ps3_halt(void)
 {
        DBG("%s:%d\n", __func__, __LINE__);
 
index 99269c0..a09ca70 100644 (file)
@@ -204,7 +204,7 @@ static int __init setup_rstcr(void)
 
 arch_initcall(setup_rstcr);
 
-void fsl_rstcr_restart(char *cmd)
+void __noreturn fsl_rstcr_restart(char *cmd)
 {
        local_irq_disable();
        if (rstcr)
@@ -228,10 +228,11 @@ EXPORT_SYMBOL(diu_ops);
  * to initiate a partition restart when we're running under the Freescale
  * hypervisor.
  */
-void fsl_hv_restart(char *cmd)
+void __noreturn fsl_hv_restart(char *cmd)
 {
        pr_info("hv restart\n");
        fh_partition_restart(-1);
+       while (1) ;
 }
 
 /*
@@ -241,9 +242,10 @@ void fsl_hv_restart(char *cmd)
  * function pointers, to shut down the partition when we're running under
  * the Freescale hypervisor.
  */
-void fsl_hv_halt(void)
+void __noreturn fsl_hv_halt(void)
 {
        pr_info("hv exit\n");
        fh_partition_stop(-1);
+       while (1) ;
 }
 #endif
index 4c5a19e..433566a 100644 (file)
@@ -19,7 +19,7 @@ extern u32 fsl_get_sys_freq(void);
 struct spi_board_info;
 struct device_node;
 
-extern void fsl_rstcr_restart(char *cmd);
+extern void __noreturn fsl_rstcr_restart(char *cmd);
 
 /* The different ports that the DIU can be connected to */
 enum fsl_diu_monitor_port {
@@ -42,8 +42,8 @@ struct platform_diu_data_ops {
 
 extern struct platform_diu_data_ops diu_ops;
 
-void fsl_hv_restart(char *cmd);
-void fsl_hv_halt(void);
+void __noreturn fsl_hv_restart(char *cmd);
+void __noreturn fsl_hv_halt(void);
 
 #endif
 #endif