Skip to contentSkip to conversation

reboot: Remove unused unregister_platform_power_off

PATCH In review [email protected] 2 participants 3 messages Jun 8, 2025 – Jun 9, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 reboot: Remove unused unregister_platform_power_off

From: "Dr. David Alan Gilbert" <[email protected]>

unregister_platform_power_off() was added as part of 2022's commit fb61375ecfba ("kernel/reboot: Add register_platform_power_off()") but has remained unused.

Remove it.

Note it's a pair with register_platform_power_off() so seems symmetric; however, I think platforms are chosen and then stay that way for the boot - so don't get unregistered.

---
 include/linux/reboot.h |  1 -
 kernel/reboot.c        | 16 ----------------
 2 files changed, 17 deletions(-)
include/linux/reboot.h +0 -1
index aa08c3bbbf59..82c0a373c58c 100644
@@ -161,7 +161,6 @@ int devm_register_restart_handler(struct device *dev,
 				  void *cb_data);
 
 int register_platform_power_off(void (*power_off)(void));
-void unregister_platform_power_off(void (*power_off)(void));
 
 /*
  * Architecture independent implemenations of sys_reboot commands.
kernel/reboot.c +0 -16
index ec087827c85c..515716afc101 100644
@@ -626,22 +626,6 @@ int register_platform_power_off(void (*power_off)(void))
 }
 EXPORT_SYMBOL_GPL(register_platform_power_off);
 
-/**
- *	unregister_platform_power_off - Unregister platform-level power-off callback
- *	@power_off: Power-off callback
- *
- *	Unregisters previously registered platform power-off callback.
- */
-void unregister_platform_power_off(void (*power_off)(void))
-{
-	if (platform_power_off_handler &&
-	    platform_power_off_handler->cb_data == power_off) {
-		unregister_sys_off_handler(platform_power_off_handler);
-		platform_power_off_handler = NULL;
-	}
-}
-EXPORT_SYMBOL_GPL(unregister_platform_power_off);
-
 static int legacy_pm_power_off(struct sys_off_data *data)
 {
 	if (pm_power_off)
Signature · 1 line
2.49.0
#1 lore raw

Hi,

Quoted 13 lines · On 6/8/25 20:42, [email protected] wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

unregister_platform_power_off() was added as part of 2022's commit fb61375ecfba ("kernel/reboot: Add register_platform_power_off()") but has remained unused.

Remove it.

Note it's a pair with register_platform_power_off() so seems symmetric; however, I think platforms are chosen and then stay that way for the boot - so don't get unregistered.

Quoted 5 lines
---
 include/linux/reboot.h |  1 -
 kernel/reboot.c        | 16 ----------------
 2 files changed, 17 deletions(-)

The patches converting those platform drivers to use register[un]_platform_power_off() haven't been sent to ML. This is the reason this func is unused.

There were apm_32 [1], platform/iris [2], mcu_mpc8349emitx [3], olpc-xo1-pm [4] and sgy_cts1000 [5] drivers that I had patches prepared to convert them to new power-off API. They weren't sent out back then in 2022 because of a nontrivial dependencies between drivers. At least some of those deps has been resolved by now and potentially the API conversion may continue. Currently other things keep me busy and don't have immediate plans to continue the conversion work, maybe sometime later.

Leaving it up to Rafael to decide whether to keep this func unused or re-add later, once it actually will become needed.

[1]
https://gitlab.collabora.com/dmitry.osipenko/linux-kernel-rd/-/commit/e42f1264161085f01fed16986a23592519d9f49e
[2]
https://gitlab.collabora.com/dmitry.osipenko/linux-kernel-rd/-/commit/24cd048ad801aab6221f2b0bb4576dfc2fe25faa
[3]
https://gitlab.collabora.com/dmitry.osipenko/linux-kernel-rd/-/commit/486b69b43c47d85a0f292dca127f0b9063443a54
[4]
https://gitlab.collabora.com/dmitry.osipenko/linux-kernel-rd/-/commit/fe5344b3f8a8e1c52e1cd7108aa7e615123be4b2
[5]
https://gitlab.collabora.com/dmitry.osipenko/linux-kernel-rd/-/commit/0d761d6139c9dacbbda9f2e095577b084685603f

Signature · 2 lines
Best regards,
Dmitry
#2 lore raw
Quoted 22 lines · * Dmitry Osipenko ([email protected]) wrote:

Hi,

Quoted 13 lines · On 6/8/25 20:42, [email protected] wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

unregister_platform_power_off() was added as part of 2022's commit fb61375ecfba ("kernel/reboot: Add register_platform_power_off()") but has remained unused.

Remove it.

Note it's a pair with register_platform_power_off() so seems symmetric; however, I think platforms are chosen and then stay that way for the boot - so don't get unregistered.

Quoted 5 lines
---
 include/linux/reboot.h |  1 -
 kernel/reboot.c        | 16 ----------------
 2 files changed, 17 deletions(-)
Quoted 3 lines

The patches converting those platform drivers to use register[un]_platform_power_off() haven't been sent to ML. This is the reason this func is unused.

Ah

Quoted 7 lines

There were apm_32 [1], platform/iris [2], mcu_mpc8349emitx [3], olpc-xo1-pm [4] and sgy_cts1000 [5] drivers that I had patches prepared to convert them to new power-off API. They weren't sent out back then in 2022 because of a nontrivial dependencies between drivers. At least some of those deps has been resolved by now and potentially the API conversion may continue. Currently other things keep me busy and don't have immediate plans to continue the conversion work, maybe sometime later.

Yeh that's life!
Of course if you could upstream one to get it rolling that would be great, but I understand.
Most of those seem pretty old platforms, what makes those different?

Quoted 2 lines

Leaving it up to Rafael to decide whether to keep this func unused or re-add later, once it actually will become needed.

I've copied Rafael into the thread.

Dave

Quoted 14 lines

[1]
https://gitlab.collabora.com/dmitry.osipenko/linux-kernel-rd/-/commit/e42f1264161085f01fed16986a23592519d9f49e
[2]
https://gitlab.collabora.com/dmitry.osipenko/linux-kernel-rd/-/commit/24cd048ad801aab6221f2b0bb4576dfc2fe25faa
[3]
https://gitlab.collabora.com/dmitry.osipenko/linux-kernel-rd/-/commit/486b69b43c47d85a0f292dca127f0b9063443a54
[4]
https://gitlab.collabora.com/dmitry.osipenko/linux-kernel-rd/-/commit/fe5344b3f8a8e1c52e1cd7108aa7e615123be4b2
[5]
https://gitlab.collabora.com/dmitry.osipenko/linux-kernel-rd/-/commit/0d761d6139c9dacbbda9f2e095577b084685603f

Signature · 2 lines
Best regards,
Dmitry
Signature · 4 lines
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/