linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] clk: wm831x: Use devm_clk_register() to simplify code
Date: Tue, 18 Sep 2012 23:05:30 -0700	[thread overview]
Message-ID: <1348034730-16473-4-git-send-email-sboyd@codeaurora.org> (raw)
In-Reply-To: <1348034730-16473-1-git-send-email-sboyd@codeaurora.org>

Move this driver to use devm_clk_register() to simplify some
error paths and reduce lines of code.

Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 drivers/clk/clk-wm831x.c | 30 +++++++-----------------------
 1 file changed, 7 insertions(+), 23 deletions(-)

diff --git a/drivers/clk/clk-wm831x.c b/drivers/clk/clk-wm831x.c
index eb1afaf..db4fbf2 100644
--- a/drivers/clk/clk-wm831x.c
+++ b/drivers/clk/clk-wm831x.c
@@ -370,43 +370,27 @@ static __devinit int wm831x_clk_probe(struct platform_device *pdev)
 	clkdata->xtal_ena = ret & WM831X_XTAL_ENA;
 
 	clkdata->xtal_hw.init = &wm831x_xtal_init;
-	clkdata->xtal = clk_register(&pdev->dev, &clkdata->xtal_hw);
+	clkdata->xtal = devm_clk_register(&pdev->dev, &clkdata->xtal_hw);
 	if (IS_ERR(clkdata->xtal))
 		return PTR_ERR(clkdata->xtal);
 
 	clkdata->fll_hw.init = &wm831x_fll_init;
-	clkdata->fll = clk_register(&pdev->dev, &clkdata->fll_hw);
-	if (IS_ERR(clkdata->fll)) {
-		ret = PTR_ERR(clkdata->fll);
-		goto err_xtal;
-	}
+	clkdata->fll = devm_clk_register(&pdev->dev, &clkdata->fll_hw);
+	if (IS_ERR(clkdata->fll))
+		return PTR_ERR(clkdata->fll);
 
 	clkdata->clkout_hw.init = &wm831x_clkout_init;
-	clkdata->clkout = clk_register(&pdev->dev, &clkdata->clkout_hw);
-	if (IS_ERR(clkdata->clkout)) {
-		ret = PTR_ERR(clkdata->clkout);
-		goto err_fll;
-	}
+	clkdata->clkout = devm_clk_register(&pdev->dev, &clkdata->clkout_hw);
+	if (IS_ERR(clkdata->clkout))
+		return PTR_ERR(clkdata->clkout);
 
 	dev_set_drvdata(&pdev->dev, clkdata);
 
 	return 0;
-
-err_fll:
-	clk_unregister(clkdata->fll);
-err_xtal:
-	clk_unregister(clkdata->xtal);
-	return ret;
 }
 
 static int __devexit wm831x_clk_remove(struct platform_device *pdev)
 {
-	struct wm831x_clk *clkdata = dev_get_drvdata(&pdev->dev);
-
-	clk_unregister(clkdata->clkout);
-	clk_unregister(clkdata->fll);
-	clk_unregister(clkdata->xtal);
-
 	return 0;
 }
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

  parent reply	other threads:[~2012-09-19  6:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-19  6:05 [PATCH 0/3] Introduce devm_clk_register() Stephen Boyd
2012-09-19  6:05 ` [PATCH 1/3] clk: wm831x: Fix clk_register() error code checking Stephen Boyd
2012-09-20  1:31   ` Mark Brown
2012-09-19  6:05 ` [PATCH 2/3] clk: Add devm_clk_{register,unregister}() Stephen Boyd
2012-09-21  2:33   ` Stephen Boyd
2012-09-22  1:07     ` Mike Turquette
2012-09-22  7:20       ` Stephen Boyd
2012-09-19  6:05 ` Stephen Boyd [this message]
2012-09-20  1:40   ` [PATCH 3/3] clk: wm831x: Use devm_clk_register() to simplify code Mark Brown
2012-09-22 10:06 ` [PATCH 0/3] Introduce devm_clk_register() Russell King - ARM Linux
2012-09-24 20:20   ` Stephen Boyd
2012-09-24 20:35     ` Russell King - ARM Linux
2012-09-24 20:38 ` [PATCHv2 1/3] clk: wm831x: Fix clk_register() error code checking Stephen Boyd
2012-09-24 20:38   ` [PATCHv2 2/3] clk: Add devm_clk_{register,unregister}() Stephen Boyd
2012-09-24 20:38   ` [PATCHv2 3/3] clk: wm831x: Use devm_clk_register() to simplify code Stephen Boyd
2012-10-29 18:13   ` [PATCHv2 1/3] clk: wm831x: Fix clk_register() error code checking Mike Turquette

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=1348034730-16473-4-git-send-email-sboyd@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).