Re: [PATCH] regulator: fixed: Use devm_regulator_register

2014-01-26 Thread Manish Badarkhe
Hi

On Mon, Jan 27, 2014 at 5:33 AM, Mark Brown  wrote:
> On Sun, Jan 26, 2014 at 01:36:53PM -0800, Dmitry Torokhov wrote:
>> On Sat, Jan 25, 2014 at 11:35:54PM +0530, Manish Badarkhe wrote:
>
>> > Use "devm_regulator_register" instead of "regulator_register"
>> > which simplifies the code.
>
>> ... and also breaks the driver: now you are freeing desc->name and
>> desc->supply_name while regulator structures are still alive and can be
>> referenced from its sysfs attributes, etc.
>
> Yup, they need to be converted to managed allocations too if the
> regulator_register() is going to be converted (see previous discussions
> on similar patches).  It would be good to do so.

Thank you for pointing this out.
I missed to convert these two " desc->name" and "desc->supply_name"
to manage allocation. I will modify code and repost patch.

Regards
Manish Badarkhe
--
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] regulator: fixed: Use devm_regulator_register

2014-01-26 Thread Mark Brown
On Sun, Jan 26, 2014 at 01:36:53PM -0800, Dmitry Torokhov wrote:
> On Sat, Jan 25, 2014 at 11:35:54PM +0530, Manish Badarkhe wrote:

> > Use "devm_regulator_register" instead of "regulator_register"
> > which simplifies the code.

> ... and also breaks the driver: now you are freeing desc->name and
> desc->supply_name while regulator structures are still alive and can be
> referenced from its sysfs attributes, etc.

Yup, they need to be converted to managed allocations too if the
regulator_register() is going to be converted (see previous discussions
on similar patches).  It would be good to do so.


signature.asc
Description: Digital signature


Re: [PATCH] regulator: fixed: Use devm_regulator_register

2014-01-26 Thread Dmitry Torokhov
Hi Manish,

On Sat, Jan 25, 2014 at 11:35:54PM +0530, Manish Badarkhe wrote:
> Use "devm_regulator_register" instead of "regulator_register"
> which simplifies the code.

... and also breaks the driver: now you are freeing desc->name and
desc->supply_name while regulator structures are still alive and can be
referenced from its sysfs attributes, etc.

> 
> Signed-off-by: Manish Badarkhe 
> ---
> :100644 100644 5ea64b9... 6d32341... Mdrivers/regulator/fixed.c
>  drivers/regulator/fixed.c |4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
> index 5ea64b9..6d32341 100644
> --- a/drivers/regulator/fixed.c
> +++ b/drivers/regulator/fixed.c
> @@ -186,7 +186,8 @@ static int reg_fixed_voltage_probe(struct platform_device 
> *pdev)
>   cfg.driver_data = drvdata;
>   cfg.of_node = pdev->dev.of_node;
>  
> - drvdata->dev = regulator_register(>desc, );
> + drvdata->dev = devm_regulator_register(>dev, >desc,
> +);
>   if (IS_ERR(drvdata->dev)) {
>   ret = PTR_ERR(drvdata->dev);
>   dev_err(>dev, "Failed to register regulator: %d\n", ret);
> @@ -212,7 +213,6 @@ static int reg_fixed_voltage_remove(struct 
> platform_device *pdev)
>  {
>   struct fixed_voltage_data *drvdata = platform_get_drvdata(pdev);
>  
> - regulator_unregister(drvdata->dev);
>   kfree(drvdata->desc.supply_name);
>   kfree(drvdata->desc.name);
>  

Thanks.

-- 
Dmitry
--
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] regulator: fixed: Use devm_regulator_register

2014-01-26 Thread Dmitry Torokhov
Hi Manish,

On Sat, Jan 25, 2014 at 11:35:54PM +0530, Manish Badarkhe wrote:
 Use devm_regulator_register instead of regulator_register
 which simplifies the code.

... and also breaks the driver: now you are freeing desc-name and
desc-supply_name while regulator structures are still alive and can be
referenced from its sysfs attributes, etc.

 
 Signed-off-by: Manish Badarkhe badarkhe.man...@gmail.com
 ---
 :100644 100644 5ea64b9... 6d32341... Mdrivers/regulator/fixed.c
  drivers/regulator/fixed.c |4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
 index 5ea64b9..6d32341 100644
 --- a/drivers/regulator/fixed.c
 +++ b/drivers/regulator/fixed.c
 @@ -186,7 +186,8 @@ static int reg_fixed_voltage_probe(struct platform_device 
 *pdev)
   cfg.driver_data = drvdata;
   cfg.of_node = pdev-dev.of_node;
  
 - drvdata-dev = regulator_register(drvdata-desc, cfg);
 + drvdata-dev = devm_regulator_register(pdev-dev, drvdata-desc,
 +cfg);
   if (IS_ERR(drvdata-dev)) {
   ret = PTR_ERR(drvdata-dev);
   dev_err(pdev-dev, Failed to register regulator: %d\n, ret);
 @@ -212,7 +213,6 @@ static int reg_fixed_voltage_remove(struct 
 platform_device *pdev)
  {
   struct fixed_voltage_data *drvdata = platform_get_drvdata(pdev);
  
 - regulator_unregister(drvdata-dev);
   kfree(drvdata-desc.supply_name);
   kfree(drvdata-desc.name);
  

Thanks.

-- 
Dmitry
--
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] regulator: fixed: Use devm_regulator_register

2014-01-26 Thread Mark Brown
On Sun, Jan 26, 2014 at 01:36:53PM -0800, Dmitry Torokhov wrote:
 On Sat, Jan 25, 2014 at 11:35:54PM +0530, Manish Badarkhe wrote:

  Use devm_regulator_register instead of regulator_register
  which simplifies the code.

 ... and also breaks the driver: now you are freeing desc-name and
 desc-supply_name while regulator structures are still alive and can be
 referenced from its sysfs attributes, etc.

Yup, they need to be converted to managed allocations too if the
regulator_register() is going to be converted (see previous discussions
on similar patches).  It would be good to do so.


signature.asc
Description: Digital signature


Re: [PATCH] regulator: fixed: Use devm_regulator_register

2014-01-26 Thread Manish Badarkhe
Hi

On Mon, Jan 27, 2014 at 5:33 AM, Mark Brown broo...@kernel.org wrote:
 On Sun, Jan 26, 2014 at 01:36:53PM -0800, Dmitry Torokhov wrote:
 On Sat, Jan 25, 2014 at 11:35:54PM +0530, Manish Badarkhe wrote:

  Use devm_regulator_register instead of regulator_register
  which simplifies the code.

 ... and also breaks the driver: now you are freeing desc-name and
 desc-supply_name while regulator structures are still alive and can be
 referenced from its sysfs attributes, etc.

 Yup, they need to be converted to managed allocations too if the
 regulator_register() is going to be converted (see previous discussions
 on similar patches).  It would be good to do so.

Thank you for pointing this out.
I missed to convert these two  desc-name and desc-supply_name
to manage allocation. I will modify code and repost patch.

Regards
Manish Badarkhe
--
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/


[PATCH] regulator: fixed: Use devm_regulator_register

2014-01-25 Thread Manish Badarkhe
Use "devm_regulator_register" instead of "regulator_register"
which simplifies the code.

Signed-off-by: Manish Badarkhe 
---
:100644 100644 5ea64b9... 6d32341... M  drivers/regulator/fixed.c
 drivers/regulator/fixed.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index 5ea64b9..6d32341 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -186,7 +186,8 @@ static int reg_fixed_voltage_probe(struct platform_device 
*pdev)
cfg.driver_data = drvdata;
cfg.of_node = pdev->dev.of_node;
 
-   drvdata->dev = regulator_register(>desc, );
+   drvdata->dev = devm_regulator_register(>dev, >desc,
+  );
if (IS_ERR(drvdata->dev)) {
ret = PTR_ERR(drvdata->dev);
dev_err(>dev, "Failed to register regulator: %d\n", ret);
@@ -212,7 +213,6 @@ static int reg_fixed_voltage_remove(struct platform_device 
*pdev)
 {
struct fixed_voltage_data *drvdata = platform_get_drvdata(pdev);
 
-   regulator_unregister(drvdata->dev);
kfree(drvdata->desc.supply_name);
kfree(drvdata->desc.name);
 
-- 
1.7.10.4

--
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/


[PATCH] regulator: fixed: Use devm_regulator_register

2014-01-25 Thread Manish Badarkhe
Use devm_regulator_register instead of regulator_register
which simplifies the code.

Signed-off-by: Manish Badarkhe badarkhe.man...@gmail.com
---
:100644 100644 5ea64b9... 6d32341... M  drivers/regulator/fixed.c
 drivers/regulator/fixed.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index 5ea64b9..6d32341 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -186,7 +186,8 @@ static int reg_fixed_voltage_probe(struct platform_device 
*pdev)
cfg.driver_data = drvdata;
cfg.of_node = pdev-dev.of_node;
 
-   drvdata-dev = regulator_register(drvdata-desc, cfg);
+   drvdata-dev = devm_regulator_register(pdev-dev, drvdata-desc,
+  cfg);
if (IS_ERR(drvdata-dev)) {
ret = PTR_ERR(drvdata-dev);
dev_err(pdev-dev, Failed to register regulator: %d\n, ret);
@@ -212,7 +213,6 @@ static int reg_fixed_voltage_remove(struct platform_device 
*pdev)
 {
struct fixed_voltage_data *drvdata = platform_get_drvdata(pdev);
 
-   regulator_unregister(drvdata-dev);
kfree(drvdata-desc.supply_name);
kfree(drvdata-desc.name);
 
-- 
1.7.10.4

--
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/