Re: [PATCH V2] ASoC: omap-hdmi: Use devm_snd_soc_register_component

2014-07-09 Thread Manish Badarkhe
Hi Peter,

On Wed, Jul 9, 2014 at 11:18 AM, Peter Ujfalusi peter.ujfal...@ti.com wrote:
 On 07/08/2014 07:47 PM, Manish Badarkhe wrote:
 Replaced snd_soc_register_component with its devres equivalent,
 devm_snd_soc_register_component.

 Signed-off-by: Manish Badarkhe badarkhe.man...@gmail.com

 Jut to make things easier I think we should not have this patch applied since
 Jyri's OMAP4+ HDMI audio rework series is going to delete this file.

Ok fine.

Thanks
Manish Badarkhe
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ASoC: omap-hdmi: Use devm_snd_soc_register_component

2014-07-08 Thread Manish Badarkhe
Hi Peter,

On Mon, Jul 7, 2014 at 2:59 PM, Peter Ujfalusi peter.ujfal...@ti.com wrote:
 On 07/06/2014 09:49 AM, Manish Badarkhe wrote:
 Replaced snd_soc_register_component with its devres equivalent,
 devm_snd_soc_register_component.

 Signed-off-by: Manish Badarkhe badarkhe.man...@gmail.com
 ---
 :100644 100644 eb9c392... 1dc95b5... Msound/soc/omap/omap-hdmi.c
  sound/soc/omap/omap-hdmi.c |4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)

 diff --git a/sound/soc/omap/omap-hdmi.c b/sound/soc/omap/omap-hdmi.c
 index eb9c392..1dc95b5 100644
 --- a/sound/soc/omap/omap-hdmi.c
 +++ b/sound/soc/omap/omap-hdmi.c
 @@ -322,7 +322,7 @@ static int omap_hdmi_probe(struct platform_device *pdev)
   }

   dev_set_drvdata(pdev-dev, hdmi_data);
 - ret = snd_soc_register_component(pdev-dev, omap_hdmi_component,
 + ret = devm_snd_soc_register_component(pdev-dev, omap_hdmi_component,
omap_hdmi_dai, 1);

 As with the omap-mcbsp:
 Can you align the parameters as well?

Sure, will do it and send next version.

Regards
Manish Badarkhe
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ASoC: omap-dmic: Use devm_snd_soc_register_component

2014-07-08 Thread Manish Badarkhe
Hi Peter,

On Mon, Jul 7, 2014 at 3:00 PM, Peter Ujfalusi peter.ujfal...@ti.com wrote:
 On 07/06/2014 09:50 AM, Manish Badarkhe wrote:
 Replaced snd_soc_register_component with its devres equivalent,
 devm_snd_soc_register_component.

 Signed-off-by: Manish Badarkhe badarkhe.man...@gmail.com
 ---
 :100644 100644 6925d71... 011e30e... Msound/soc/omap/omap-dmic.c
  sound/soc/omap/omap-dmic.c |3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

 diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c
 index 6925d71..011e30e 100644
 --- a/sound/soc/omap/omap-dmic.c
 +++ b/sound/soc/omap/omap-dmic.c
 @@ -490,7 +490,7 @@ static int asoc_dmic_probe(struct platform_device *pdev)
   }


 - ret = snd_soc_register_component(pdev-dev, omap_dmic_component,
 + ret = devm_snd_soc_register_component(pdev-dev, omap_dmic_component,
omap_dmic_dai, 1);

 Would you align the parameters at the same time?

Sure, will do it and send next version.

Regards
Manish Badarkhe
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2] ASoC: omap-mcbsp: Use devm_snd_soc_register_component

2014-07-08 Thread Manish Badarkhe
Replaced snd_soc_register_component with its devres equivalent,
devm_snd_soc_register_component.

Signed-off-by: Manish Badarkhe badarkhe.man...@gmail.com
---
Changes since V1:
Aligned function parameter properly.

:100644 100644 efe2cd6... bd3ef2a... M  sound/soc/omap/omap-mcbsp.c
 sound/soc/omap/omap-mcbsp.c |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index efe2cd6..bd3ef2a 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -805,8 +805,9 @@ static int asoc_mcbsp_probe(struct platform_device *pdev)
if (ret)
return ret;
 
-   ret = snd_soc_register_component(pdev-dev, omap_mcbsp_component,
-omap_mcbsp_dai, 1);
+   ret = devm_snd_soc_register_component(pdev-dev,
+ omap_mcbsp_component,
+ omap_mcbsp_dai, 1);
if (ret)
return ret;
 
@@ -817,8 +818,6 @@ static int asoc_mcbsp_remove(struct platform_device *pdev)
 {
struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev);
 
-   snd_soc_unregister_component(pdev-dev);
-
if (mcbsp-pdata-ops  mcbsp-pdata-ops-free)
mcbsp-pdata-ops-free(mcbsp-id);
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2] ASoC: omap-hdmi: Use devm_snd_soc_register_component

2014-07-08 Thread Manish Badarkhe
Replaced snd_soc_register_component with its devres equivalent,
devm_snd_soc_register_component.

Signed-off-by: Manish Badarkhe badarkhe.man...@gmail.com
---
Changes since V1:
Aligned function parameter properly.

:100644 100644 eb9c392... 8dcd7f7... M  sound/soc/omap/omap-hdmi.c
 sound/soc/omap/omap-hdmi.c |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sound/soc/omap/omap-hdmi.c b/sound/soc/omap/omap-hdmi.c
index eb9c392..8dcd7f7 100644
--- a/sound/soc/omap/omap-hdmi.c
+++ b/sound/soc/omap/omap-hdmi.c
@@ -322,8 +322,9 @@ static int omap_hdmi_probe(struct platform_device *pdev)
}
 
dev_set_drvdata(pdev-dev, hdmi_data);
-   ret = snd_soc_register_component(pdev-dev, omap_hdmi_component,
-omap_hdmi_dai, 1);
+   ret = devm_snd_soc_register_component(pdev-dev,
+ omap_hdmi_component,
+ omap_hdmi_dai, 1);
 
if (ret)
return ret;
@@ -335,8 +336,6 @@ static int omap_hdmi_remove(struct platform_device *pdev)
 {
struct hdmi_priv *hdmi_data = dev_get_drvdata(pdev-dev);
 
-   snd_soc_unregister_component(pdev-dev);
-
if (hdmi_data == NULL) {
dev_err(pdev-dev, cannot obtain HDMi data\n);
return -ENODEV;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2] ASoC: omap-dmic: Use devm_snd_soc_register_component

2014-07-08 Thread Manish Badarkhe
Replaced snd_soc_register_component with its devres equivalent,
devm_snd_soc_register_component.

Signed-off-by: Manish Badarkhe badarkhe.man...@gmail.com
---
Changes since V1:
Aligned function parameter properly.

:100644 100644 6925d71... f125eb9... M  sound/soc/omap/omap-dmic.c
 sound/soc/omap/omap-dmic.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c
index 6925d71..f125eb9 100644
--- a/sound/soc/omap/omap-dmic.c
+++ b/sound/soc/omap/omap-dmic.c
@@ -490,8 +490,9 @@ static int asoc_dmic_probe(struct platform_device *pdev)
}
 
 
-   ret = snd_soc_register_component(pdev-dev, omap_dmic_component,
-omap_dmic_dai, 1);
+   ret = devm_snd_soc_register_component(pdev-dev,
+ omap_dmic_component,
+ omap_dmic_dai, 1);
if (ret)
goto err_put_clk;
 
@@ -510,7 +511,6 @@ static int asoc_dmic_remove(struct platform_device *pdev)
 {
struct omap_dmic *dmic = platform_get_drvdata(pdev);
 
-   snd_soc_unregister_component(pdev-dev);
clk_put(dmic-fclk);
 
return 0;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ASoC: omap-dmic: Use devm_snd_soc_register_component

2014-07-06 Thread Manish Badarkhe
Replaced snd_soc_register_component with its devres equivalent,
devm_snd_soc_register_component.

Signed-off-by: Manish Badarkhe badarkhe.man...@gmail.com
---
:100644 100644 6925d71... 011e30e... M  sound/soc/omap/omap-dmic.c
 sound/soc/omap/omap-dmic.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c
index 6925d71..011e30e 100644
--- a/sound/soc/omap/omap-dmic.c
+++ b/sound/soc/omap/omap-dmic.c
@@ -490,7 +490,7 @@ static int asoc_dmic_probe(struct platform_device *pdev)
}
 
 
-   ret = snd_soc_register_component(pdev-dev, omap_dmic_component,
+   ret = devm_snd_soc_register_component(pdev-dev, omap_dmic_component,
 omap_dmic_dai, 1);
if (ret)
goto err_put_clk;
@@ -510,7 +510,6 @@ static int asoc_dmic_remove(struct platform_device *pdev)
 {
struct omap_dmic *dmic = platform_get_drvdata(pdev);
 
-   snd_soc_unregister_component(pdev-dev);
clk_put(dmic-fclk);
 
return 0;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ASoC: omap-hdmi: Use devm_snd_soc_register_component

2014-07-06 Thread Manish Badarkhe
Replaced snd_soc_register_component with its devres equivalent,
devm_snd_soc_register_component.

Signed-off-by: Manish Badarkhe badarkhe.man...@gmail.com
---
:100644 100644 eb9c392... 1dc95b5... M  sound/soc/omap/omap-hdmi.c
 sound/soc/omap/omap-hdmi.c |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sound/soc/omap/omap-hdmi.c b/sound/soc/omap/omap-hdmi.c
index eb9c392..1dc95b5 100644
--- a/sound/soc/omap/omap-hdmi.c
+++ b/sound/soc/omap/omap-hdmi.c
@@ -322,7 +322,7 @@ static int omap_hdmi_probe(struct platform_device *pdev)
}
 
dev_set_drvdata(pdev-dev, hdmi_data);
-   ret = snd_soc_register_component(pdev-dev, omap_hdmi_component,
+   ret = devm_snd_soc_register_component(pdev-dev, omap_hdmi_component,
 omap_hdmi_dai, 1);
 
if (ret)
@@ -335,8 +335,6 @@ static int omap_hdmi_remove(struct platform_device *pdev)
 {
struct hdmi_priv *hdmi_data = dev_get_drvdata(pdev-dev);
 
-   snd_soc_unregister_component(pdev-dev);
-
if (hdmi_data == NULL) {
dev_err(pdev-dev, cannot obtain HDMi data\n);
return -ENODEV;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ASoC: omap-mcbsp: Use devm_snd_soc_register_component

2014-07-04 Thread Manish Badarkhe
Replaced snd_soc_register_component with its devres equivalent,
devm_snd_soc_register_component.

Signed-off-by: Manish Badarkhe badarkhe.man...@gmail.com
---
:100644 100644 efe2cd6... bfc8f8e... M  sound/soc/omap/omap-mcbsp.c
 sound/soc/omap/omap-mcbsp.c |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index efe2cd6..bfc8f8e 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -805,7 +805,7 @@ static int asoc_mcbsp_probe(struct platform_device *pdev)
if (ret)
return ret;
 
-   ret = snd_soc_register_component(pdev-dev, omap_mcbsp_component,
+   ret = devm_snd_soc_register_component(pdev-dev, omap_mcbsp_component,
 omap_mcbsp_dai, 1);
if (ret)
return ret;
@@ -817,8 +817,6 @@ static int asoc_mcbsp_remove(struct platform_device *pdev)
 {
struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev);
 
-   snd_soc_unregister_component(pdev-dev);
-
if (mcbsp-pdata-ops  mcbsp-pdata-ops-free)
mcbsp-pdata-ops-free(mcbsp-id);
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V2] regulator: fixed: update to devm_* API

2014-01-28 Thread Manish Badarkhe
Hi Heiko

Thank you for your reply.

On Tue, Jan 28, 2014 at 1:08 PM, Heiko Stübner he...@sntech.de wrote:
 On Tuesday, 28. January 2014 12:46:01 Manish Badarkhe wrote:
 Hi Dmitry,

 Thank you for your review.

 On Tue, Jan 28, 2014 at 12:03 PM, Dmitry Torokhov

 dmitry.torok...@gmail.com wrote:
  Hi Manish,
 
  On Tue, Jan 28, 2014 at 08:42:00AM +0530, Manish Badarkhe wrote:
  Update the code to use devm_* API so that driver core will manage
  resources.
 
  Signed-off-by: Manish Badarkhe badarkhe.man...@gmail.com
  ---
  Changes since V1:
  1. Updated driver to use devm_kzalloc to kstrdup.
  2. Updated commit message.
 
  Not tested on any board.
 
  :100644 100644 5ea64b9... e9763a4... Mdrivers/regulator/fixed.c
  :
   drivers/regulator/fixed.c |   42
   --
   1 file changed, 12 insertions(+), 30 deletions(-)
 
  diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
  index 5ea64b9..e9763a4 100644
  --- a/drivers/regulator/fixed.c
  +++ b/drivers/regulator/fixed.c
  @@ -132,15 +132,15 @@ static int reg_fixed_voltage_probe(struct
  platform_device *pdev)
   GFP_KERNEL);
 
if (drvdata == NULL) {
 
dev_err(pdev-dev, Failed to allocate device data\n);
 
  - ret = -ENOMEM;
  - goto err;
  + return -ENOMEM;
 
}
 
  - drvdata-desc.name = kstrdup(config-supply_name, GFP_KERNEL);
  + drvdata-desc.name = devm_kzalloc(pdev-dev,
  +   strlen(config-supply_name) + 1,
  +   GFP_KERNEL);
 
if (drvdata-desc.name == NULL) {
 
dev_err(pdev-dev, Failed to allocate supply name\n);
 
  - ret = -ENOMEM;
  - goto err;
  + return -ENOMEM;
 
}
 
  Umm, I am fairly certain that devm_kzalloc() can't be used as a
  substitute for kstrdup, at least not without accompanying memcpy.

 Yes, I have provided allocation but it should be followed with assignment.
 Can I modify like this,

 + drvdata-desc.name = devm_kzalloc(pdev-dev,
 +   strlen(config-supply_name) + 1,
 +   GFP_KERNEL);
 + if (drvdata-desc.name)
 + sprintf(drvdata-desc.name, %s, config-supply_name);

 hmm, so you replaced a general helper function by open coding the string-
 duplication. Doesn't this defeat the target of simplifying the code?

Intention here, is to use devm_ API and to adopt this I have to do these
modifications for kstrdup functions. I have seen in regulator folder almost
all drivers adopted to devm_ API. Hence same thing I am following to
update this driver. Please let me know whether to go ahead with this patch
or retain driver as it is.

Regards
Manish Badarkhe
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V2] regulator: fixed: update to devm_* API

2014-01-28 Thread Manish Badarkhe
On Tue, Jan 28, 2014 at 2:25 PM, Heiko Stübner he...@sntech.de wrote:
 On Tuesday, 28. January 2014 14:16:39 Manish Badarkhe wrote:
 Hi Heiko

 Thank you for your reply.

 On Tue, Jan 28, 2014 at 1:08 PM, Heiko Stübner he...@sntech.de wrote:
  On Tuesday, 28. January 2014 12:46:01 Manish Badarkhe wrote:
  Hi Dmitry,
 
  Thank you for your review.
 
  On Tue, Jan 28, 2014 at 12:03 PM, Dmitry Torokhov
 
  dmitry.torok...@gmail.com wrote:
   Hi Manish,
  
   On Tue, Jan 28, 2014 at 08:42:00AM +0530, Manish Badarkhe wrote:
   Update the code to use devm_* API so that driver core will manage
   resources.
  
   Signed-off-by: Manish Badarkhe badarkhe.man...@gmail.com
   ---
   Changes since V1:
   1. Updated driver to use devm_kzalloc to kstrdup.
   2. Updated commit message.
  
   Not tested on any board.
  
   :100644 100644 5ea64b9... e9763a4... M
   :drivers/regulator/fixed.c
   :
drivers/regulator/fixed.c |   42
--
1 file changed, 12 insertions(+), 30 deletions(-)
  
   diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
   index 5ea64b9..e9763a4 100644
   --- a/drivers/regulator/fixed.c
   +++ b/drivers/regulator/fixed.c
   @@ -132,15 +132,15 @@ static int reg_fixed_voltage_probe(struct
   platform_device *pdev)
  
GFP_KERNEL);
  
 if (drvdata == NULL) {
  
 dev_err(pdev-dev, Failed to allocate device data\n);
  
   - ret = -ENOMEM;
   - goto err;
   + return -ENOMEM;
  
 }
  
   - drvdata-desc.name = kstrdup(config-supply_name, GFP_KERNEL);
   + drvdata-desc.name = devm_kzalloc(pdev-dev,
   +   strlen(config-supply_name) +
   1,
   +   GFP_KERNEL);
  
 if (drvdata-desc.name == NULL) {
  
 dev_err(pdev-dev, Failed to allocate supply name\n);
  
   - ret = -ENOMEM;
   - goto err;
   + return -ENOMEM;
  
 }
  
   Umm, I am fairly certain that devm_kzalloc() can't be used as a
   substitute for kstrdup, at least not without accompanying memcpy.
 
  Yes, I have provided allocation but it should be followed with
  assignment.
  Can I modify like this,
 
  + drvdata-desc.name = devm_kzalloc(pdev-dev,
  +   strlen(config-supply_name) + 1,
  +   GFP_KERNEL);
  + if (drvdata-desc.name)
  + sprintf(drvdata-desc.name, %s, config-supply_name);
 
  hmm, so you replaced a general helper function by open coding the string-
  duplication. Doesn't this defeat the target of simplifying the code?

 Intention here, is to use devm_ API and to adopt this I have to do these
 modifications for kstrdup functions. I have seen in regulator folder
 almost all drivers adopted to devm_ API. Hence same thing I am following
 to update this driver. Please let me know whether to go ahead with this
 patch or retain driver as it is.

 I don't have a strong opinion on this and others are most likely more 
 qualified
 to have a definitive answer, I just found it strange to exchange one 
 open-coded
 pattern against another open-coded one.

 So don't let me keep you from it ;-)

Okay.
@Mark, Dmitry: Please let me know your opinion on this.

Thanks
Manish Badarkhe
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V2] regulator: fixed: update to devm_* API

2014-01-28 Thread Manish Badarkhe
Hi Stephan,

On Tue, Jan 28, 2014 at 10:11 PM, Stephen Warren swar...@wwwdotorg.org wrote:
 On 01/27/2014 08:12 PM, Manish Badarkhe wrote:
 Update the code to use devm_* API so that driver core will manage
 resources.

 I'm not sure why this patch is sent to linux-te...@vger.kernel.org; it
 seems nothing to do with Tegra (or Samsung or OMAP for that matter).

Sorry, for the noise. I sent it to have review comments from community.

Regards
Manish Badarkhe
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2] regulator: fixed: update to devm_* API

2014-01-27 Thread Manish Badarkhe
Update the code to use devm_* API so that driver core will manage
resources.

Signed-off-by: Manish Badarkhe badarkhe.man...@gmail.com
---
Changes since V1:
1. Updated driver to use devm_kzalloc to kstrdup.
2. Updated commit message.

Not tested on any board.

:100644 100644 5ea64b9... e9763a4... M  drivers/regulator/fixed.c
 drivers/regulator/fixed.c |   42 --
 1 file changed, 12 insertions(+), 30 deletions(-)

diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index 5ea64b9..e9763a4 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -132,15 +132,15 @@ static int reg_fixed_voltage_probe(struct platform_device 
*pdev)
   GFP_KERNEL);
if (drvdata == NULL) {
dev_err(pdev-dev, Failed to allocate device data\n);
-   ret = -ENOMEM;
-   goto err;
+   return -ENOMEM;
}
 
-   drvdata-desc.name = kstrdup(config-supply_name, GFP_KERNEL);
+   drvdata-desc.name = devm_kzalloc(pdev-dev,
+ strlen(config-supply_name) + 1,
+ GFP_KERNEL);
if (drvdata-desc.name == NULL) {
dev_err(pdev-dev, Failed to allocate supply name\n);
-   ret = -ENOMEM;
-   goto err;
+   return -ENOMEM;
}
drvdata-desc.type = REGULATOR_VOLTAGE;
drvdata-desc.owner = THIS_MODULE;
@@ -149,13 +149,13 @@ static int reg_fixed_voltage_probe(struct platform_device 
*pdev)
drvdata-desc.enable_time = config-startup_delay;
 
if (config-input_supply) {
-   drvdata-desc.supply_name = kstrdup(config-input_supply,
-   GFP_KERNEL);
+   drvdata-desc.supply_name = devm_kzalloc(pdev-dev,
+   strlen(config-input_supply) + 1,
+   GFP_KERNEL);
if (!drvdata-desc.supply_name) {
dev_err(pdev-dev,
Failed to allocate input supply\n);
-   ret = -ENOMEM;
-   goto err_name;
+   return -ENOMEM;
}
}
 
@@ -186,11 +186,12 @@ 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);
-   goto err_input;
+   return ret;
}
 
platform_set_drvdata(pdev, drvdata);
@@ -199,24 +200,6 @@ static int reg_fixed_voltage_probe(struct platform_device 
*pdev)
drvdata-desc.fixed_uV);
 
return 0;
-
-err_input:
-   kfree(drvdata-desc.supply_name);
-err_name:
-   kfree(drvdata-desc.name);
-err:
-   return ret;
-}
-
-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);
-
-   return 0;
 }
 
 #if defined(CONFIG_OF)
@@ -229,7 +212,6 @@ MODULE_DEVICE_TABLE(of, fixed_of_match);
 
 static struct platform_driver regulator_fixed_voltage_driver = {
.probe  = reg_fixed_voltage_probe,
-   .remove = reg_fixed_voltage_remove,
.driver = {
.name   = reg-fixed-voltage,
.owner  = THIS_MODULE,
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V2] regulator: fixed: update to devm_* API

2014-01-27 Thread Manish Badarkhe
Hi Dmitry,

Thank you for your review.

On Tue, Jan 28, 2014 at 12:03 PM, Dmitry Torokhov
dmitry.torok...@gmail.com wrote:
 Hi Manish,

 On Tue, Jan 28, 2014 at 08:42:00AM +0530, Manish Badarkhe wrote:
 Update the code to use devm_* API so that driver core will manage
 resources.

 Signed-off-by: Manish Badarkhe badarkhe.man...@gmail.com
 ---
 Changes since V1:
 1. Updated driver to use devm_kzalloc to kstrdup.
 2. Updated commit message.

 Not tested on any board.

 :100644 100644 5ea64b9... e9763a4... Mdrivers/regulator/fixed.c
  drivers/regulator/fixed.c |   42 --
  1 file changed, 12 insertions(+), 30 deletions(-)

 diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
 index 5ea64b9..e9763a4 100644
 --- a/drivers/regulator/fixed.c
 +++ b/drivers/regulator/fixed.c
 @@ -132,15 +132,15 @@ static int reg_fixed_voltage_probe(struct 
 platform_device *pdev)
  GFP_KERNEL);
   if (drvdata == NULL) {
   dev_err(pdev-dev, Failed to allocate device data\n);
 - ret = -ENOMEM;
 - goto err;
 + return -ENOMEM;
   }

 - drvdata-desc.name = kstrdup(config-supply_name, GFP_KERNEL);
 + drvdata-desc.name = devm_kzalloc(pdev-dev,
 +   strlen(config-supply_name) + 1,
 +   GFP_KERNEL);
   if (drvdata-desc.name == NULL) {
   dev_err(pdev-dev, Failed to allocate supply name\n);
 - ret = -ENOMEM;
 - goto err;
 + return -ENOMEM;
   }

 Umm, I am fairly certain that devm_kzalloc() can't be used as a
 substitute for kstrdup, at least not without accompanying memcpy.

Yes, I have provided allocation but it should be followed with assignment.
Can I modify like this,

+ drvdata-desc.name = devm_kzalloc(pdev-dev,
+   strlen(config-supply_name) + 1,
+   GFP_KERNEL);
+ if (drvdata-desc.name)
+ sprintf(drvdata-desc.name, %s, config-supply_name);

Thanks
Manish Badakhe
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2] max8925_power: Use IS_ENABLED(CONFIG_OF) for DT code.

2014-01-26 Thread Manish Badarkhe
Instead of #ifdef CONFIG_OF use IS_ENABLED(CONFIG_OF)
option for DT code to avoid if-deffery in code.

Signed-off-by: Manish Badarkhe badarkhe.man...@gmail.com
---
Changes since V1:
1. update code to retrieve platform/dt data in same function

:100644 100644 b4513f2... 20a7100... M  drivers/power/max8925_power.c
 drivers/power/max8925_power.c |   15 ---
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/power/max8925_power.c b/drivers/power/max8925_power.c
index b4513f2..20a7100 100644
--- a/drivers/power/max8925_power.c
+++ b/drivers/power/max8925_power.c
@@ -427,9 +427,8 @@ static int max8925_deinit_charger(struct max8925_power_info 
*info)
return 0;
 }
 
-#ifdef CONFIG_OF
 static struct max8925_power_pdata *
-max8925_power_dt_init(struct platform_device *pdev)
+max8925_get_data(struct platform_device *pdev)
 {
struct device_node *nproot = pdev-dev.parent-of_node;
struct device_node *np;
@@ -440,7 +439,7 @@ max8925_power_dt_init(struct platform_device *pdev)
int no_insert_detect;
struct max8925_power_pdata *pdata;
 
-   if (!nproot)
+   if (!IS_ENABLED(CONFIG_OF) || !nproot)
return pdev-dev.platform_data;
 
np = of_find_node_by_name(nproot, charger);
@@ -468,13 +467,6 @@ max8925_power_dt_init(struct platform_device *pdev)
 
return pdata;
 }
-#else
-static struct max8925_power_pdata *
-max8925_power_dt_init(struct platform_device *pdev)
-{
-   return pdev-dev.platform_data;
-}
-#endif
 
 static int max8925_power_probe(struct platform_device *pdev)
 {
@@ -483,7 +475,8 @@ static int max8925_power_probe(struct platform_device *pdev)
struct max8925_power_info *info;
int ret;
 
-   pdata = max8925_power_dt_init(pdev);
+   pdata = max8925_get_data(pdev);
+
if (!pdata) {
dev_err(pdev-dev, platform data isn't assigned to 
power supply\n);
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/4] Regulators: TPS65218: Add Regulator driver for TPS65218 PMIC

2013-12-03 Thread Manish Badarkhe
Hi Keerthy,

 +   rdev = regulator_register(regulators[id], config);

Can you make use of devm_regulator_register instead?

 +   if (IS_ERR(rdev)) {
 +   dev_err(tps-dev, failed to register %s regulator\n,
 +   pdev-name);
 +   return PTR_ERR(rdev);
 +   }
 +
 +   /* Save regulator */
 +   tps-rdev[id] = rdev;
 +
 +   return 0;
 +}


Best Regards
Manish Badarkhe
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] PM/AVS: SmartReflex: fix fake probe success on debugfs fail

2013-10-16 Thread Manish Badarkhe
Hi Nishanth

On Wed, Oct 16, 2013 at 6:54 PM, Nishanth Menon n...@ti.com wrote:
 On 10/16/2013 06:40 AM, Vishwanathrao Badarkhe, Manish wrote:
 From: Vishwanathrao Badarkhe, Manish manish...@ti.com

 Currently, probe returns success(0) on debugfs_create_dir
 function call failed. Return proper error on debugfs_create_dir
 call failed.

 Signed-off-by: Vishwanathrao Badarkhe, Manish manish...@ti.com
 ---
 Not tested on any EVM. Bug has been found while doing static review.
 Please confirm.


 IMHO, fail of creation of debugfs is not reason enough to fail the
 probe - further, this code needs a major revamp to work with device tree.

Yes, fail of debugfs creation should not be enough reason to fail probe. But as
per current implementation of code, on debugfs failure smart reflex node is
getting deleted and probe get failed. This patch not made any changes in
logic of code but only makes proper use of  IS_ERR_OR_NULL.


 :100644 100644 db9973b... 7b101c1... Mdrivers/power/avs/smartreflex.c
  drivers/power/avs/smartreflex.c |6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

 diff --git a/drivers/power/avs/smartreflex.c 
 b/drivers/power/avs/smartreflex.c
 index db9973b..7b101c1 100644
 --- a/drivers/power/avs/smartreflex.c
 +++ b/drivers/power/avs/smartreflex.c
 @@ -921,7 +921,7 @@ static int __init omap_sr_probe(struct platform_device 
 *pdev)
   if (!sr_dbg_dir) {
   sr_dbg_dir = debugfs_create_dir(smartreflex, NULL);
   if (IS_ERR_OR_NULL(sr_dbg_dir)) {
 - ret = PTR_ERR(sr_dbg_dir);
 + ret = sr_dbg_dir ? PTR_ERR(sr_dbg_dir) : -EIO;
   pr_err(%s:sr debugfs dir creation failed(%d)\n,
   __func__, ret);
   goto err_list_del;
 @@ -932,7 +932,7 @@ static int __init omap_sr_probe(struct platform_device 
 *pdev)
   if (IS_ERR_OR_NULL(sr_info-dbg_dir)) {
   dev_err(pdev-dev, %s: Unable to create debugfs directory\n,
   __func__);
 - ret = PTR_ERR(sr_info-dbg_dir);
 + ret = sr_info-dbg_dir ? PTR_ERR(sr_info-dbg_dir) : -EIO;
   goto err_debugfs;
   }

 @@ -947,7 +947,7 @@ static int __init omap_sr_probe(struct platform_device 
 *pdev)
   if (IS_ERR_OR_NULL(nvalue_dir)) {
   dev_err(pdev-dev, %s: Unable to create debugfs directory
   for n-values\n, __func__);
 - ret = PTR_ERR(nvalue_dir);
 + ret = nvalue_dir ? PTR_ERR(nvalue_dir) : -EIO;
   goto err_debugfs;
   }


Regards
Manish Baarkhe
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V3] ARM: dts: add minimal DT support for DevKit8000

2013-02-20 Thread Manish Badarkhe
On Sat, Feb 16, 2013 at 12:49 PM, Anil Kumar anilk...@gmail.com wrote:
 DevKit8000 is a beagle board clone from Timll, sold by
 armkits.com. The DevKit8000 has RS232 serial port, LCD, DVI-D,
 S-Video, Ethernet, SD/MMC, keyboard, camera, SPI, I2C, USB and
 JTAG interface.

 This patch adds the basic DT support for devkit8000. At this time,
 Information
 of twl4030 (PMIC), MMC1, I2C1 and leds are added.

 Signed-off-by: Anil Kumar anilk...@gmail.com
 Tested-by: Thomas Weber tho...@tomweber.eu
 ---
  -This patch is based on top of kernel 3.8-rc5.

  -Tested on Devkit8000.

 For V3:
  - Remove pin mux as done at device boot time by default.

 For V2:
  - Change model name as TimLL OMAP3 Devkit8000
  - Change compatible as timll,omap3-devkit8000
  - Doing i2c1 pinmux default with pinctrl-single driver instead of i2c1
driver probe time.

 :100644 100644 5ebb44f... 22ebc76... M  arch/arm/boot/dts/Makefile
 :00 100644 000... 6338993... A
 arch/arm/boot/dts/omap3-devkit8000.dts
 :100644 100644 53cb380b.. ccecb76... M
 arch/arm/mach-omap2/board-generic.c
  arch/arm/boot/dts/Makefile |1 +
  arch/arm/boot/dts/omap3-devkit8000.dts |  103
 
  arch/arm/mach-omap2/board-generic.c|1 +
  3 files changed, 105 insertions(+), 0 deletions(-)

 diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
 index 5ebb44f..22ebc76 100644
 --- a/arch/arm/boot/dts/Makefile
 +++ b/arch/arm/boot/dts/Makefile
 @@ -102,6 +102,7 @@ dtb-$(CONFIG_ARCH_MXS) += imx23-evk.dtb \
 imx28-tx28.dtb
  dtb-$(CONFIG_ARCH_OMAP2PLUS) += omap2420-h4.dtb \
 omap3-beagle.dtb \
 +   omap3-devkit8000.dtb \
 omap3-beagle-xm.dtb \
 omap3-evm.dtb \
 omap3-tobi.dtb \
 diff --git a/arch/arm/boot/dts/omap3-devkit8000.dts
 b/arch/arm/boot/dts/omap3-devkit8000.dts
 new file mode 100644
 index 000..6338993
 --- /dev/null
 +++ b/arch/arm/boot/dts/omap3-devkit8000.dts
 @@ -0,0 +1,103 @@
 +/*
 + * Author: Anil Kumar anilk...@gmail.com
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * published by the Free Software Foundation.
 + */
 +/dts-v1/;
 +
 +/include/ omap3.dtsi
 +/ {
 +   model = TimLL OMAP3 Devkit8000;
 +   compatible = timll,omap3-devkit8000, ti,omap3;
 +
 +   memory {
 +   device_type = memory;
 +   reg = 0x8000 0x1000;  /* 256 MB */
 +   };
 +
 +   leds {
 +   compatible = gpio-leds;
 +
 +   heartbeat {
 +   label = devkit8000::led1;
 +   gpios = gpio6 26 0;  /* 186 - LED1 */
 +   default-state = on;
 +   linux,default-trigger = heartbeat;
 +   };
 +
 +   mmc {
 +   label = devkit8000::led2;
 +   gpios = gpio6 3 0;   /* 163 - LED2 */
 +   default-state = on;
 +   linux,default-trigger = none;
 +   };
 +
 +   usr {
 +   label = devkit8000::led3;
 +   gpios = gpio6 4 0;   /* 164 - LED3 */
 +   default-state = on;
 +   linux,default-trigger = usr;
 +};
 +

No need of extra line over here.

Thanks
Manish Badarkhe
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V4] ARM: dts: add minimal DT support for DevKit8000

2013-02-20 Thread Manish Badarkhe
Hi Anil

On Wed, Feb 20, 2013 at 7:14 PM, Anil Kumar anilk...@gmail.com wrote:
 DevKit8000 is a beagle board clone from Timll, sold by
 armkits.com. The DevKit8000 has RS232 serial port, LCD, DVI-D,
 S-Video, Ethernet, SD/MMC, keyboard, camera, SPI, I2C, USB and
 JTAG interface.

 This patch adds the basic DT support for devkit8000. At this time, Information
 of twl4030 (PMIC), MMC1, I2C1 and leds are added.

 Signed-off-by: Anil Kumar anilk...@gmail.com
 Tested-by: Thomas Weber tho...@tomweber.eu
 ---
  -This patch is based on top of kernel 3.8-rc5.

  -Tested on Devkit8000.

 For V4:
  -Tiny nitpick.

 For V3:
  - Remove pin mux as done at device boot time by default.

 For V2:
  - Change model name as TimLL OMAP3 Devkit8000
  - Change compatible as timll,omap3-devkit8000
  - Doing i2c1 pinmux default with pinctrl-single driver instead of i2c1
driver probe time.

 :100644 100644 5ebb44f... 22ebc76... M  arch/arm/boot/dts/Makefile
 :00 100644 000... 2e1463a... A  arch/arm/boot/dts/omap3-devkit8000.dts
 :100644 100644 53cb380b.. ccecb76... M  arch/arm/mach-omap2/board-generic.c
  arch/arm/boot/dts/Makefile |1 +
  arch/arm/boot/dts/omap3-devkit8000.dts |  102 
 
  arch/arm/mach-omap2/board-generic.c|1 +
  3 files changed, 104 insertions(+), 0 deletions(-)

 diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
 index 5ebb44f..22ebc76 100644
 --- a/arch/arm/boot/dts/Makefile
 +++ b/arch/arm/boot/dts/Makefile
 @@ -102,6 +102,7 @@ dtb-$(CONFIG_ARCH_MXS) += imx23-evk.dtb \
 imx28-tx28.dtb
  dtb-$(CONFIG_ARCH_OMAP2PLUS) += omap2420-h4.dtb \
 omap3-beagle.dtb \
 +   omap3-devkit8000.dtb \
 omap3-beagle-xm.dtb \
 omap3-evm.dtb \
 omap3-tobi.dtb \
 diff --git a/arch/arm/boot/dts/omap3-devkit8000.dts 
 b/arch/arm/boot/dts/omap3-devkit8000.dts
 new file mode 100644
 index 000..2e1463a
 --- /dev/null
 +++ b/arch/arm/boot/dts/omap3-devkit8000.dts
 @@ -0,0 +1,102 @@
 +/*
 + * Author: Anil Kumar anilk...@gmail.com
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * published by the Free Software Foundation.
 + */
 +/dts-v1/;
 +
 +/include/ omap3.dtsi
 +/ {
 +   model = TimLL OMAP3 Devkit8000;
 +   compatible = timll,omap3-devkit8000, ti,omap3;
 +
 +   memory {
 +   device_type = memory;
 +   reg = 0x8000 0x1000;  /* 256 MB */
 +   };
 +
 +   leds {
 +   compatible = gpio-leds;
 +
 +   heartbeat {
 +   label = devkit8000::led1;
 +   gpios = gpio6 26 0;  /* 186 - LED1 */
 +   default-state = on;
 +   linux,default-trigger = heartbeat;
 +   };
 +
 +   mmc {
 +   label = devkit8000::led2;
 +   gpios = gpio6 3 0;   /* 163 - LED2 */
 +   default-state = on;
 +   linux,default-trigger = none;
 +   };
 +
 +   usr {
 +   label = devkit8000::led3;
 +   gpios = gpio6 4 0;   /* 164 - LED3 */
 +   default-state = on;
 +   linux,default-trigger = usr;
 +};
 +   };
 +};
 +
 +i2c1 {
 +   clock-frequency = 260;
 +
 +   twl: twl@48 {
 +   reg = 0x48;
 +   interrupts = 7;   /* SYS_NIRQ cascaded to intc */
 +   interrupt-parent = intc;
 +   };
 +};
 +
 +i2c2 {
 +   status = disabled;
 +};
 +
 +i2c3 {
 +   status = disabled;
 +};
 +
 +/include/ twl4030.dtsi
 +
 +mmc1 {
 +   vmmc-supply = vmmc1;
 +   vmmc_aux-supply = vsim;
 +   bus-width = 8;
 +};
 +
 +mmc2 {
 +   status = disabled;
 +};
 +
 +mmc3 {
 +   status = disabled;
 +};
 +
 +wdt2 {
 +   status = disabled;
 +};
 +
 +mcbsp1 {
 +   status = disabled;
 +};
 +
 +mcbsp2 {
 +   status = disabled;
 +};
 +
 +mcbsp3 {
 +   status = disabled;
 +};
 +
 +mcbsp4 {
 +   status = disabled;
 +};
 +
 +mcbsp5 {
 +   status = disabled;
 +};
 diff --git a/arch/arm/mach-omap2/board-generic.c 
 b/arch/arm/mach-omap2/board-generic.c
 index 53cb380..ccecb76 100644
 --- a/arch/arm/mach-omap2/board-generic.c
 +++ b/arch/arm/mach-omap2/board-generic.c
 @@ -110,6 +110,7 @@ MACHINE_END

  static const char *omap3_gp_boards_compat[] __initdata = {
 ti,omap3-beagle,
 +   timll,omap3-devkit8000,
 NULL,
  };


Looks good to me.
Reviewed-by: Manish Badarkhe badarkhe.man...@gmail.com

Thanks
Manish Badarkhe
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html