diff mbox

[v5,3/6] kernel/reboot.c: export pm_power_off_prepare

Message ID 20170619050245.2632-4-o.rempel@pengutronix.de (mailing list archive)
State Superseded
Headers show

Commit Message

Oleksij Rempel June 19, 2017, 5:02 a.m. UTC
Export pm_power_off_prepare. It is needed to implement power off on
Freescale/NXP iMX6 based boards with external power management
integrated circuit (PMIC).

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 kernel/reboot.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Leonard Crestez June 19, 2017, 11:35 a.m. UTC | #1
On Mon, 2017-06-19 at 07:02 +0200, Oleksij Rempel wrote:
> Export pm_power_off_prepare. It is needed to implement power off on
> Freescale/NXP iMX6 based boards with external power management
> integrated circuit (PMIC).
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
>  kernel/reboot.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/kernel/reboot.c b/kernel/reboot.c
> index bd30a973fe94..a6903bf772c7 100644
> --- a/kernel/reboot.c
> +++ b/kernel/reboot.c
> @@ -49,6 +49,7 @@ int reboot_force;
>   */
>  
>  void (*pm_power_off_prepare)(void);
> +EXPORT_SYMBOL(pm_power_off_prepare);
>  
Could you register a reboot notifier in the pfuze driver instead? Right
now the only user of pm_power_off_prepare is ACPI so this alternative
seems less intrusive.

--
Regards,
Leonard
--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Oleksij Rempel June 20, 2017, 5:01 a.m. UTC | #2
On 19.06.2017 13:35, Leonard Crestez wrote:
> On Mon, 2017-06-19 at 07:02 +0200, Oleksij Rempel wrote:
>> Export pm_power_off_prepare. It is needed to implement power off on
>> Freescale/NXP iMX6 based boards with external power management
>> integrated circuit (PMIC).
>>
>> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
>> ---
>>  kernel/reboot.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/kernel/reboot.c b/kernel/reboot.c
>> index bd30a973fe94..a6903bf772c7 100644
>> --- a/kernel/reboot.c
>> +++ b/kernel/reboot.c
>> @@ -49,6 +49,7 @@ int reboot_force;
>>   */
>>
>>  void (*pm_power_off_prepare)(void);
>> +EXPORT_SYMBOL(pm_power_off_prepare);
>>
> Could you register a reboot notifier in the pfuze driver instead? Right
> now the only user of pm_power_off_prepare is ACPI so this alternative
> seems less intrusive.

hm... in this case i will need to make sure that reboot handler is not 
executed on reboot. This will make code looks strange. Which is opposite 
of your comment in other email about strange standby code for power off :)
Should i really do this?
--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Leonard Crestez June 20, 2017, 2:37 p.m. UTC | #3
On Tue, 2017-06-20 at 07:01 +0200, Oleksij Rempel wrote:
> 
> On 19.06.2017 13:35, Leonard Crestez wrote:
> > 
> > On Mon, 2017-06-19 at 07:02 +0200, Oleksij Rempel wrote:
> > > 
> > > Export pm_power_off_prepare. It is needed to implement power off on
> > > Freescale/NXP iMX6 based boards with external power management
> > > integrated circuit (PMIC).
> > > 
> > > Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> > > ---
> > >  kernel/reboot.c | 1 +
> > >  1 file changed, 1 insertion(+)
> > > 
> > > diff --git a/kernel/reboot.c b/kernel/reboot.c
> > > index bd30a973fe94..a6903bf772c7 100644
> > > --- a/kernel/reboot.c
> > > +++ b/kernel/reboot.c
> > > @@ -49,6 +49,7 @@ int reboot_force;
> > >   */
> > > 
> > >  void (*pm_power_off_prepare)(void);
> > > +EXPORT_SYMBOL(pm_power_off_prepare);
> > > 
> > Could you register a reboot notifier in the pfuze driver instead? Right
> > now the only user of pm_power_off_prepare is ACPI so this alternative
> > seems less intrusive.
> hm... in this case i will need to make sure that reboot handler is not 
> executed on reboot. This will make code looks strange. Which is opposite 
> of your comment in other email about strange standby code for power off :)
> Should i really do this?

A reboot handler receives a parameter to differentiate between reboot
and shutdown so it would be easy. Isn't it preferable to use an
existing mechanism instead of exporting a new symbol?

But maybe somebody else will Ack this, I don't particularly insist on
changing this.

--
Regards,
Leonard
--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Oleksij Rempel June 20, 2017, 3:29 p.m. UTC | #4
On Tue, Jun 20, 2017 at 05:37:06PM +0300, Leonard Crestez wrote:
> On Tue, 2017-06-20 at 07:01 +0200, Oleksij Rempel wrote:
> > 
> > On 19.06.2017 13:35, Leonard Crestez wrote:
> > > 
> > > On Mon, 2017-06-19 at 07:02 +0200, Oleksij Rempel wrote:
> > > > 
> > > > Export pm_power_off_prepare. It is needed to implement power off on
> > > > Freescale/NXP iMX6 based boards with external power management
> > > > integrated circuit (PMIC).
> > > > 
> > > > Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> > > > ---
> > > >  kernel/reboot.c | 1 +
> > > >  1 file changed, 1 insertion(+)
> > > > 
> > > > diff --git a/kernel/reboot.c b/kernel/reboot.c
> > > > index bd30a973fe94..a6903bf772c7 100644
> > > > --- a/kernel/reboot.c
> > > > +++ b/kernel/reboot.c
> > > > @@ -49,6 +49,7 @@ int reboot_force;
> > > >   */
> > > > 
> > > >  void (*pm_power_off_prepare)(void);
> > > > +EXPORT_SYMBOL(pm_power_off_prepare);
> > > > 
> > > Could you register a reboot notifier in the pfuze driver instead? Right
> > > now the only user of pm_power_off_prepare is ACPI so this alternative
> > > seems less intrusive.
> > hm... in this case i will need to make sure that reboot handler is not 
> > executed on reboot. This will make code looks strange. Which is opposite 
> > of your comment in other email about strange standby code for power off :)
> > Should i really do this?
> 
> A reboot handler receives a parameter to differentiate between reboot
> and shutdown so it would be easy. Isn't it preferable to use an
> existing mechanism instead of exporting a new symbol?
> 
> But maybe somebody else will Ack this, I don't particularly insist on
> changing this.

I just need to make sure, nothing else will do some thing unexpected
with PMIC. Don't forget we use same PMIC_STBY_REQ signal for stanby,
suspend to RAM and for power off. Entering wrong state in wrong moment
will be fatal. This is why I use last possible step before pm_power_off.
diff mbox

Patch

diff --git a/kernel/reboot.c b/kernel/reboot.c
index bd30a973fe94..a6903bf772c7 100644
--- a/kernel/reboot.c
+++ b/kernel/reboot.c
@@ -49,6 +49,7 @@  int reboot_force;
  */
 
 void (*pm_power_off_prepare)(void);
+EXPORT_SYMBOL(pm_power_off_prepare);
 
 /**
  *	emergency_restart - reboot the system