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

m68k: Switch to new sys-off handler API

Kernel now supports chained power-off handlers. Use
register_power_off_handler() that registers power-off handlers and
do_kernel_power_off() that invokes chained power-off handlers. Legacy
pm_power_off() will be removed once all drivers will be converted to
the new sys-off API.

Normally arch code should adopt only the do_kernel_power_off() at first,
but m68k is a special case because it uses pm_power_off() "inside out",
i.e. pm_power_off() invokes machine_power_off() [in fact it does nothing],
while it's machine_power_off() that should invoke the pm_power_off(), and
thus, we can't convert platforms to the new API separately. There are only
two platforms changed here, so it's not a big deal.

Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Dmitry Osipenko and committed by
Rafael J. Wysocki
f0f7e526 c33fd0b1

+7 -8
+2 -1
arch/m68k/emu/natfeat.c
··· 15 15 #include <linux/string.h> 16 16 #include <linux/kernel.h> 17 17 #include <linux/module.h> 18 + #include <linux/reboot.h> 18 19 #include <linux/io.h> 19 20 #include <asm/machdep.h> 20 21 #include <asm/natfeat.h> ··· 91 90 pr_info("NatFeats found (%s, %lu.%lu)\n", buf, version >> 16, 92 91 version & 0xffff); 93 92 94 - mach_power_off = nf_poweroff; 93 + register_platform_power_off(nf_poweroff); 95 94 }
-1
arch/m68k/include/asm/machdep.h
··· 24 24 extern int (*mach_set_rtc_pll)(struct rtc_pll_info *); 25 25 extern void (*mach_reset)( void ); 26 26 extern void (*mach_halt)( void ); 27 - extern void (*mach_power_off)( void ); 28 27 extern unsigned long (*mach_hd_init) (unsigned long, unsigned long); 29 28 extern void (*mach_hd_setup)(char *, int *); 30 29 extern void (*mach_heartbeat) (int);
+2 -3
arch/m68k/kernel/process.c
··· 67 67 68 68 void machine_power_off(void) 69 69 { 70 - if (mach_power_off) 71 - mach_power_off(); 70 + do_kernel_power_off(); 72 71 for (;;); 73 72 } 74 73 75 - void (*pm_power_off)(void) = machine_power_off; 74 + void (*pm_power_off)(void); 76 75 EXPORT_SYMBOL(pm_power_off); 77 76 78 77 void show_regs(struct pt_regs * regs)
-1
arch/m68k/kernel/setup_mm.c
··· 98 98 EXPORT_SYMBOL(mach_set_rtc_pll); 99 99 void (*mach_reset)( void ); 100 100 void (*mach_halt)( void ); 101 - void (*mach_power_off)( void ); 102 101 #ifdef CONFIG_HEARTBEAT 103 102 void (*mach_heartbeat) (int); 104 103 EXPORT_SYMBOL(mach_heartbeat);
-1
arch/m68k/kernel/setup_no.c
··· 55 55 /* machine dependent reboot functions */ 56 56 void (*mach_reset)(void); 57 57 void (*mach_halt)(void); 58 - void (*mach_power_off)(void); 59 58 60 59 #ifdef CONFIG_M68000 61 60 #if defined(CONFIG_M68328)
+3 -1
arch/m68k/mac/config.c
··· 12 12 13 13 #include <linux/errno.h> 14 14 #include <linux/module.h> 15 + #include <linux/reboot.h> 15 16 #include <linux/types.h> 16 17 #include <linux/mm.h> 17 18 #include <linux/tty.h> ··· 141 140 mach_hwclk = mac_hwclk; 142 141 mach_reset = mac_reset; 143 142 mach_halt = mac_poweroff; 144 - mach_power_off = mac_poweroff; 145 143 #if IS_ENABLED(CONFIG_INPUT_M68K_BEEP) 146 144 mach_beep = mac_mksound; 147 145 #endif ··· 160 160 161 161 if (macintosh_config->ident == MAC_MODEL_IICI) 162 162 mach_l2_flush = via_l2_flush; 163 + 164 + register_platform_power_off(mac_poweroff); 163 165 } 164 166 165 167