]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
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 6bdcd0da9e2148565522bd12a4dcece725c9fa70..a9af1bd6a51e003cffb36588ab01715baf6de83a 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 0acc7c7c28d1fb0379532e951501a7e4146bf86a..e94cede14522f47586b92d0542ba6e4316efaec9 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 033039a80c42565a4a4bf01bb1f7d7e484f5d6e0..610a5119ad8c7910a5fe932b6ae851e4942969d9 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 51400baa8d48d68a9192bb9e4557f1caedace8b9..fa3e3c4367bd95ec2d98e1b39694be2b1d08920c 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 286354f00ff69cae8ae05738f8b4294d2d46d66f..6a3e5de544ce2f2b6a3311338daafd19b442f6b5 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 c11ce6516c8f70848313c1d528bc57ba6afd6dae..003973f652975527b6720e8686021aa82ba95d62 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 cc97f022d0284018a6768cc75c68d33a4fd8fdcd..14ba49fd79388f47924530109a82760b70bda666 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 452da2391153aef4ffb132a65d440ccfa8fe0e45..6b4f4cb7009a33c3fed9e0dce6df52cb2c006330 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 26993826a797683e0fea881fc7f6f1c11fa0c703..565e3a83dc9ee1c1d0dc5de9dbc73d711d97fc05 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 fc8b2d6a7d8d231c14ecfe3363507a6c24adb778..c4f7029fc9aec41f4febc2fba0a24f1216c3a445 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 a41f84ae2325ac577e930d48d0282f1eecb74cb1..3080ce3441c1a78d1210fb9d2167d5e664d1f245 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 7e923cad56cf62ce577d43aeb31d88cc6958ef05..8899aa9d11f5fae495d30209706226c1a60461c6 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 0cf74d7ea1c56cb26fea0096627949b20af4002e..ad484199eff7862881001ba722a738b684d19cd4 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 3dc1bda3ddc31bff240f6f32b821f13856d90113..867a1078b488c2180f3cd1f8f7c68fdab36f77ad 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 d7e87ff912d7d9df3e18c7e7357d39f313880d2b..5e0a0a24d5ce11c308442137cf9ae06b86f2e124 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 c289fc77b4ba6c979b3a46b2776b4dc5bbc8bc87..b1ab6e96cb312ef4e0730a9850dc32fbc643d00d 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 239a243a6161828fa30cccac47eb0c8b54d7ae93..31cc2ecace4238bf6abef837e8f1d6cd486035c1 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 2fe12046279ef53483f5b0c1659123dad1d7a0e4..3e12d87892526ee1454e0d879f3b112cca6567c1 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 987d1b8d68e3dba186bbceda54631ecdd4c48136..c55002f01dc12e3e2697e1266ba80cd00b683901 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 ebd3963fdf911bf256d180df98cec93772c3fa44..782066245bb533ec4e34ca9c2337b542677a84c6 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 fe0ed6ee285e6241528f1bd54acfaa442fcb0a19..b17705c3f7a4f34282f6b13406c4fd122bbf59e0 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 8c305c7c8977dbffc4edd142b5d77d83ed142d78..8b6e7610089549d27a95673de9d23850636a4ce3 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 540eeb58d3f03775f275fd9d9ab92b000da2d5a0..4c5089f05c7ff4886d60fc8c4c4bb52aa9f67f9d 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 df4ad95f183e12158eaa7d3e103f1828dd13c5b2..3eda5df6281af49117816dcbf7d72452139448cb 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 8f65aa3747f5afefbc91c558884b10ad282c3ab3..1382e1f275181e138e26374ac6ecf230436462ad 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 d572833ebd00cc3e27b1a7671292335f2f2507b5..4596cba8c8275fc9db4d9485764621edfbc82da7 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 352592d3e44ee74a8f835e61d31aa6d4109c5a9c..ebaecb88df265d03b28bf278ea9946e5fd43007b 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 a837188544c8add6730b1df53abb27791071e347..5f8f6f96660809cac3e24e540aff0045afeefcec 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 d71b2c7e84031ba4c94e41664b365eb14c1e24b5..7349644c9828d1dee288a8201f3e0db968820a68 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 8dd78f4e1af4a429ada238c74614942d9c669bc6..bd83b52c98302c1f067e46b39136ffa2fb4f070c 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 799c8580ab09cf898d408f0d36e9b102d6373fbd..486ecd017535787a47c9a5da1cb45868a90e2b89 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 99269c041615b2bff59d891010e9574f64babfa1..a09ca704de58af05ce66c8229b9ddfca2bf834b1 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 4c5a19ef4f0bb806e8adcf9251aa63f6d365a7bb..433566a5ef192703d74c6ac64728c1441d6aa22e 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