Re: [PATCH v3 19/47] mfd: rk808: Register power-off handler with kernel power-off handler

2014-11-03 Thread Guenter Roeck
On Mon, Nov 03, 2014 at 10:42:27PM +, Lee Jones wrote:
> On Mon, 03 Nov 2014, Guenter Roeck wrote:
> 
> > On Mon, Nov 03, 2014 at 05:53:46PM +, Lee Jones wrote:
> > > On Mon, 27 Oct 2014, Guenter Roeck wrote:
> > > 
> > > > Register with kernel power-off handler instead of setting pm_power_off
> > > > directly. Register with low priority to reflect that the original code
> > > > only sets pm_power_off if it was not already set.
> > > > 
> > > > Cc: Chris Zhong 
> > > > Cc: Zhang Qing 
> > > > Signed-off-by: Guenter Roeck 
> > > > ---
> > > > v3:
> > > > - Replace poweroff in all newly introduced variables and in text
> > > >   with power_off or power-off as appropriate
> > > > - Replace POWEROFF_PRIORITY_xxx with POWER_OFF_PRIORITY_xxx
> > > > v2:
> > > > - New patch
> > > > 
> > > >  drivers/mfd/rk808.c   | 30 --
> > > >  include/linux/mfd/rk808.h |  2 ++
> > > >  2 files changed, 18 insertions(+), 14 deletions(-)
> > > 
> > > Code looks okay:
> > > 
> > > Acked-by: Lee Jones 
> > > 
> > Thanks!
> > 
> > > ... but how are you thinking about handling this set?
> > > 
> > 
> > Plan is to send the entire series directly to Linus in the next
> > commit window, as suggested by several of the affected maintainers.
> > 
> > I am still missing an Ack for patch 1 of the series. If/when I get
> > that, I'll set up the series except for the last patch to be added
> > to linux-next for it to get some exposure.
> > 
> > Of course, that plan may all fall apart if someone objects. In that case,
> > the patches would have to be taken over several releases by the individual
> > maintainers.
> 
> Very well.  Either is okay with me.  It might also be worth
> considering speaking to Linus and requesting permission to send during
> -rc1 to minimise the risk of a huge number of conflicts.
> 
That sounds like a good idea. I may have to split the patches into two
parts anyway, to catch any new code setting pm_power_off directly. Maybe 
the first part can go in during the commit window and the final part
after -rc1.

Thanks,
Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 19/47] mfd: rk808: Register power-off handler with kernel power-off handler

2014-11-03 Thread Lee Jones
On Mon, 03 Nov 2014, Guenter Roeck wrote:

> On Mon, Nov 03, 2014 at 05:53:46PM +, Lee Jones wrote:
> > On Mon, 27 Oct 2014, Guenter Roeck wrote:
> > 
> > > Register with kernel power-off handler instead of setting pm_power_off
> > > directly. Register with low priority to reflect that the original code
> > > only sets pm_power_off if it was not already set.
> > > 
> > > Cc: Chris Zhong 
> > > Cc: Zhang Qing 
> > > Signed-off-by: Guenter Roeck 
> > > ---
> > > v3:
> > > - Replace poweroff in all newly introduced variables and in text
> > >   with power_off or power-off as appropriate
> > > - Replace POWEROFF_PRIORITY_xxx with POWER_OFF_PRIORITY_xxx
> > > v2:
> > > - New patch
> > > 
> > >  drivers/mfd/rk808.c   | 30 --
> > >  include/linux/mfd/rk808.h |  2 ++
> > >  2 files changed, 18 insertions(+), 14 deletions(-)
> > 
> > Code looks okay:
> > 
> > Acked-by: Lee Jones 
> > 
> Thanks!
> 
> > ... but how are you thinking about handling this set?
> > 
> 
> Plan is to send the entire series directly to Linus in the next
> commit window, as suggested by several of the affected maintainers.
> 
> I am still missing an Ack for patch 1 of the series. If/when I get
> that, I'll set up the series except for the last patch to be added
> to linux-next for it to get some exposure.
> 
> Of course, that plan may all fall apart if someone objects. In that case,
> the patches would have to be taken over several releases by the individual
> maintainers.

Very well.  Either is okay with me.  It might also be worth
considering speaking to Linus and requesting permission to send during
-rc1 to minimise the risk of a huge number of conflicts.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 19/47] mfd: rk808: Register power-off handler with kernel power-off handler

2014-11-03 Thread Guenter Roeck
On Mon, Nov 03, 2014 at 05:53:46PM +, Lee Jones wrote:
> On Mon, 27 Oct 2014, Guenter Roeck wrote:
> 
> > Register with kernel power-off handler instead of setting pm_power_off
> > directly. Register with low priority to reflect that the original code
> > only sets pm_power_off if it was not already set.
> > 
> > Cc: Chris Zhong 
> > Cc: Zhang Qing 
> > Signed-off-by: Guenter Roeck 
> > ---
> > v3:
> > - Replace poweroff in all newly introduced variables and in text
> >   with power_off or power-off as appropriate
> > - Replace POWEROFF_PRIORITY_xxx with POWER_OFF_PRIORITY_xxx
> > v2:
> > - New patch
> > 
> >  drivers/mfd/rk808.c   | 30 --
> >  include/linux/mfd/rk808.h |  2 ++
> >  2 files changed, 18 insertions(+), 14 deletions(-)
> 
> Code looks okay:
> 
> Acked-by: Lee Jones 
> 
Thanks!

> ... but how are you thinking about handling this set?
> 

Plan is to send the entire series directly to Linus in the next
commit window, as suggested by several of the affected maintainers.

I am still missing an Ack for patch 1 of the series. If/when I get
that, I'll set up the series except for the last patch to be added
to linux-next for it to get some exposure.

Of course, that plan may all fall apart if someone objects. In that case,
the patches would have to be taken over several releases by the individual
maintainers.

Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 19/47] mfd: rk808: Register power-off handler with kernel power-off handler

2014-11-03 Thread Lee Jones
On Mon, 27 Oct 2014, Guenter Roeck wrote:

> Register with kernel power-off handler instead of setting pm_power_off
> directly. Register with low priority to reflect that the original code
> only sets pm_power_off if it was not already set.
> 
> Cc: Chris Zhong 
> Cc: Zhang Qing 
> Signed-off-by: Guenter Roeck 
> ---
> v3:
> - Replace poweroff in all newly introduced variables and in text
>   with power_off or power-off as appropriate
> - Replace POWEROFF_PRIORITY_xxx with POWER_OFF_PRIORITY_xxx
> v2:
> - New patch
> 
>  drivers/mfd/rk808.c   | 30 --
>  include/linux/mfd/rk808.h |  2 ++
>  2 files changed, 18 insertions(+), 14 deletions(-)

Code looks okay:

Acked-by: Lee Jones 

... but how are you thinking about handling this set?

> diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
> index bd02150..5d5257d 100644
> --- a/drivers/mfd/rk808.c
> +++ b/drivers/mfd/rk808.c
> @@ -21,6 +21,8 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
>  #include 
>  
>  struct rk808_reg_data {
> @@ -147,23 +149,19 @@ static struct regmap_irq_chip rk808_irq_chip = {
>   .init_ack_masked = true,
>  };
>  
> -static struct i2c_client *rk808_i2c_client;
> -static void rk808_device_shutdown(void)
> +static int rk808_device_shutdown(struct notifier_block *this,
> +  unsigned long unused1, void *unused2)
>  {
> + struct rk808 *rk808 = container_of(this, struct rk808, power_off_nb);
>   int ret;
> - struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client);
> -
> - if (!rk808) {
> - dev_warn(_i2c_client->dev,
> -  "have no rk808, so do nothing here\n");
> - return;
> - }
>  
>   ret = regmap_update_bits(rk808->regmap,
>RK808_DEVCTRL_REG,
>DEV_OFF_RST, DEV_OFF_RST);
>   if (ret)
> - dev_err(_i2c_client->dev, "power off error!\n");
> + dev_err(>i2c->dev, "power off error!\n");
> +
> + return NOTIFY_DONE;
>  }
>  
>  static int rk808_probe(struct i2c_client *client,
> @@ -222,9 +220,14 @@ static int rk808_probe(struct i2c_client *client,
>  
>   pm_off = of_property_read_bool(np,
>   "rockchip,system-power-controller");
> - if (pm_off && !pm_power_off) {
> - rk808_i2c_client = client;
> - pm_power_off = rk808_device_shutdown;
> + if (pm_off) {
> + rk808->power_off_nb.notifier_call = rk808_device_shutdown;
> + rk808->power_off_nb.priority = POWER_OFF_PRIORITY_LOW;
> + ret = devm_register_power_off_handler(>dev,
> +   >power_off_nb);
> + if (ret)
> + dev_warn(>dev,
> +  "Failed to register power-off handler\n");
>   }
>  
>   return 0;
> @@ -240,7 +243,6 @@ static int rk808_remove(struct i2c_client *client)
>  
>   regmap_del_irq_chip(client->irq, rk808->irq_data);
>   mfd_remove_devices(>dev);
> - pm_power_off = NULL;
>  
>   return 0;
>  }
> diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
> index fb09312..6308fd4 100644
> --- a/include/linux/mfd/rk808.h
> +++ b/include/linux/mfd/rk808.h
> @@ -19,6 +19,7 @@
>  #ifndef __LINUX_REGULATOR_rk808_H
>  #define __LINUX_REGULATOR_rk808_H
>  
> +#include 
>  #include 
>  #include 
>  
> @@ -192,5 +193,6 @@ struct rk808 {
>   struct i2c_client *i2c;
>   struct regmap_irq_chip_data *irq_data;
>   struct regmap *regmap;
> + struct notifier_block power_off_nb;
>  };
>  #endif /* __LINUX_REGULATOR_rk808_H */

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 19/47] mfd: rk808: Register power-off handler with kernel power-off handler

2014-11-03 Thread Lee Jones
On Mon, 27 Oct 2014, Guenter Roeck wrote:

 Register with kernel power-off handler instead of setting pm_power_off
 directly. Register with low priority to reflect that the original code
 only sets pm_power_off if it was not already set.
 
 Cc: Chris Zhong z...@rock-chips.com
 Cc: Zhang Qing zhangq...@rock-chips.com
 Signed-off-by: Guenter Roeck li...@roeck-us.net
 ---
 v3:
 - Replace poweroff in all newly introduced variables and in text
   with power_off or power-off as appropriate
 - Replace POWEROFF_PRIORITY_xxx with POWER_OFF_PRIORITY_xxx
 v2:
 - New patch
 
  drivers/mfd/rk808.c   | 30 --
  include/linux/mfd/rk808.h |  2 ++
  2 files changed, 18 insertions(+), 14 deletions(-)

Code looks okay:

Acked-by: Lee Jones lee.jo...@linaro.org

... but how are you thinking about handling this set?

 diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
 index bd02150..5d5257d 100644
 --- a/drivers/mfd/rk808.c
 +++ b/drivers/mfd/rk808.c
 @@ -21,6 +21,8 @@
  #include linux/mfd/rk808.h
  #include linux/mfd/core.h
  #include linux/module.h
 +#include linux/notifier.h
 +#include linux/pm.h
  #include linux/regmap.h
  
  struct rk808_reg_data {
 @@ -147,23 +149,19 @@ static struct regmap_irq_chip rk808_irq_chip = {
   .init_ack_masked = true,
  };
  
 -static struct i2c_client *rk808_i2c_client;
 -static void rk808_device_shutdown(void)
 +static int rk808_device_shutdown(struct notifier_block *this,
 +  unsigned long unused1, void *unused2)
  {
 + struct rk808 *rk808 = container_of(this, struct rk808, power_off_nb);
   int ret;
 - struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client);
 -
 - if (!rk808) {
 - dev_warn(rk808_i2c_client-dev,
 -  have no rk808, so do nothing here\n);
 - return;
 - }
  
   ret = regmap_update_bits(rk808-regmap,
RK808_DEVCTRL_REG,
DEV_OFF_RST, DEV_OFF_RST);
   if (ret)
 - dev_err(rk808_i2c_client-dev, power off error!\n);
 + dev_err(rk808-i2c-dev, power off error!\n);
 +
 + return NOTIFY_DONE;
  }
  
  static int rk808_probe(struct i2c_client *client,
 @@ -222,9 +220,14 @@ static int rk808_probe(struct i2c_client *client,
  
   pm_off = of_property_read_bool(np,
   rockchip,system-power-controller);
 - if (pm_off  !pm_power_off) {
 - rk808_i2c_client = client;
 - pm_power_off = rk808_device_shutdown;
 + if (pm_off) {
 + rk808-power_off_nb.notifier_call = rk808_device_shutdown;
 + rk808-power_off_nb.priority = POWER_OFF_PRIORITY_LOW;
 + ret = devm_register_power_off_handler(client-dev,
 +   rk808-power_off_nb);
 + if (ret)
 + dev_warn(client-dev,
 +  Failed to register power-off handler\n);
   }
  
   return 0;
 @@ -240,7 +243,6 @@ static int rk808_remove(struct i2c_client *client)
  
   regmap_del_irq_chip(client-irq, rk808-irq_data);
   mfd_remove_devices(client-dev);
 - pm_power_off = NULL;
  
   return 0;
  }
 diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
 index fb09312..6308fd4 100644
 --- a/include/linux/mfd/rk808.h
 +++ b/include/linux/mfd/rk808.h
 @@ -19,6 +19,7 @@
  #ifndef __LINUX_REGULATOR_rk808_H
  #define __LINUX_REGULATOR_rk808_H
  
 +#include linux/notifier.h
  #include linux/regulator/machine.h
  #include linux/regmap.h
  
 @@ -192,5 +193,6 @@ struct rk808 {
   struct i2c_client *i2c;
   struct regmap_irq_chip_data *irq_data;
   struct regmap *regmap;
 + struct notifier_block power_off_nb;
  };
  #endif /* __LINUX_REGULATOR_rk808_H */

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 19/47] mfd: rk808: Register power-off handler with kernel power-off handler

2014-11-03 Thread Guenter Roeck
On Mon, Nov 03, 2014 at 05:53:46PM +, Lee Jones wrote:
 On Mon, 27 Oct 2014, Guenter Roeck wrote:
 
  Register with kernel power-off handler instead of setting pm_power_off
  directly. Register with low priority to reflect that the original code
  only sets pm_power_off if it was not already set.
  
  Cc: Chris Zhong z...@rock-chips.com
  Cc: Zhang Qing zhangq...@rock-chips.com
  Signed-off-by: Guenter Roeck li...@roeck-us.net
  ---
  v3:
  - Replace poweroff in all newly introduced variables and in text
with power_off or power-off as appropriate
  - Replace POWEROFF_PRIORITY_xxx with POWER_OFF_PRIORITY_xxx
  v2:
  - New patch
  
   drivers/mfd/rk808.c   | 30 --
   include/linux/mfd/rk808.h |  2 ++
   2 files changed, 18 insertions(+), 14 deletions(-)
 
 Code looks okay:
 
 Acked-by: Lee Jones lee.jo...@linaro.org
 
Thanks!

 ... but how are you thinking about handling this set?
 

Plan is to send the entire series directly to Linus in the next
commit window, as suggested by several of the affected maintainers.

I am still missing an Ack for patch 1 of the series. If/when I get
that, I'll set up the series except for the last patch to be added
to linux-next for it to get some exposure.

Of course, that plan may all fall apart if someone objects. In that case,
the patches would have to be taken over several releases by the individual
maintainers.

Guenter
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 19/47] mfd: rk808: Register power-off handler with kernel power-off handler

2014-11-03 Thread Lee Jones
On Mon, 03 Nov 2014, Guenter Roeck wrote:

 On Mon, Nov 03, 2014 at 05:53:46PM +, Lee Jones wrote:
  On Mon, 27 Oct 2014, Guenter Roeck wrote:
  
   Register with kernel power-off handler instead of setting pm_power_off
   directly. Register with low priority to reflect that the original code
   only sets pm_power_off if it was not already set.
   
   Cc: Chris Zhong z...@rock-chips.com
   Cc: Zhang Qing zhangq...@rock-chips.com
   Signed-off-by: Guenter Roeck li...@roeck-us.net
   ---
   v3:
   - Replace poweroff in all newly introduced variables and in text
 with power_off or power-off as appropriate
   - Replace POWEROFF_PRIORITY_xxx with POWER_OFF_PRIORITY_xxx
   v2:
   - New patch
   
drivers/mfd/rk808.c   | 30 --
include/linux/mfd/rk808.h |  2 ++
2 files changed, 18 insertions(+), 14 deletions(-)
  
  Code looks okay:
  
  Acked-by: Lee Jones lee.jo...@linaro.org
  
 Thanks!
 
  ... but how are you thinking about handling this set?
  
 
 Plan is to send the entire series directly to Linus in the next
 commit window, as suggested by several of the affected maintainers.
 
 I am still missing an Ack for patch 1 of the series. If/when I get
 that, I'll set up the series except for the last patch to be added
 to linux-next for it to get some exposure.
 
 Of course, that plan may all fall apart if someone objects. In that case,
 the patches would have to be taken over several releases by the individual
 maintainers.

Very well.  Either is okay with me.  It might also be worth
considering speaking to Linus and requesting permission to send during
-rc1 to minimise the risk of a huge number of conflicts.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 19/47] mfd: rk808: Register power-off handler with kernel power-off handler

2014-11-03 Thread Guenter Roeck
On Mon, Nov 03, 2014 at 10:42:27PM +, Lee Jones wrote:
 On Mon, 03 Nov 2014, Guenter Roeck wrote:
 
  On Mon, Nov 03, 2014 at 05:53:46PM +, Lee Jones wrote:
   On Mon, 27 Oct 2014, Guenter Roeck wrote:
   
Register with kernel power-off handler instead of setting pm_power_off
directly. Register with low priority to reflect that the original code
only sets pm_power_off if it was not already set.

Cc: Chris Zhong z...@rock-chips.com
Cc: Zhang Qing zhangq...@rock-chips.com
Signed-off-by: Guenter Roeck li...@roeck-us.net
---
v3:
- Replace poweroff in all newly introduced variables and in text
  with power_off or power-off as appropriate
- Replace POWEROFF_PRIORITY_xxx with POWER_OFF_PRIORITY_xxx
v2:
- New patch

 drivers/mfd/rk808.c   | 30 --
 include/linux/mfd/rk808.h |  2 ++
 2 files changed, 18 insertions(+), 14 deletions(-)
   
   Code looks okay:
   
   Acked-by: Lee Jones lee.jo...@linaro.org
   
  Thanks!
  
   ... but how are you thinking about handling this set?
   
  
  Plan is to send the entire series directly to Linus in the next
  commit window, as suggested by several of the affected maintainers.
  
  I am still missing an Ack for patch 1 of the series. If/when I get
  that, I'll set up the series except for the last patch to be added
  to linux-next for it to get some exposure.
  
  Of course, that plan may all fall apart if someone objects. In that case,
  the patches would have to be taken over several releases by the individual
  maintainers.
 
 Very well.  Either is okay with me.  It might also be worth
 considering speaking to Linus and requesting permission to send during
 -rc1 to minimise the risk of a huge number of conflicts.
 
That sounds like a good idea. I may have to split the patches into two
parts anyway, to catch any new code setting pm_power_off directly. Maybe 
the first part can go in during the commit window and the final part
after -rc1.

Thanks,
Guenter
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/