Skip to contentSkip to conversation

Support reboot power-off driver as module

PATCH Superseded Elliot Berman 3 participants 5 messages Nov 8, 2019 – Nov 11, 2019 System reset/shutdown drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Support reboot power-off driver as module

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

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 1/2 reboot: Export reboot_mode

Export reboot_mode to support DLKMs wishing to modify reboot_mode.

---
 kernel/reboot.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/reboot.c +2 -0
index c4d472b..6518370 100644
@@ -32,7 +32,9 @@ EXPORT_SYMBOL(cad_pid);
 #define DEFAULT_REBOOT_MODE
 #endif
 enum reboot_mode reboot_mode DEFAULT_REBOOT_MODE;
+EXPORT_SYMBOL(reboot_mode);
 enum reboot_mode panic_reboot_mode = REBOOT_UNDEFINED;
+EXPORT_SYMBOL(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
#2 lore raw

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

Quoted 1 line · Elliot Berman

Export reboot_mode to support DLKMs wishing to modify reboot_mode.

"DLKMs"? What's that?

A kernel module?

Quoted 11 lines
---
 kernel/reboot.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/reboot.c +0 -0
index c4d472b..6518370 100644

kernel/reboot.c EXPORT_SYMBOL(cad_pid); · line 37

Quoted 6 lines
kernel/reboot.c +2 -0
@@ -32,7 +32,9 @@ EXPORT_SYMBOL(cad_pid);
 #define DEFAULT_REBOOT_MODE
 #endif
 enum reboot_mode reboot_mode DEFAULT_REBOOT_MODE;
+EXPORT_SYMBOL(reboot_mode);
 enum reboot_mode panic_reboot_mode = REBOOT_UNDEFINED;
+EXPORT_SYMBOL(panic_reboot_mode);

EXPORT_SYMBOL_GPL() perhaps?

thanks,

greg k-h

#3 lore raw

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

Quoted 5 lines · Greg KH
Quoted 5 lines
kernel/reboot.c +0 -0
index c4d472b..6518370 100644
@@ -32,7 +32,9 @@ EXPORT_SYMBOL(cad_pid);
Quoted 8 lines

kernel/reboot.c EXPORT_SYMBOL(cad_pid); · line 37

Quoted 6 lines
kernel/reboot.c +2 -0
 #define DEFAULT_REBOOT_MODE
 #endif
 enum reboot_mode reboot_mode DEFAULT_REBOOT_MODE;
+EXPORT_SYMBOL(reboot_mode);
 enum reboot_mode panic_reboot_mode = REBOOT_UNDEFINED;
+EXPORT_SYMBOL(panic_reboot_mode);

EXPORT_SYMBOL_GPL() perhaps?

Absolutely. But then again drivers/power/reset/reboot-mode.c, which he wants to make modular in patch 2 is just a trivial abstraction that avoids drivers directly poking into these values. I really don't see a point to make that modular to start with.

#4 lore raw

PATCH 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