Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1314023 > unrolled thread

[PATCH] staging: iio: replace clk_get() with devm_clk_get()

Started by"Gujulan Elango, Hari Prasath (H.)" <hgujulan@visteon.com>
First post2016-01-21 10:30 +0100
Last post2016-01-22 10:10 +0100
Articles 6 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] staging: iio: replace clk_get() with devm_clk_get() "Gujulan Elango, Hari Prasath (H.)" <hgujulan@visteon.com> - 2016-01-21 10:30 +0100
    Re: [PATCH] staging: iio: replace clk_get() with devm_clk_get() Dan Carpenter <dan.carpenter@oracle.com> - 2016-01-21 10:50 +0100
      Re: [PATCH] staging: iio: replace clk_get() with devm_clk_get() "Gujulan Elango, Hari Prasath (H.)" <hgujulan@visteon.com> - 2016-01-21 11:00 +0100
    Re: [PATCH] staging: iio: replace clk_get() with devm_clk_get() Matt Ranostay <mranostay@gmail.com> - 2016-01-21 20:30 +0100
      Re: [PATCH] staging: iio: replace clk_get() with devm_clk_get() Dan Carpenter <dan.carpenter@oracle.com> - 2016-01-21 20:50 +0100
      Re: [PATCH] staging: iio: replace clk_get() with devm_clk_get() "Gujulan Elango, Hari Prasath (H.)" <hgujulan@visteon.com> - 2016-01-22 10:10 +0100

#1314023 — [PATCH] staging: iio: replace clk_get() with devm_clk_get()

From"Gujulan Elango, Hari Prasath (H.)" <hgujulan@visteon.com>
Date2016-01-21 10:30 +0100
Subject[PATCH] staging: iio: replace clk_get() with devm_clk_get()
Message-ID<qTjIZ-3ho-1@gated-at.bofh.it>
From: Hari Prasath Gujulan Elango

This patch replaces the clk_get() with devm_clk_get().
Accordingly,modified the error paths and removed clk_put() as well.

Signed-off-by: Hari Prasath Gujulan Elango <hgujulan@visteon.com>
---
 drivers/staging/iio/adc/spear_adc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/iio/adc/spear_adc.c b/drivers/staging/iio/adc/spear_adc.c
index 712cae0..4ac0f54 100644
--- a/drivers/staging/iio/adc/spear_adc.c
+++ b/drivers/staging/iio/adc/spear_adc.c
@@ -288,7 +288,7 @@ static int spear_adc_probe(struct platform_device *pdev)
 	st->adc_base_spear3xx =
 		(struct adc_regs_spear3xx __iomem *)st->adc_base_spear6xx;
 
-	st->clk = clk_get(dev, NULL);
+	st->clk = devm_clk_get(dev, NULL);
 	if (IS_ERR(st->clk)) {
 		dev_err(dev, "failed getting clock\n");
 		goto errout1;
@@ -297,7 +297,7 @@ static int spear_adc_probe(struct platform_device *pdev)
 	ret = clk_prepare_enable(st->clk);
 	if (ret) {
 		dev_err(dev, "failed enabling clock\n");
-		goto errout2;
+		goto errout1;
 	}
 
 	irq = platform_get_irq(pdev, 0);
@@ -356,8 +356,6 @@ static int spear_adc_probe(struct platform_device *pdev)
 
 errout3:
 	clk_disable_unprepare(st->clk);
-errout2:
-	clk_put(st->clk);
 errout1:
 	iounmap(st->adc_base_spear6xx);
 	return ret;
-- 
1.9.1

[toc] | [next] | [standalone]


#1314049

FromDan Carpenter <dan.carpenter@oracle.com>
Date2016-01-21 10:50 +0100
Message-ID<qTk2n-3oR-43@gated-at.bofh.it>
In reply to#1314023
On Thu, Jan 21, 2016 at 09:11:38AM +0000, Gujulan Elango, Hari Prasath (H.) wrote:
> From: Hari Prasath Gujulan Elango
> 

Your email address is missing here.

regards,
dan carpenter

[toc] | [prev] | [next] | [standalone]


#1314053

From"Gujulan Elango, Hari Prasath (H.)" <hgujulan@visteon.com>
Date2016-01-21 11:00 +0100
Message-ID<qTkc2-3tc-3@gated-at.bofh.it>
In reply to#1314049
On Thu, Jan 21, 2016 at 12:45:59PM +0300, Dan Carpenter wrote:
> On Thu, Jan 21, 2016 at 09:11:38AM +0000, Gujulan Elango, Hari Prasath (H.) wrote:
> > From: Hari Prasath Gujulan Elango
> > 
> 
> Your email address is missing here.
Hello Dan,
Many thanks for notifying.I am sending a v2.

regards,
Hari Prasath

> 
> regards,
> dan carpenter
> 

[toc] | [prev] | [next] | [standalone]


#1314445

FromMatt Ranostay <mranostay@gmail.com>
Date2016-01-21 20:30 +0100
Message-ID<qTt5F-1hZ-21@gated-at.bofh.it>
In reply to#1314023
On Thu, Jan 21, 2016 at 1:11 AM, Gujulan Elango, Hari Prasath (H.)
<hgujulan@visteon.com> wrote:
> From: Hari Prasath Gujulan Elango
>
> This patch replaces the clk_get() with devm_clk_get().
> Accordingly,modified the error paths and removed clk_put() as well.
>
> Signed-off-by: Hari Prasath Gujulan Elango <hgujulan@visteon.com>
> ---
>  drivers/staging/iio/adc/spear_adc.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/iio/adc/spear_adc.c b/drivers/staging/iio/adc/spear_adc.c
> index 712cae0..4ac0f54 100644
> --- a/drivers/staging/iio/adc/spear_adc.c
> +++ b/drivers/staging/iio/adc/spear_adc.c
> @@ -288,7 +288,7 @@ static int spear_adc_probe(struct platform_device *pdev)
>         st->adc_base_spear3xx =
>                 (struct adc_regs_spear3xx __iomem *)st->adc_base_spear6xx;
>
> -       st->clk = clk_get(dev, NULL);
> +       st->clk = devm_clk_get(dev, NULL);
>         if (IS_ERR(st->clk)) {
>                 dev_err(dev, "failed getting clock\n");
>                 goto errout1;
> @@ -297,7 +297,7 @@ static int spear_adc_probe(struct platform_device *pdev)
>         ret = clk_prepare_enable(st->clk);
>         if (ret) {
>                 dev_err(dev, "failed enabling clock\n");
> -               goto errout2;
> +               goto errout1;
>         }
>
>         irq = platform_get_irq(pdev, 0);
> @@ -356,8 +356,6 @@ static int spear_adc_probe(struct platform_device *pdev)
>
>  errout3:
>         clk_disable_unprepare(st->clk);

Shouldn't errout3 now be errout2.. having a gap would seem odd.

> -errout2:
> -       clk_put(st->clk);
>  errout1:
>         iounmap(st->adc_base_spear6xx);
>         return ret;
> --
> 1.9.1

[toc] | [prev] | [next] | [standalone]


#1314466

FromDan Carpenter <dan.carpenter@oracle.com>
Date2016-01-21 20:50 +0100
Message-ID<qTtp0-1qg-3@gated-at.bofh.it>
In reply to#1314445
On Thu, Jan 21, 2016 at 11:21:53AM -0800, Matt Ranostay wrote:
> > @@ -356,8 +356,6 @@ static int spear_adc_probe(struct platform_device *pdev)
> >
> >  errout3:
> >         clk_disable_unprepare(st->clk);
> 
> Shouldn't errout3 now be errout2.. having a gap would seem odd.
> 
> > -errout2:
> > -       clk_put(st->clk);
> >  errout1:
> >         iounmap(st->adc_base_spear6xx);

GW-BASIC style numbered gotos are nonsense.  Label names should be name
after what the label does.

err_unprepare:
err_put:
err_iounmap:

But that's something for a different patch, not related to this patch.

regards,
dan carpenter

[toc] | [prev] | [next] | [standalone]


#1314838

From"Gujulan Elango, Hari Prasath (H.)" <hgujulan@visteon.com>
Date2016-01-22 10:10 +0100
Message-ID<qTFTc-1Xj-25@gated-at.bofh.it>
In reply to#1314445
On Thu, Jan 21, 2016 at 11:21:53AM -0800, Matt Ranostay wrote:
> On Thu, Jan 21, 2016 at 1:11 AM, Gujulan Elango, Hari Prasath (H.)
> <hgujulan@visteon.com> wrote:
> > From: Hari Prasath Gujulan Elango
> >
> > This patch replaces the clk_get() with devm_clk_get().
> > Accordingly,modified the error paths and removed clk_put() as well.
> >
> > Signed-off-by: Hari Prasath Gujulan Elango <hgujulan@visteon.com>
> > ---
> >  drivers/staging/iio/adc/spear_adc.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/staging/iio/adc/spear_adc.c b/drivers/staging/iio/adc/spear_adc.c
> > index 712cae0..4ac0f54 100644
> > --- a/drivers/staging/iio/adc/spear_adc.c
> > +++ b/drivers/staging/iio/adc/spear_adc.c
> > @@ -288,7 +288,7 @@ static int spear_adc_probe(struct platform_device *pdev)
> >         st->adc_base_spear3xx =
> >                 (struct adc_regs_spear3xx __iomem *)st->adc_base_spear6xx;
> >
> > -       st->clk = clk_get(dev, NULL);
> > +       st->clk = devm_clk_get(dev, NULL);
> >         if (IS_ERR(st->clk)) {
> >                 dev_err(dev, "failed getting clock\n");
> >                 goto errout1;
> > @@ -297,7 +297,7 @@ static int spear_adc_probe(struct platform_device *pdev)
> >         ret = clk_prepare_enable(st->clk);
> >         if (ret) {
> >                 dev_err(dev, "failed enabling clock\n");
> > -               goto errout2;
> > +               goto errout1;
> >         }
> >
> >         irq = platform_get_irq(pdev, 0);
> > @@ -356,8 +356,6 @@ static int spear_adc_probe(struct platform_device *pdev)
> >
> >  errout3:
> >         clk_disable_unprepare(st->clk);
> 
> Shouldn't errout3 now be errout2.. having a gap would seem odd.
> 
I agree with you on this. But as Dan says,I would correct it in a
different patch.
> > -errout2:
> > -       clk_put(st->clk);
> >  errout1:
> >         iounmap(st->adc_base_spear6xx);
> >         return ret;
> > --
> > 1.9.1

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web