public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@gmail.com>
To: Thierry Reding <thierry.reding@avionic-design.de>
Cc: linux-kernel@vger.kernel.org, Ben Dooks <ben-linux@fluff.org>
Subject: [PATCH 3/4] pwm: Convert pwm-samsung to use devm_* APIs
Date: Fri, 29 Jun 2012 21:32:15 +0800	[thread overview]
Message-ID: <1340976735.4752.2.camel@phoenix> (raw)
In-Reply-To: <1340976628.4752.0.camel@phoenix>

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/pwm/pwm-samsung.c |   24 ++++++------------------
 1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c
index c40c37e..35fa0e8 100644
--- a/drivers/pwm/pwm-samsung.c
+++ b/drivers/pwm/pwm-samsung.c
@@ -1,4 +1,4 @@
-/* arch/arm/plat-s3c/pwm.c
+/* drivers/pwm/pwm-samsung.c
  *
  * Copyright (c) 2007 Ben Dooks
  * Copyright (c) 2008 Simtec Electronics
@@ -215,7 +215,7 @@ static int s3c_pwm_probe(struct platform_device *pdev)
 		return -ENXIO;
 	}
 
-	s3c = kzalloc(sizeof(*s3c), GFP_KERNEL);
+	s3c = devm_kzalloc(&pdev->dev, sizeof(*s3c), GFP_KERNEL);
 	if (s3c == NULL) {
 		dev_err(dev, "failed to allocate pwm_device\n");
 		return -ENOMEM;
@@ -227,18 +227,16 @@ static int s3c_pwm_probe(struct platform_device *pdev)
 	s3c->chip.base = -1;
 	s3c->chip.npwm = 1;
 
-	s3c->clk = clk_get(dev, "pwm-tin");
+	s3c->clk = devm_clk_get(dev, "pwm-tin");
 	if (IS_ERR(s3c->clk)) {
 		dev_err(dev, "failed to get pwm tin clk\n");
-		ret = PTR_ERR(s3c->clk);
-		goto err_alloc;
+		return PTR_ERR(s3c->clk);
 	}
 
-	s3c->clk_div = clk_get(dev, "pwm-tdiv");
+	s3c->clk_div = devm_clk_get(dev, "pwm-tdiv");
 	if (IS_ERR(s3c->clk_div)) {
 		dev_err(dev, "failed to get pwm tdiv clk\n");
-		ret = PTR_ERR(s3c->clk_div);
-		goto err_clk_tin;
+		return PTR_ERR(s3c->clk_div);
 	}
 
 	clk_enable(s3c->clk);
@@ -272,13 +270,6 @@ static int s3c_pwm_probe(struct platform_device *pdev)
  err_clk_tdiv:
 	clk_disable(s3c->clk_div);
 	clk_disable(s3c->clk);
-	clk_put(s3c->clk_div);
-
- err_clk_tin:
-	clk_put(s3c->clk);
-
- err_alloc:
-	kfree(s3c);
 	return ret;
 }
 
@@ -293,9 +284,6 @@ static int __devexit s3c_pwm_remove(struct platform_device *pdev)
 
 	clk_disable(s3c->clk_div);
 	clk_disable(s3c->clk);
-	clk_put(s3c->clk_div);
-	clk_put(s3c->clk);
-	kfree(s3c);
 
 	return 0;
 }
-- 
1.7.9.5




  parent reply	other threads:[~2012-06-29 13:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-29 13:30 [PATCH 1/4] pwm: Convert pwm-imx to use devm_* APIs Axel Lin
2012-06-29 13:31 ` [PATCH 2/4] pwm: Convert pwm-pxa " Axel Lin
2012-06-30 19:38   ` Thierry Reding
2012-06-29 13:32 ` Axel Lin [this message]
2012-07-02 20:57   ` [PATCH 3/4] pwm: Convert pwm-samsung " Thierry Reding
2012-06-29 13:33 ` [PATCH 4/4] pwm: Convert pwm-vt8500 " Axel Lin
2012-06-30 19:45   ` Thierry Reding
2012-06-30 18:43 ` [PATCH 1/4] pwm: Convert pwm-imx " Thierry Reding

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1340976735.4752.2.camel@phoenix \
    --to=axel.lin@gmail.com \
    --cc=ben-linux@fluff.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thierry.reding@avionic-design.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox