diff mbox series

[v4,01/15] ARM: export arm_pm_restart()

Message ID 20190108175818.705110-2-lkundrak@v3.sk (mailing list archive)
State Not Applicable, archived
Headers show
Series Add support for OLPC XO 1.75 Embedded Controller | expand

Commit Message

Lubomir Rintel Jan. 8, 2019, 5:58 p.m. UTC
The OLPC XO 1.75 laptop is rebooted with a command to the Embedded
Controller. The EC driver should be a module, since most people don't need
it to be compiled in.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
Changes since v3:
- Added the patch to the set

 arch/arm/kernel/reboot.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Russell King (Oracle) Jan. 8, 2019, 11:31 p.m. UTC | #1
On Tue, Jan 08, 2019 at 06:58:04PM +0100, Lubomir Rintel wrote:
> The OLPC XO 1.75 laptop is rebooted with a command to the Embedded
> Controller. The EC driver should be a module, since most people don't need
> it to be compiled in.

Why do you need this - is there a reason why you can't hook onto the
restart_handler_list using register_restart_handler()?  The registered
handlers are passed the command.

I would rather this is not exported to modules, it is generally unsafe
to hook stuff by directly poking function pointers from module code.
Lubomir Rintel Jan. 9, 2019, 7:24 a.m. UTC | #2
On Tue, 2019-01-08 at 23:31 +0000, Russell King - ARM Linux wrote:
> On Tue, Jan 08, 2019 at 06:58:04PM +0100, Lubomir Rintel wrote:
> > The OLPC XO 1.75 laptop is rebooted with a command to the Embedded
> > Controller. The EC driver should be a module, since most people don't need
> > it to be compiled in.
> 
> Why do you need this - is there a reason why you can't hook onto the
> restart_handler_list using register_restart_handler()?  The registered
> handlers are passed the command.

Actually, yes. The restart handlers are invoked in atomic context, but
the EC communication needs to block. (The 1.75 EC is actually a SPI
master: a command it initiated by poking a GPIO and waiting until EC
tells us it's ready to read a command.)

Sorry for not mentioning that earlier, I forgot that it is the case.

> I would rather this is not exported to modules, it is generally unsafe
> to hook stuff by directly poking function pointers from module code.

Lubo
diff mbox series

Patch

diff --git a/arch/arm/kernel/reboot.c b/arch/arm/kernel/reboot.c
index 3b2aa9a9fe26..71016cf19b86 100644
--- a/arch/arm/kernel/reboot.c
+++ b/arch/arm/kernel/reboot.c
@@ -22,6 +22,7 @@  typedef void (*phys_reset_t)(unsigned long, bool);
  * Function pointers to optional machine specific functions
  */
 void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
+EXPORT_SYMBOL_GPL(arm_pm_restart);
 void (*pm_power_off)(void);
 EXPORT_SYMBOL(pm_power_off);