[PATCH v2 00/45] Introduce power-off+restart call chain API

2021-10-27 Thread Dmitry Osipenko
have unique priority. Suggested by Guenter Roeck. - v2 API has power-off chaining disabled by default and require drivers to explicitly opt-in to the chaining. This preserves old behaviour for existing drivers once they are converted to the new API. Dmitry Osipenko (45):

[PATCH v2 01/45] notifier: Remove extern annotation from function prototypes

2021-10-27 Thread Dmitry Osipenko
There is no need to annotate function prototypes with 'extern', it makes code less readable. Remove unnecessary annotations from . Signed-off-by: Dmitry Osipenko --- include/linux/notifier.h | 30 +++--- 1 file changed, 15 insertions(+), 15 deletions(-) di

[PATCH v2 02/45] notifier: Add blocking_notifier_call_chain_empty()

2021-10-27 Thread Dmitry Osipenko
Add blocking_notifier_call_chain_empty() that returns true if call chain is empty. Signed-off-by: Dmitry Osipenko --- include/linux/notifier.h | 2 ++ kernel/notifier.c| 14 ++ 2 files changed, 16 insertions(+) diff --git a/include/linux/notifier.h b/include/linux

[PATCH v2 03/45] notifier: Add atomic/blocking_notifier_has_unique_priority()

2021-10-27 Thread Dmitry Osipenko
Add atomic/blocking_notifier_has_unique_priority() helpers which return true if given handler has unique priority. Signed-off-by: Dmitry Osipenko --- include/linux/notifier.h | 5 +++ kernel/notifier.c| 74 2 files changed, 79 insertions

[PATCH v2 04/45] reboot: Correct typo in a comment

2021-10-27 Thread Dmitry Osipenko
Correct s/implemenations/implementations/ in . Signed-off-by: Dmitry Osipenko --- include/linux/reboot.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/reboot.h b/include/linux/reboot.h index af907a3d68d1..7c288013a3ca 100644 --- a/include/linux/reboot.h +++ b

[PATCH v2 05/45] reboot: Warn if restart handler has duplicated priority

2021-10-27 Thread Dmitry Osipenko
Add sanity check which ensures that there are no two restart handlers registered with the same priority. Normally it's a direct sign of a problem if two handlers use the same priority. Signed-off-by: Dmitry Osipenko --- kernel/reboot.c | 15 ++- 1 file changed, 14 insertions(

[PATCH v2 06/45] reboot: Warn if unregister_restart_handler() fails

2021-10-27 Thread Dmitry Osipenko
Emit warning if unregister_restart_handler() fails since it never should fail. This will ease further API development by catching mistakes early. Signed-off-by: Dmitry Osipenko --- kernel/reboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/reboot.c b/kernel

[PATCH v2 07/45] reboot: Remove extern annotation from function prototypes

2021-10-27 Thread Dmitry Osipenko
There is no need to annotate function prototypes with 'extern', it makes code less readable. Remove unnecessary annotations from . Signed-off-by: Dmitry Osipenko --- include/linux/reboot.h | 38 +++--- 1 file changed, 19 insertions(+), 19 deletions(-)

[PATCH v2 08/45] kernel: Add combined power-off+restart handler call chain API

2021-10-27 Thread Dmitry Osipenko
ng drivers want, and thus, they could be easily converted to the new API. Users of the new API should explicitly enable power-off chaining by setting corresponding flag of the power_handler structure. Signed-off-by: Dmitry Osipenko --- include/linux/reboot.h | 176 +++- kernel/power/h

[PATCH v2 09/45] xen/x86: Use do_kernel_power_off()

2021-10-27 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Signed-off-by: Dmitry Osipenko --- arch/x86/xen

[PATCH v2 10/45] ARM: Use do_kernel_power_off()

2021-10-27 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Signed-off-by: Dmitry Osipenko --- arch/arm/kernel

[PATCH v2 11/45] arm64: Use do_kernel_power_off()

2021-10-27 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Signed-off-by: Dmitry Osipenko --- arch/arm64

[PATCH v2 12/45] csky: Use do_kernel_power_off()

2021-10-27 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Signed-off-by: Dmitry Osipenko --- arch/csky

[PATCH v2 13/45] ia64: Use do_kernel_power_off()

2021-10-27 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Signed-off-by: Dmitry Osipenko --- arch/ia64

[PATCH v2 14/45] mips: Use do_kernel_power_off()

2021-10-27 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Signed-off-by: Dmitry Osipenko --- arch/mips

[PATCH v2 15/45] nds32: Use do_kernel_power_off()

2021-10-27 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Signed-off-by: Dmitry Osipenko --- arch/nds32

[PATCH v2 16/45] parisc: Use do_kernel_power_off()

2021-10-27 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Signed-off-by: Dmitry Osipenko --- arch/parisc

[PATCH v2 17/45] powerpc: Use do_kernel_power_off()

2021-10-27 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Signed-off-by: Dmitry Osipenko --- arch/powerpc

[PATCH v2 18/45] riscv: Use do_kernel_power_off()

2021-10-27 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Signed-off-by: Dmitry Osipenko --- arch/riscv

[PATCH v2 19/45] sh: Use do_kernel_power_off()

2021-10-27 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Signed-off-by: Dmitry Osipenko --- arch/sh/kernel

[PATCH v2 20/45] x86: Use do_kernel_power_off()

2021-10-27 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Signed-off-by: Dmitry Osipenko --- arch/x86/kernel

[PATCH v2 21/45] m68k: Switch to new power-handler API

2021-10-27 Thread Dmitry Osipenko
e can't convert platforms to the new API separately. There are only two platforms changed here, so it's not a big deal. Signed-off-by: Dmitry Osipenko --- arch/m68k/emu/natfeat.c | 3 ++- arch/m68k/include/asm/machdep.h | 1 - arch/m68k/kernel/process.c | 5 ++--- ar

[PATCH v2 22/45] memory: emif: Use kernel_can_power_off()

2021-10-27 Thread Dmitry Osipenko
Replace legacy pm_power_off with kernel_can_power_off() helper that is aware about chained power-off handlers. Signed-off-by: Dmitry Osipenko --- drivers/memory/emif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c index

[PATCH v2 23/45] ACPI: power: Switch to power-handler API

2021-10-27 Thread Dmitry Osipenko
Switch to power-handler API that replaces legacy pm_power_off callbacks. Signed-off-by: Dmitry Osipenko --- drivers/acpi/sleep.c | 25 +++-- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 3023224515ab

[PATCH v2 24/45] regulator: pfuze100: Use devm_register_power_handler()

2021-10-27 Thread Dmitry Osipenko
Use devm_register_power_handler() that replaces global pm_power_off_prepare variable and allows to register multiple power-off handlers. Signed-off-by: Dmitry Osipenko --- drivers/regulator/pfuze100-regulator.c | 39 ++ 1 file changed, 15 insertions(+), 24 deletions

[PATCH v2 25/45] reboot: Remove pm_power_off_prepare()

2021-10-27 Thread Dmitry Osipenko
All pm_power_off_prepare() users were converted to power-handler API. Remove the obsolete callback. Signed-off-by: Dmitry Osipenko --- include/linux/pm.h | 1 - kernel/reboot.c| 11 --- 2 files changed, 12 deletions(-) diff --git a/include/linux/pm.h b/include/linux/pm.h index

[PATCH v2 26/45] soc/tegra: pmc: Utilize power-handler API to power off Nexus 7 properly

2021-10-27 Thread Dmitry Osipenko
+restart call chains functionality, replacing the restart-only call chain API. Signed-off-by: Dmitry Osipenko --- drivers/soc/tegra/pmc.c | 54 +++-- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c

[PATCH v2 27/45] mfd: ntxec: Use devm_register_power_handler()

2021-10-27 Thread Dmitry Osipenko
Use devm_register_power_handler() that replaces global pm_power_off variable and allows to register multiple power-off handlers. It also provides restart-handler support, i.e. all in one API. Signed-off-by: Dmitry Osipenko --- drivers/mfd/ntxec.c | 50

[PATCH v2 28/45] mfd: rn5t618: Use devm_register_power_handler()

2021-10-27 Thread Dmitry Osipenko
Use devm_register_power_handler() that replaces global pm_power_off variable and allows to register multiple power-off handlers. It also provides restart-handler support, i.e. all in one API. Signed-off-by: Dmitry Osipenko --- drivers/mfd/rn5t618.c | 56

[PATCH v2 29/45] mfd: acer-a500: Use devm_register_power_handler()

2021-10-27 Thread Dmitry Osipenko
Use devm_register_power_handler() that replaces global pm_power_off variable and allows to register multiple power-off handlers. It also provides restart-handler support, i.e. all in one API. Signed-off-by: Dmitry Osipenko --- drivers/mfd/acer-ec-a500.c | 52

[PATCH v2 30/45] mfd: ene-kb3930: Use devm_register_power_handler()

2021-10-27 Thread Dmitry Osipenko
Use devm_register_power_handler() that replaces global pm_power_off variable and allows to register multiple power-off handlers. It also provides restart-handler support, i.e. all in one API. Signed-off-by: Dmitry Osipenko --- drivers/mfd/ene-kb3930.c | 45

[PATCH v2 31/45] mfd: axp20x: Use register_simple_power_off_handler()

2021-10-27 Thread Dmitry Osipenko
Use register_simple_power_off_handler() that replaces global pm_power_off variable and allows to register multiple power-off handlers. Signed-off-by: Dmitry Osipenko --- drivers/mfd/axp20x.c | 22 +++--- include/linux/mfd/axp20x.h | 1 + 2 files changed, 12 insertions

[PATCH v2 32/45] mfd: retu: Use devm_register_simple_power_off_handler()

2021-10-27 Thread Dmitry Osipenko
Use devm_register_simple_power_off_handler() that replaces global pm_power_off variable and allows to register multiple power-off handlers. Signed-off-by: Dmitry Osipenko --- drivers/mfd/retu-mfd.c | 31 --- 1 file changed, 16 insertions(+), 15 deletions(-) diff

[PATCH v2 33/45] mfd: rk808: Use devm_register_simple_power_off_handler()

2021-10-27 Thread Dmitry Osipenko
Use devm_register_simple_power_off_handler() that replaces global pm_power_off variable and allows to register multiple power-off handlers. Signed-off-by: Dmitry Osipenko --- drivers/mfd/rk808.c | 23 +++ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a

[PATCH v2 34/45] mfd: palmas: Use devm_register_simple_power_off_handler()

2021-10-27 Thread Dmitry Osipenko
Use devm_register_simple_power_off_handler() that replaces global pm_power_off variable and allows to register multiple power-off handlers. Signed-off-by: Dmitry Osipenko --- drivers/mfd/palmas.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a

[PATCH v2 35/45] mfd: max8907: Use devm_register_simple_power_off_handler()

2021-10-27 Thread Dmitry Osipenko
Use devm_register_simple_power_off_handler() that replaces global pm_power_off variable and allows to register multiple power-off handlers. Signed-off-by: Dmitry Osipenko --- drivers/mfd/max8907.c | 22 +++--- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a

[PATCH v2 36/45] mfd: tps6586x: Use devm_register_simple_power_off_handler()

2021-10-27 Thread Dmitry Osipenko
Use devm_register_simple_power_off_handler() that replaces global pm_power_off variable and allows to register multiple power-off handlers. Signed-off-by: Dmitry Osipenko --- drivers/mfd/tps6586x.c | 21 ++--- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a

[PATCH v2 37/45] mfd: tps65910: Use devm_register_simple_power_off_handler()

2021-10-27 Thread Dmitry Osipenko
Use devm_register_simple_power_off_handler() that replaces global pm_power_off variable and allows to register multiple power-off handlers. Signed-off-by: Dmitry Osipenko --- drivers/mfd/tps65910.c | 17 - 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers

[PATCH v2 38/45] mfd: max77620: Use devm_register_simple_power_off_handler()

2021-10-27 Thread Dmitry Osipenko
have a higher priority than of PMIC that uses default priority. Signed-off-by: Dmitry Osipenko --- drivers/mfd/max77620.c | 21 - 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/mfd/max77620.c b/drivers/mfd/max77620.c index fec2096474ad..29487ccc191a

[PATCH v2 39/45] mfd: dm355evm_msp: Use devm_register_trivial_power_off_handler()

2021-10-27 Thread Dmitry Osipenko
Use devm_register_trivial_power_off_handler() that replaces global pm_power_off variable and allows to register multiple power-off handlers. Signed-off-by: Dmitry Osipenko --- drivers/mfd/dm355evm_msp.c | 20 +--- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a

[PATCH v2 40/45] mfd: twl4030: Use devm_register_trivial_power_off_handler()

2021-10-27 Thread Dmitry Osipenko
Use devm_register_trivial_power_off_handler() that replaces global pm_power_off variable and allows to register multiple power-off handlers. Signed-off-by: Dmitry Osipenko --- drivers/mfd/twl4030-power.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/mfd

Re: [PATCH v2 03/45] notifier: Add atomic/blocking_notifier_has_unique_priority()

2021-10-28 Thread Dmitry Osipenko
28.10.2021 14:00, Andy Shevchenko пишет: > On Thu, Oct 28, 2021 at 12:16:33AM +0300, Dmitry Osipenko wrote: >> Add atomic/blocking_notifier_has_unique_priority() helpers which return >> true if given handler has unique priority. > > ... > >> +/** >> + *

Re: [PATCH v2 08/45] kernel: Add combined power-off+restart handler call chain API

2021-10-28 Thread Dmitry Osipenko
28.10.2021 12:53, Rafael J. Wysocki пишет: >> +/** >> + * struct power_handler - Machine power-off + restart handler >> + * >> + * Describes power-off and restart handlers which are invoked by kernel >> + * to power off or restart this machine. Supports prioritized chaining for >> + * both restart

Re: [PATCH v2 08/45] kernel: Add combined power-off+restart handler call chain API

2021-10-28 Thread Dmitry Osipenko
28.10.2021 12:59, Rafael J. Wysocki пишет: >> +#define RESTART_PRIO_RESERVED 0 >> +#define RESTART_PRIO_DEFAULT 128 >> +#define RESTART_PRIO_HIGH 192 >> >> enum reboot_mode { >> REBOOT_UNDEFINED = -1, >> @@ -49,6 +55,167 @@ int register_restart_handler(struc

Re: [PATCH v2 08/45] kernel: Add combined power-off+restart handler call chain API

2021-10-28 Thread Dmitry Osipenko
28.10.2021 12:59, Rafael J. Wysocki пишет: >> +/** >> + * struct power_handler - Machine power-off + restart handler >> + * >> + * Describes power-off and restart handlers which are invoked by kernel >> + * to power off or restart this machine. Supports prioritized chaining for >> + * both restart

Re: [PATCH v2 00/45] Introduce power-off+restart call chain API

2021-10-28 Thread Dmitry Osipenko
28.10.2021 00:16, Dmitry Osipenko пишет: > mfd: ab8500: Use devm_register_trivial_power_off_handler() > reset: ath79: Use devm_register_simple_restart_handler() > reset: intel-gw: Use devm_register_simple_restart_handler() > reset: lpc18xx: Use devm_register_prioritized_res

Re: [PATCH v2 03/45] notifier: Add atomic/blocking_notifier_has_unique_priority()

2021-10-28 Thread Dmitry Osipenko
28.10.2021 14:00, Andy Shevchenko пишет: >> +while ((*nl) != NULL && (*nl)->priority >= n->priority) { > ' != NULL' is not needed. > I'll change it in v3, thanks.

Re: [PATCH v2 03/45] notifier: Add atomic/blocking_notifier_has_unique_priority()

2021-10-28 Thread Dmitry Osipenko
29.10.2021 00:32, Dmitry Osipenko пишет: >>> + /* >>> +* This code gets used during boot-up, when task switching is >>> +* not yet working and interrupts must remain disabled. At >> One space is enough. > This comment is replicated multiple times over

Re: [PATCH v2 27/45] mfd: ntxec: Use devm_register_power_handler()

2021-11-07 Thread Dmitry Osipenko
06.11.2021 23:54, Jonathan Neuschäfer пишет: > Hi, > > On Thu, Oct 28, 2021 at 12:16:57AM +0300, Dmitry Osipenko wrote: >> Use devm_register_power_handler() that replaces global pm_power_off >> variable and allows to register multiple power-off handlers. It also >&g

Re: [PATCH v2 27/45] mfd: ntxec: Use devm_register_power_handler()

2021-11-07 Thread Dmitry Osipenko
07.11.2021 20:08, Guenter Roeck пишет: > On 11/7/21 8:53 AM, Dmitry Osipenko wrote: >> 06.11.2021 23:54, Jonathan Neuschäfer пишет: >>> Hi, >>> >>> On Thu, Oct 28, 2021 at 12:16:57AM +0300, Dmitry Osipenko wrote: >>>> Use devm_register_p

Re: [PATCH v2 27/45] mfd: ntxec: Use devm_register_power_handler()

2021-11-07 Thread Dmitry Osipenko
07.11.2021 20:32, Guenter Roeck пишет: > On 11/7/21 9:16 AM, Dmitry Osipenko wrote: >> 07.11.2021 20:08, Guenter Roeck пишет: >>> On 11/7/21 8:53 AM, Dmitry Osipenko wrote: >>>> 06.11.2021 23:54, Jonathan Neuschäfer пишет: >>>>> Hi, >>>>

[PATCH v3 00/25] Introduce power-off+restart call chain API

2021-11-07 Thread Dmitry Osipenko
erves old behaviour for existing drivers once they are converted to the new API. Dmitry Osipenko (25): notifier: Remove extern annotation from function prototypes notifier: Add blocking_notifier_call_chain_is_empty() notifier: Add atomic/blocking_notifier_has_unique_priority()

[PATCH v3 01/25] notifier: Remove extern annotation from function prototypes

2021-11-07 Thread Dmitry Osipenko
There is no need to annotate function prototypes with 'extern', it makes code less readable. Remove unnecessary annotations from . Signed-off-by: Dmitry Osipenko --- include/linux/notifier.h | 30 +++--- 1 file changed, 15 insertions(+), 15 deletions(-) di

[PATCH v3 02/25] notifier: Add blocking_notifier_call_chain_is_empty()

2021-11-07 Thread Dmitry Osipenko
Add blocking_notifier_call_chain_is_empty() that returns true if call chain is empty. Signed-off-by: Dmitry Osipenko --- include/linux/notifier.h | 2 ++ kernel/notifier.c| 14 ++ 2 files changed, 16 insertions(+) diff --git a/include/linux/notifier.h b/include/linux

[PATCH v3 03/25] notifier: Add atomic/blocking_notifier_has_unique_priority()

2021-11-07 Thread Dmitry Osipenko
Add atomic/blocking_notifier_has_unique_priority() helpers which return true if given handler has unique priority. Signed-off-by: Dmitry Osipenko --- include/linux/notifier.h | 5 +++ kernel/notifier.c| 69 2 files changed, 74 insertions

[PATCH v3 04/25] reboot: Correct typo in a comment

2021-11-07 Thread Dmitry Osipenko
Correct s/implemenations/implementations/ in . Signed-off-by: Dmitry Osipenko --- include/linux/reboot.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/reboot.h b/include/linux/reboot.h index af907a3d68d1..7c288013a3ca 100644 --- a/include/linux/reboot.h +++ b

[PATCH v3 05/25] reboot: Warn if restart handler has duplicated priority

2021-11-07 Thread Dmitry Osipenko
Add sanity check which ensures that there are no two restart handlers registered with the same priority. Normally it's a direct sign of a problem if two handlers use the same priority. Signed-off-by: Dmitry Osipenko --- kernel/reboot.c | 15 ++- 1 file changed, 14 insertions(

[PATCH v3 06/25] reboot: Warn if unregister_restart_handler() fails

2021-11-07 Thread Dmitry Osipenko
Emit warning if unregister_restart_handler() fails since it never should fail. This will ease further API development by catching mistakes early. Signed-off-by: Dmitry Osipenko --- kernel/reboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/reboot.c b/kernel

[PATCH v3 07/25] reboot: Remove extern annotation from function prototypes

2021-11-07 Thread Dmitry Osipenko
There is no need to annotate function prototypes with 'extern', it makes code less readable. Remove unnecessary annotations from . Signed-off-by: Dmitry Osipenko --- include/linux/reboot.h | 38 +++--- 1 file changed, 19 insertions(+), 19 deletions(-)

[PATCH v3 08/25] kernel: Add combined power-off+restart handler call chain API

2021-11-07 Thread Dmitry Osipenko
l existing drivers want, and thus, they could be easily converted to the new API. Users of the new API should explicitly enable power-off chaining by setting corresponding flag of the power_handler structure. Signed-off-by: Dmitry Osipenko --- include/linux/reboot.h | 265 ++- ke

[PATCH v3 09/25] ARM: Use do_kernel_power_off()

2021-11-07 Thread Dmitry Osipenko
: Dmitry Osipenko --- arch/arm/kernel/reboot.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/arm/kernel/reboot.c b/arch/arm/kernel/reboot.c index 3044fcb8d073..2cb943422554 100644 --- a/arch/arm/kernel/reboot.c +++ b/arch/arm/kernel/reboot.c @@ -116,9 +116,7 @@ void

[PATCH v3 10/25] csky: Use do_kernel_power_off()

2021-11-07 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Acked-by: Guo Ren Signed-off-by: Dmitry Osipenko

[PATCH v3 11/25] riscv: Use do_kernel_power_off()

2021-11-07 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Acked-by: Palmer Dabbelt Signed-off-by: Dmitry

[PATCH v3 12/25] arm64: Use do_kernel_power_off()

2021-11-07 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Acked-by: Catalin Marinas Signed-off-by: Dmitry

[PATCH v3 13/25] parisc: Use do_kernel_power_off()

2021-11-07 Thread Dmitry Osipenko
: Dmitry Osipenko --- arch/parisc/kernel/process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c index ea3d83b6fb62..928201b1f58f 100644 --- a/arch/parisc/kernel/process.c +++ b/arch/parisc/kernel/process.c @@ -26,6

[PATCH v3 14/25] xen/x86: Use do_kernel_power_off()

2021-11-07 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Acked-by: Juergen Gross Signed-off-by: Dmitry

[PATCH v3 15/25] sh: Use do_kernel_power_off()

2021-11-07 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Signed-off-by: Dmitry Osipenko --- arch/sh/kernel

[PATCH v3 16/25] x86: Use do_kernel_power_off()

2021-11-07 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Signed-off-by: Dmitry Osipenko --- arch/x86/kernel

[PATCH v3 17/25] ia64: Use do_kernel_power_off()

2021-11-07 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Signed-off-by: Dmitry Osipenko --- arch/ia64

[PATCH v3 18/25] mips: Use do_kernel_power_off()

2021-11-07 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Signed-off-by: Dmitry Osipenko --- arch/mips

[PATCH v3 19/25] nds32: Use do_kernel_power_off()

2021-11-07 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Signed-off-by: Dmitry Osipenko --- arch/nds32

[PATCH v3 20/25] powerpc: Use do_kernel_power_off()

2021-11-07 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Signed-off-by: Dmitry Osipenko --- arch/powerpc

[PATCH v3 21/25] m68k: Switch to new sys-off handler API

2021-11-07 Thread Dmitry Osipenko
e can't convert platforms to the new API separately. There are only two platforms changed here, so it's not a big deal. Signed-off-by: Dmitry Osipenko --- arch/m68k/emu/natfeat.c | 3 ++- arch/m68k/include/asm/machdep.h | 1 - arch/m68k/kernel/process.c | 5 ++--- ar

[PATCH v3 22/25] memory: emif: Use kernel_can_power_off()

2021-11-07 Thread Dmitry Osipenko
Replace legacy pm_power_off with kernel_can_power_off() helper that is aware about chained power-off handlers. Signed-off-by: Dmitry Osipenko --- drivers/memory/emif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c index

[PATCH v3 23/25] ACPI: power: Switch to sys-off handler API

2021-11-07 Thread Dmitry Osipenko
Switch to sys-off API that replaces legacy pm_power_off callbacks. Signed-off-by: Dmitry Osipenko --- drivers/acpi/sleep.c | 25 +++-- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index eaa47753b758..2e613fddd614

[PATCH v3 24/25] regulator: pfuze100: Use devm_register_sys_off_handler()

2021-11-07 Thread Dmitry Osipenko
Use devm_register_sys_off_handler() that replaces global pm_power_off_prepare variable and allows to register multiple power-off handlers. Acked-by: Mark Brown Signed-off-by: Dmitry Osipenko --- drivers/regulator/pfuze100-regulator.c | 38 ++ 1 file changed, 14

[PATCH v3 25/25] reboot: Remove pm_power_off_prepare()

2021-11-07 Thread Dmitry Osipenko
All pm_power_off_prepare() users were converted to sys-off handler API. Remove the obsolete callback. Signed-off-by: Dmitry Osipenko --- include/linux/pm.h | 1 - kernel/reboot.c| 11 --- 2 files changed, 12 deletions(-) diff --git a/include/linux/pm.h b/include/linux/pm.h index

Re: [PATCH v3 00/25] Introduce power-off+restart call chain API

2021-11-07 Thread Dmitry Osipenko
08.11.2021 03:44, Dmitry Osipenko пишет: > Problem > --- > > SoC devices require power-off call chaining functionality from kernel. > We have a widely used restart chaining provided by restart notifier API, > but nothing for power-off. > > Solution >

Re: [PATCH v2 27/45] mfd: ntxec: Use devm_register_power_handler()

2021-11-08 Thread Dmitry Osipenko
08.11.2021 14:22, Jonathan Neuschäfer пишет: > On Sun, Nov 07, 2021 at 08:42:33PM +0300, Dmitry Osipenko wrote: > [...] >> EC drivers tend to use higher priority in general. Jonathan, could you >> please confirm that NTXEC driver is a more preferable restart method >> tha

Re: [PATCH v2 27/45] mfd: ntxec: Use devm_register_power_handler()

2021-11-10 Thread Dmitry Osipenko
10.11.2021 13:43, Jonathan Neuschäfer пишет: > On Mon, Nov 08, 2021 at 02:36:42PM +0300, Dmitry Osipenko wrote: >> 08.11.2021 14:22, Jonathan Neuschäfer пишет: >>> On Sun, Nov 07, 2021 at 08:42:33PM +0300, Dmitry Osipenko wrote: >>> [...] >>>> EC drivers

[PATCH v4 00/25] Introduce power-off+restart call chain API

2021-11-26 Thread Dmitry Osipenko
ere. - v2 API doesn't expose notifier to users and require handlers to have unique priority. Suggested by Guenter Roeck. - v2 API has power-off chaining disabled by default and require drivers to explicitly opt-in to the chaining. This preserves old behaviour for existing d

[PATCH v4 01/25] notifier: Remove extern annotation from function prototypes

2021-11-26 Thread Dmitry Osipenko
There is no need to annotate function prototypes with 'extern', it makes code less readable. Remove unnecessary annotations from . Signed-off-by: Dmitry Osipenko --- include/linux/notifier.h | 30 +++--- 1 file changed, 15 insertions(+), 15 deletions(-) di

[PATCH v4 02/25] notifier: Add blocking_notifier_call_chain_is_empty()

2021-11-26 Thread Dmitry Osipenko
Add blocking_notifier_call_chain_is_empty() that returns true if call chain is empty. Signed-off-by: Dmitry Osipenko --- include/linux/notifier.h | 2 ++ kernel/notifier.c| 14 ++ 2 files changed, 16 insertions(+) diff --git a/include/linux/notifier.h b/include/linux

[PATCH v4 03/25] notifier: Add atomic/blocking_notifier_has_unique_priority()

2021-11-26 Thread Dmitry Osipenko
Add atomic/blocking_notifier_has_unique_priority() helpers which return true if given handler has unique priority. Signed-off-by: Dmitry Osipenko --- include/linux/notifier.h | 5 +++ kernel/notifier.c| 69 2 files changed, 74 insertions

[PATCH v4 04/25] reboot: Correct typo in a comment

2021-11-26 Thread Dmitry Osipenko
Correct s/implemenations/implementations/ in . Signed-off-by: Dmitry Osipenko --- include/linux/reboot.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/reboot.h b/include/linux/reboot.h index af907a3d68d1..7c288013a3ca 100644 --- a/include/linux/reboot.h +++ b

[PATCH v4 05/25] reboot: Warn if restart handler has duplicated priority

2021-11-26 Thread Dmitry Osipenko
Add sanity check which ensures that there are no two restart handlers registered with the same priority. Normally it's a direct sign of a problem if two handlers use the same priority. Signed-off-by: Dmitry Osipenko --- kernel/reboot.c | 15 ++- 1 file changed, 14 insertions(

[PATCH v4 06/25] reboot: Warn if unregister_restart_handler() fails

2021-11-26 Thread Dmitry Osipenko
Emit warning if unregister_restart_handler() fails since it never should fail. This will ease further API development by catching mistakes early. Signed-off-by: Dmitry Osipenko --- kernel/reboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/reboot.c b/kernel

[PATCH v4 07/25] reboot: Remove extern annotation from function prototypes

2021-11-26 Thread Dmitry Osipenko
There is no need to annotate function prototypes with 'extern', it makes code less readable. Remove unnecessary annotations from . Signed-off-by: Dmitry Osipenko --- include/linux/reboot.h | 38 +++--- 1 file changed, 19 insertions(+), 19 deletions(-)

[PATCH v4 08/25] kernel: Add combined power-off+restart handler call chain API

2021-11-26 Thread Dmitry Osipenko
l existing drivers want, and thus, they could be easily converted to the new API. Users of the new API should explicitly enable power-off chaining by setting corresponding flag of the power_handler structure. Signed-off-by: Dmitry Osipenko --- include/linux/reboot.h | 265 ++- ke

[PATCH v4 09/25] ARM: Use do_kernel_power_off()

2021-11-26 Thread Dmitry Osipenko
: Dmitry Osipenko --- arch/arm/kernel/reboot.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/arm/kernel/reboot.c b/arch/arm/kernel/reboot.c index 3044fcb8d073..2cb943422554 100644 --- a/arch/arm/kernel/reboot.c +++ b/arch/arm/kernel/reboot.c @@ -116,9 +116,7 @@ void

[PATCH v4 10/25] csky: Use do_kernel_power_off()

2021-11-26 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Acked-by: Guo Ren Signed-off-by: Dmitry Osipenko

[PATCH v4 11/25] riscv: Use do_kernel_power_off()

2021-11-26 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Acked-by: Palmer Dabbelt Signed-off-by: Dmitry

[PATCH v4 12/25] arm64: Use do_kernel_power_off()

2021-11-26 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Acked-by: Catalin Marinas Signed-off-by: Dmitry

[PATCH v4 13/25] parisc: Use do_kernel_power_off()

2021-11-26 Thread Dmitry Osipenko
: Dmitry Osipenko --- arch/parisc/kernel/process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c index ea3d83b6fb62..928201b1f58f 100644 --- a/arch/parisc/kernel/process.c +++ b/arch/parisc/kernel/process.c @@ -26,6

[PATCH v4 14/25] xen/x86: Use do_kernel_power_off()

2021-11-26 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Acked-by: Juergen Gross Signed-off-by: Dmitry

[PATCH v4 15/25] powerpc: Use do_kernel_power_off()

2021-11-26 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Acked-by: Michael Ellerman Signed-off-by: Dmitry

[PATCH v4 16/25] m68k: Switch to new sys-off handler API

2021-11-26 Thread Dmitry Osipenko
e 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 Signed-off-by: Dmitry Osipenko --- arch/m68k/emu/natfeat.c | 3 ++- arch/m68k/include/asm/machdep.h | 1 - arch/m68k/kernel/proce

[PATCH v4 17/25] sh: Use do_kernel_power_off()

2021-11-26 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Signed-off-by: Dmitry Osipenko --- arch/sh/kernel

[PATCH v4 18/25] x86: Use do_kernel_power_off()

2021-11-26 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Signed-off-by: Dmitry Osipenko --- arch/x86/kernel

[PATCH v4 19/25] ia64: Use do_kernel_power_off()

2021-11-26 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off() that invokes chained power-off handlers. It also invokes legacy pm_power_off() for now, which will be removed once all drivers will be converted to the new power-off API. Signed-off-by: Dmitry Osipenko --- arch/ia64

  1   2   >