Skip to content

Commit 9f9c1f6

Browse files
committed
Merge branch 'pm-sysoff'
Merge system power off handling rework from Dmitry Osipenko for 5.19-rc1. This introduces a mechanism allowing power sequences to be used for powering off the system and makes related changes in platform-specific code for multiple platforms. * pm-sysoff: (29 commits) kernel/reboot: Change registration order of legacy power-off handler m68k: virt: Switch to new sys-off handler API kernel/reboot: Add devm_register_restart_handler() kernel/reboot: Add devm_register_power_off_handler() soc/tegra: pmc: Use sys-off handler API to power off Nexus 7 properly reboot: Remove pm_power_off_prepare() regulator: pfuze100: Use devm_register_sys_off_handler() ACPI: power: Switch to sys-off handler API memory: emif: Use kernel_can_power_off() mips: Use do_kernel_power_off() ia64: Use do_kernel_power_off() x86: Use do_kernel_power_off() sh: Use do_kernel_power_off() m68k: Switch to new sys-off handler API powerpc: Use do_kernel_power_off() xen/x86: Use do_kernel_power_off() parisc: Use do_kernel_power_off() arm64: Use do_kernel_power_off() riscv: Use do_kernel_power_off() csky: Use do_kernel_power_off() ...
2 parents 1cdc5ba + da007f1 commit 9f9c1f6

File tree

28 files changed

+643
-125
lines changed

28 files changed

+643
-125
lines changed

arch/arm/kernel/reboot.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,7 @@ void machine_power_off(void)
116116
{
117117
local_irq_disable();
118118
smp_send_stop();
119-
120-
if (pm_power_off)
121-
pm_power_off();
119+
do_kernel_power_off();
122120
}
123121

124122
/*

arch/arm64/kernel/process.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ void machine_power_off(void)
111111
{
112112
local_irq_disable();
113113
smp_send_stop();
114-
if (pm_power_off)
115-
pm_power_off();
114+
do_kernel_power_off();
116115
}
117116

118117
/*

arch/csky/kernel/power.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,14 @@ EXPORT_SYMBOL(pm_power_off);
99
void machine_power_off(void)
1010
{
1111
local_irq_disable();
12-
if (pm_power_off)
13-
pm_power_off();
12+
do_kernel_power_off();
1413
asm volatile ("bkpt");
1514
}
1615

1716
void machine_halt(void)
1817
{
1918
local_irq_disable();
20-
if (pm_power_off)
21-
pm_power_off();
19+
do_kernel_power_off();
2220
asm volatile ("bkpt");
2321
}
2422

arch/ia64/kernel/process.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/module.h>
2020
#include <linux/notifier.h>
2121
#include <linux/personality.h>
22+
#include <linux/reboot.h>
2223
#include <linux/sched.h>
2324
#include <linux/sched/debug.h>
2425
#include <linux/sched/hotplug.h>
@@ -599,8 +600,7 @@ machine_halt (void)
599600
void
600601
machine_power_off (void)
601602
{
602-
if (pm_power_off)
603-
pm_power_off();
603+
do_kernel_power_off();
604604
machine_halt();
605605
}
606606

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)