linux-pwm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH resend 1/2] pwm: jz4740: Pass device to clk_get()
@ 2013-12-07 17:13 Lars-Peter Clausen
  2013-12-07 17:13 ` [PATCH resend 2/2] pwm: jz4740: Use devm_clk_get() Lars-Peter Clausen
  2013-12-12 12:34 ` [PATCH resend 1/2] pwm: jz4740: Pass device to clk_get() Thierry Reding
  0 siblings, 2 replies; 4+ messages in thread
From: Lars-Peter Clausen @ 2013-12-07 17:13 UTC (permalink / raw)
  To: Thierry Reding; +Cc: linux-pwm, linux-kernel, Lars-Peter Clausen

In preparation to switching the jz4740 clk driver to the common clk framework
make sure to pass the device to clk_get().

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/pwm/pwm-jz4740.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pwm/pwm-jz4740.c b/drivers/pwm/pwm-jz4740.c
index 0a2ede3..a44d890 100644
--- a/drivers/pwm/pwm-jz4740.c
+++ b/drivers/pwm/pwm-jz4740.c
@@ -171,7 +171,7 @@ static int jz4740_pwm_probe(struct platform_device *pdev)
 	if (!jz4740)
 		return -ENOMEM;
 
-	jz4740->clk = clk_get(NULL, "ext");
+	jz4740->clk = clk_get(&pdev->dev, "ext");
 	if (IS_ERR(jz4740->clk))
 		return PTR_ERR(jz4740->clk);
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH resend 2/2] pwm: jz4740: Use devm_clk_get()
  2013-12-07 17:13 [PATCH resend 1/2] pwm: jz4740: Pass device to clk_get() Lars-Peter Clausen
@ 2013-12-07 17:13 ` Lars-Peter Clausen
  2013-12-12 12:35   ` Thierry Reding
  2013-12-12 12:34 ` [PATCH resend 1/2] pwm: jz4740: Pass device to clk_get() Thierry Reding
  1 sibling, 1 reply; 4+ messages in thread
From: Lars-Peter Clausen @ 2013-12-07 17:13 UTC (permalink / raw)
  To: Thierry Reding; +Cc: linux-pwm, linux-kernel, Lars-Peter Clausen

Using the managed version of clk_get() makes the code a bit shorter and the
error paths less complicated.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/pwm/pwm-jz4740.c |   20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

diff --git a/drivers/pwm/pwm-jz4740.c b/drivers/pwm/pwm-jz4740.c
index a44d890..9c46209 100644
--- a/drivers/pwm/pwm-jz4740.c
+++ b/drivers/pwm/pwm-jz4740.c
@@ -165,13 +165,12 @@ static const struct pwm_ops jz4740_pwm_ops = {
 static int jz4740_pwm_probe(struct platform_device *pdev)
 {
 	struct jz4740_pwm_chip *jz4740;
-	int ret;
 
 	jz4740 = devm_kzalloc(&pdev->dev, sizeof(*jz4740), GFP_KERNEL);
 	if (!jz4740)
 		return -ENOMEM;
 
-	jz4740->clk = clk_get(&pdev->dev, "ext");
+	jz4740->clk = devm_clk_get(&pdev->dev, "ext");
 	if (IS_ERR(jz4740->clk))
 		return PTR_ERR(jz4740->clk);
 
@@ -180,29 +179,16 @@ static int jz4740_pwm_probe(struct platform_device *pdev)
 	jz4740->chip.npwm = NUM_PWM;
 	jz4740->chip.base = -1;
 
-	ret = pwmchip_add(&jz4740->chip);
-	if (ret < 0) {
-		clk_put(jz4740->clk);
-		return ret;
-	}
-
 	platform_set_drvdata(pdev, jz4740);
 
-	return 0;
+	return pwmchip_add(&jz4740->chip);
 }
 
 static int jz4740_pwm_remove(struct platform_device *pdev)
 {
 	struct jz4740_pwm_chip *jz4740 = platform_get_drvdata(pdev);
-	int ret;
-
-	ret = pwmchip_remove(&jz4740->chip);
-	if (ret < 0)
-		return ret;
 
-	clk_put(jz4740->clk);
-
-	return 0;
+	return pwmchip_remove(&jz4740->chip);
 }
 
 static struct platform_driver jz4740_pwm_driver = {
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH resend 1/2] pwm: jz4740: Pass device to clk_get()
  2013-12-07 17:13 [PATCH resend 1/2] pwm: jz4740: Pass device to clk_get() Lars-Peter Clausen
  2013-12-07 17:13 ` [PATCH resend 2/2] pwm: jz4740: Use devm_clk_get() Lars-Peter Clausen
@ 2013-12-12 12:34 ` Thierry Reding
  1 sibling, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2013-12-12 12:34 UTC (permalink / raw)
  To: Lars-Peter Clausen; +Cc: linux-pwm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 382 bytes --]

On Sat, Dec 07, 2013 at 06:13:15PM +0100, Lars-Peter Clausen wrote:
> In preparation to switching the jz4740 clk driver to the common clk framework
> make sure to pass the device to clk_get().
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> ---
>  drivers/pwm/pwm-jz4740.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH resend 2/2] pwm: jz4740: Use devm_clk_get()
  2013-12-07 17:13 ` [PATCH resend 2/2] pwm: jz4740: Use devm_clk_get() Lars-Peter Clausen
@ 2013-12-12 12:35   ` Thierry Reding
  0 siblings, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2013-12-12 12:35 UTC (permalink / raw)
  To: Lars-Peter Clausen; +Cc: linux-pwm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 388 bytes --]

On Sat, Dec 07, 2013 at 06:13:16PM +0100, Lars-Peter Clausen wrote:
> Using the managed version of clk_get() makes the code a bit shorter and the
> error paths less complicated.
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> ---
>  drivers/pwm/pwm-jz4740.c |   20 +++-----------------
>  1 file changed, 3 insertions(+), 17 deletions(-)

Applied, thanks.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-12-12 12:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-07 17:13 [PATCH resend 1/2] pwm: jz4740: Pass device to clk_get() Lars-Peter Clausen
2013-12-07 17:13 ` [PATCH resend 2/2] pwm: jz4740: Use devm_clk_get() Lars-Peter Clausen
2013-12-12 12:35   ` Thierry Reding
2013-12-12 12:34 ` [PATCH resend 1/2] pwm: jz4740: Pass device to clk_get() Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).