Skip to contentSkip to conversation

staging: iio: replace clk_get() with devm_clk_get()

PATCH Superseded Gujulan Elango, Hari Prasath (H.) 3 participants 6 messages Jan 21, 2016 – Jan 22, 2016

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: iio: replace clk_get() with devm_clk_get()

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.

---
 drivers/staging/iio/adc/spear_adc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/iio/adc/spear_adc.c +2 -4
index 712cae0..4ac0f54 100644
@@ -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;
Signature · 1 line
1.9.1
#1 lore raw
Quoted 2 lines · Hari Prasath (H.)

From: Hari Prasath Gujulan Elango

Your email address is missing here.

regards,
dan carpenter

#2 lore raw
Quoted 1 line · Dan Carpenter

On Thu, Jan 21, 2016 at 09:11:38AM +0000, Gujulan Elango, Hari Prasath (H=

Quoted 4 lines · .)
Quoted 2 lines

From: Hari Prasath Gujulan Elango
=20

=20
Your email address is missing here.

Hello Dan,
Many thanks for notifying.I am sending a v2.

regards,
Hari Prasath

Quoted 4 lines

=20
regards,
dan carpenter
=

#3 lore raw
In reply to Gujulan Elango, Hari Prasath (H.)
Quoted 33 lines · Hari Prasath (H.)

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.

---
 drivers/staging/iio/adc/spear_adc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/iio/adc/spear_adc.c +2 -2
index 712cae0..4ac0f54 100644
@@ -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);

drivers/staging/iio/adc/spear_adc.c static int spear_adc_probe(struct platform_device *pdev) · line 358

Quoted 3 lines
drivers/staging/iio/adc/spear_adc.c +0 -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.

Quoted 7 lines
drivers/staging/iio/adc/spear_adc.c +0 -3
-errout2:
-       clk_put(st->clk);
 errout1:
        iounmap(st->adc_base_spear6xx);
        return ret;
--

1.9.1

#4 lore raw
Quoted 11 lines · Matt Ranostay

drivers/staging/iio/adc/spear_adc.c static int spear_adc_probe(struct platform_device *pdev) · line 358

Quoted 4 lines
drivers/staging/iio/adc/spear_adc.c +0 -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.

Quoted 4 lines
drivers/staging/iio/adc/spear_adc.c +0 -2
-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

#5 lore raw
In reply to Matt Ranostay
Quoted 7 lines · Matt Ranostay
Quoted 5 lines · Hari Prasath (H.)

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.

Quoted 6 lines

drivers/staging/iio/=

Quoted 6 lines
---
 drivers/staging/iio/adc/spear_adc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/iio/= renamed from drivers/staging/iio/adc/spear_adc.c +0 -0

adc/spear_adc.c

Quoted 4 lines

drivers/staging/iio/adc/spear_adc.c static int spear_adc_probe(struct platform_device *=

Quoted 4 lines

index 712cae0..4ac0f54 100644

drivers/staging/iio/adc/spear_adc.c +0 -0
@@ -288,7 +288,7 @@ static int spear_adc_probe(struct platform_device *=

pdev)

Quoted 2 lines

drivers/staging/iio/adc/spear_adc.c static int spear_adc_probe(struct platform_device *= · line 289

Quoted 2 lines
drivers/staging/iio/adc/spear_adc.c +0 -0
        st->adc_base_spear3xx =3D
                (struct adc_regs_spear3xx __iomem *)st->adc_base_spear6=

xx;

Quoted 7 lines

drivers/staging/iio/adc/spear_adc.c static int spear_adc_probe(struct platform_device *=

Quoted 7 lines
drivers/staging/iio/adc/spear_adc.c +1 -1
-       st->clk =3D clk_get(dev, NULL);
+       st->clk =3D 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)

Quoted 9 lines

drivers/staging/iio/adc/spear_adc.c static int spear_adc_probe(struct platform_device *=

Quoted 9 lines
drivers/staging/iio/adc/spear_adc.c +1 -1
        ret =3D clk_prepare_enable(st->clk);
        if (ret) {
                dev_err(dev, "failed enabling clock\n");
-               goto errout2;
+               goto errout1;
        }
 
        irq =3D platform_get_irq(pdev, 0);
@@ -356,8 +356,6 @@ static int spear_adc_probe(struct platform_device *=

pdev)

Quoted 6 lines

drivers/staging/iio/adc/spear_adc.c static int spear_adc_probe(struct platform_device *pdev) · line 358

Quoted 3 lines
drivers/staging/iio/adc/spear_adc.c +0 -0
 errout3:
        clk_disable_unprepare(st->clk);

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

I agree with you on this. But as Dan says,I would correct it in a different patch.

Quoted 7 lines
Quoted 7 lines
drivers/staging/iio/adc/spear_adc.c +0 -3
-errout2:
-       clk_put(st->clk);
 errout1:
        iounmap(st->adc_base_spear6xx);
        return ret;
--

1.9.1=