Skip to content

Commit f0f7e52

Browse files
digetxrafaeljw
authored andcommitted
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>
1 parent c33fd0b commit f0f7e52

File tree

6 files changed

+7
-8
lines changed

6 files changed

+7
-8
lines changed

arch/m68k/emu/natfeat.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/string.h>
1616
#include <linux/kernel.h>
1717
#include <linux/module.h>
18+
#include <linux/reboot.h>
1819
#include <linux/io.h>
1920
#include <asm/machdep.h>
2021
#include <asm/natfeat.h>
@@ -90,5 +91,5 @@ void __init nf_init(void)
9091
pr_info("NatFeats found (%s, %lu.%lu)\n", buf, version >> 16,
9192
version & 0xffff);
9293

93-
mach_power_off = nf_poweroff;
94+
register_platform_power_off(nf_poweroff);
9495
}

arch/m68k/include/asm/machdep.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ extern int (*mach_get_rtc_pll)(struct rtc_pll_info *);
2424
extern int (*mach_set_rtc_pll)(struct rtc_pll_info *);
2525
extern void (*mach_reset)( void );
2626
extern void (*mach_halt)( void );
27-
extern void (*mach_power_off)( void );
2827
extern unsigned long (*mach_hd_init) (unsigned long, unsigned long);
2928
extern void (*mach_hd_setup)(char *, int *);
3029
extern void (*mach_heartbeat) (int);

arch/m68k/kernel/process.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,11 @@ void machine_halt(void)
6767

6868
void machine_power_off(void)
6969
{
70-
if (mach_power_off)
71-
mach_power_off();
70+
do_kernel_power_off();
7271
for (;;);
7372
}
7473

75-
void (*pm_power_off)(void) = machine_power_off;
74+
void (*pm_power_off)(void);
7675
EXPORT_SYMBOL(pm_power_off);
7776

7877
void show_regs(struct pt_regs * regs)

arch/m68k/kernel/setup_mm.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ EXPORT_SYMBOL(mach_get_rtc_pll);
9898
EXPORT_SYMBOL(mach_set_rtc_pll);
9999
void (*mach_reset)( void );
100100
void (*mach_halt)( void );
101-
void (*mach_power_off)( void );
102101
#ifdef CONFIG_HEARTBEAT
103102
void (*mach_heartbeat) (int);
104103
EXPORT_SYMBOL(mach_heartbeat);

arch/m68k/kernel/setup_no.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ int (*mach_hwclk) (int, struct rtc_time*);
5555
/* machine dependent reboot functions */
5656
void (*mach_reset)(void);
5757
void (*mach_halt)(void);
58-
void (*mach_power_off)(void);
5958

6059
#ifdef CONFIG_M68000
6160
#if defined(CONFIG_M68328)

arch/m68k/mac/config.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include <linux/errno.h>
1414
#include <linux/module.h>
15+
#include <linux/reboot.h>
1516
#include <linux/types.h>
1617
#include <linux/mm.h>
1718
#include <linux/tty.h>
@@ -140,7 +141,6 @@ void __init config_mac(void)
140141
mach_hwclk = mac_hwclk;
141142
mach_reset = mac_reset;
142143
mach_halt = mac_poweroff;
143-
mach_power_off = mac_poweroff;
144144
#if IS_ENABLED(CONFIG_INPUT_M68K_BEEP)
145145
mach_beep = mac_mksound;
146146
#endif
@@ -160,6 +160,8 @@ void __init config_mac(void)
160160

161161
if (macintosh_config->ident == MAC_MODEL_IICI)
162162
mach_l2_flush = via_l2_flush;
163+
164+
register_platform_power_off(mac_poweroff);
163165
}
164166

165167

0 commit comments

Comments
 (0)