Skip to contentSkip to conversation

Support reboot power-off driver as module

PATCH In review Elliot Berman 4 participants 8 messages Nov 8, 2019 – May 25, 2021 1 message not in the archive System reset/shutdown drivers

lore
Share & tools
lore
#0 lore raw

v2 cover Support reboot power-off driver as module

This series supports reboot power-off driver as a module by exporting reboot_mode symbol.

Changes since V1:
- EXPORT_SYMBOL -> EXPORT_SYMBOL_GPL

Elliot Berman (2):
reboot: Export reboot_mode
power: reset: Enable tristate on restart power-off driver

 drivers/power/reset/Kconfig | 2 +-
 kernel/reboot.c             | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#1 lore raw

PATCH v2 1/2 reboot: Export reboot_mode

Export reboot_mode to support kernel modules wishing to modify reboot_mode.

---
 kernel/reboot.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/reboot.c +2 -0
index c4d472b..b1fbc22 100644
@@ -32,7 +32,9 @@ EXPORT_SYMBOL(cad_pid);
 #define DEFAULT_REBOOT_MODE
 #endif
 enum reboot_mode reboot_mode DEFAULT_REBOOT_MODE;
+EXPORT_SYMBOL_GPL(reboot_mode);
 enum reboot_mode panic_reboot_mode = REBOOT_UNDEFINED;
+EXPORT_SYMBOL_GPL(panic_reboot_mode);
 
 /*
  * This variable is used privately to keep track of whether or not
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] reboot: Export reboot_mode

Quoted 2 lines · Elliot Berman

Export reboot_mode to support kernel modules wishing to modify reboot_mode.

Quoted 23 lines
---
 kernel/reboot.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/reboot.c +2 -0
index c4d472b..b1fbc22 100644
@@ -32,7 +32,9 @@ EXPORT_SYMBOL(cad_pid);
 #define DEFAULT_REBOOT_MODE
 #endif
 enum reboot_mode reboot_mode DEFAULT_REBOOT_MODE;
+EXPORT_SYMBOL_GPL(reboot_mode);
 enum reboot_mode panic_reboot_mode = REBOOT_UNDEFINED;
+EXPORT_SYMBOL_GPL(panic_reboot_mode);
 
 /*
  * This variable is used privately to keep track of whether or not
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

A message that is not in the archive (sent off-list or not yet received): CAF2Aj3jYtL_42h_4W5zA8uz9e-QVquja70nARSRD4vbECVjxKw@mail.gmail.com

#5 lore raw

Re: [PATCH v2 1/2] reboot: Export reboot_mode

Quoted 10 lines · Lee Jones
Quoted 7 lines · Elliot Berman

Export reboot_mode to support kernel modules wishing to modify reboot_mode.

---
 kernel/reboot.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 5 lines

Reviewed by Bjorn and GregKH, but never merged.

I guess all the parties are still solving this downstream.

Andrew, is this still something you'd consider?

If there is no in-kernel user, it does not need to be exported.

thanks,

greg k-h

#6 lore raw

Re: [PATCH v2 1/2] reboot: Export reboot_mode

In reply to a message not in the archive
Quoted 10 lines · Lee Jones
Quoted 7 lines · Elliot Berman

Export reboot_mode to support kernel modules wishing to modify reboot_mode.

---
 kernel/reboot.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 6 lines

Reviewed by Bjorn and GregKH, but never merged.

I guess all the parties are still solving this downstream.

Andrew, is this still something you'd consider?

Seems more reasonable that it would go together with patch 2, which Sebastian pointed out doesn't build.

Regards,
Bjorn

Quoted 25 lines
kernel/reboot.c +0 -0
Quoted 18 lines

index c4d472b..b1fbc22 100644

kernel/reboot.c +2 -1
@@ -32,7 +32,9 @@ EXPORT_SYMBOL(cad_pid);
 #define DEFAULT_REBOOT_MODE
 #endif
 enum reboot_mode reboot_mode DEFAULT_REBOOT_MODE;
+EXPORT_SYMBOL_GPL(reboot_mode);
 enum reboot_mode panic_reboot_mode = REBOOT_UNDEFINED;
+EXPORT_SYMBOL_GPL(panic_reboot_mode);
 
 /*
  * This variable is used privately to keep track of whether or not
--

The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project

Signature · 4 lines
Lee Jones [?????????]
Linaro Services Senior Technical Lead
Linaro.org ??? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#7 lore raw

PATCH v2 2/2 power: reset: Enable tristate on restart power-off driver

In reply to Elliot Berman

Since reboot_mode is an exported symbol, restart power-off driver can be compiled as module.

---
 drivers/power/reset/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/reset/Kconfig +1 -1
index a564237..8db1d9d 100644
@@ -150,7 +150,7 @@ config POWER_RESET_QNAP
 	  Say Y if you have a QNAP NAS.
 
 config POWER_RESET_RESTART
-	bool "Restart power-off driver"
+	tristate "Restart power-off driver"
 	help
 	  Some boards don't actually have the ability to power off.
 	  Instead they restart, and u-boot holds the SoC until the
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#8 lore raw

Re: [PATCH v2 2/2] power: reset: Enable tristate on restart power-off driver

Hi,

Quoted 5 lines · Elliot Berman

Since reboot_mode is an exported symbol, restart power-off driver can be compiled as module.

---

I tried applying this for 5.6, but it fails to build with allmodconfig on arm:

ERROR: "machine_restart" [drivers/power/reset/restart-poweroff.ko] undefined!

-- Sebastian