diff mbox

[v2,1/6] clk: samsung: move common plls registration into separate function

Message ID 201307100057.48265.heiko@sntech.de (mailing list archive)
State New, archived
Headers show

Commit Message

Heiko Stuebner July 9, 2013, 10:57 p.m. UTC
All Samsung PLLs use similar code to register the clocks and clkdev lookups.
Therefore move these into a separate function to reduce code duplication.

Suggested-by: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 drivers/clk/samsung/clk-pll.c |   68 +++++++++++++++++------------------------
 1 file changed, 28 insertions(+), 40 deletions(-)

Comments

Yadwinder Singh Brar July 10, 2013, 4:59 p.m. UTC | #1
Hi Heiko,

On Wed, Jul 10, 2013 at 4:27 AM, Heiko Stübner <heiko@sntech.de> wrote:
> All Samsung PLLs use similar code to register the clocks and clkdev lookups.
> Therefore move these into a separate function to reduce code duplication.
>
> Suggested-by: Russell King <linux@arm.linux.org.uk>
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> ---

I have posted patch for adding common pll registration function
which some how missed to get merged. I hope will get merged after rc1.
Please give a look at that :
http://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg19543.html

Regards,
Yadwinder
Tomasz Figa July 11, 2013, 7:46 a.m. UTC | #2
Hi,

On Wednesday 10 of July 2013 22:29:13 Yadwinder Singh Brar wrote:
> Hi Heiko,
> 
> On Wed, Jul 10, 2013 at 4:27 AM, Heiko Stübner <heiko@sntech.de> wrote:
> > All Samsung PLLs use similar code to register the clocks and clkdev
> > lookups. Therefore move these into a separate function to reduce code
> > duplication.
> > 
> > Suggested-by: Russell King <linux@arm.linux.org.uk>
> > Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> > ---
> 
> I have posted patch for adding common pll registration function
> which some how missed to get merged. I hope will get merged after rc1.
> Please give a look at that :
> http://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg19543.html

Yeah, I was going to post a link to it, but I couldn't find it on any mailing 
list archive. I think we should go with the way of registration introduced by 
Yadwinder.

Best regards,
Tomasz
Heiko Stuebner July 11, 2013, 8:52 a.m. UTC | #3
Am Donnerstag, 11. Juli 2013, 09:46:53 schrieb Tomasz Figa:
> Hi,
> 
> On Wednesday 10 of July 2013 22:29:13 Yadwinder Singh Brar wrote:
> > Hi Heiko,
> > 
> > On Wed, Jul 10, 2013 at 4:27 AM, Heiko Stübner <heiko@sntech.de> wrote:
> > > All Samsung PLLs use similar code to register the clocks and clkdev
> > > lookups. Therefore move these into a separate function to reduce code
> > > duplication.
> > > 
> > > Suggested-by: Russell King <linux@arm.linux.org.uk>
> > > Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> > > ---
> > 
> > I have posted patch for adding common pll registration function
> > which some how missed to get merged. I hope will get merged after rc1.
> > Please give a look at that :
> > http://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg19543.ht
> > ml
> 
> Yeah, I was going to post a link to it, but I couldn't find it on any
> mailing list archive. I think we should go with the way of registration
> introduced by Yadwinder.

the linked patch looks nice, thanks for the link. So I'll redo the plls 
against it in the next round.


Heiko
Mike Turquette Aug. 2, 2013, 9:35 p.m. UTC | #4
Quoting Heiko Stübner (2013-07-11 01:52:13)
> Am Donnerstag, 11. Juli 2013, 09:46:53 schrieb Tomasz Figa:
> > Hi,
> > 
> > On Wednesday 10 of July 2013 22:29:13 Yadwinder Singh Brar wrote:
> > > Hi Heiko,
> > > 
> > > On Wed, Jul 10, 2013 at 4:27 AM, Heiko Stübner <heiko@sntech.de> wrote:
> > > > All Samsung PLLs use similar code to register the clocks and clkdev
> > > > lookups. Therefore move these into a separate function to reduce code
> > > > duplication.
> > > > 
> > > > Suggested-by: Russell King <linux@arm.linux.org.uk>
> > > > Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> > > > ---
> > > 
> > > I have posted patch for adding common pll registration function
> > > which some how missed to get merged. I hope will get merged after rc1.
> > > Please give a look at that :
> > > http://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg19543.ht
> > > ml
> > 
> > Yeah, I was going to post a link to it, but I couldn't find it on any
> > mailing list archive. I think we should go with the way of registration
> > introduced by Yadwinder.
> 
> the linked patch looks nice, thanks for the link. So I'll redo the plls 
> against it in the next round.

I just took that series into clk-next, so you can base v2 of this series
against clk-next.

Regards,
Mike

> 
> 
> Heiko
diff mbox

Patch

diff --git a/drivers/clk/samsung/clk-pll.c b/drivers/clk/samsung/clk-pll.c
index 362f12d..9153e46 100644
--- a/drivers/clk/samsung/clk-pll.c
+++ b/drivers/clk/samsung/clk-pll.c
@@ -13,6 +13,24 @@ 
 #include "clk.h"
 #include "clk-pll.h"
 
+static inline struct clk *samsung_register_pll(struct clk_hw *hw)
+{
+	struct clk *clk;
+	const char *name = hw->init->name;
+
+	clk = clk_register(NULL, hw);
+	if (IS_ERR(clk)) {
+		pr_err("%s: failed to register pll clock %s\n", __func__,
+				name);
+		return clk;
+	}
+
+	if (clk_register_clkdev(clk, name, NULL))
+		pr_err("%s: failed to register lookup for %s", __func__, name);
+
+	return clk;
+}
+
 /*
  * PLL35xx Clock Type
  */
@@ -75,15 +93,9 @@  struct clk * __init samsung_clk_register_pll35xx(const char *name,
 	pll->hw.init = &init;
 	pll->con_reg = con_reg;
 
-	clk = clk_register(NULL, &pll->hw);
-	if (IS_ERR(clk)) {
-		pr_err("%s: failed to register pll clock %s\n", __func__,
-				name);
+	clk = samsung_register_pll(&pll->hw);
+	if (IS_ERR(clk))
 		kfree(pll);
-	}
-
-	if (clk_register_clkdev(clk, name, NULL))
-		pr_err("%s: failed to register lookup for %s", __func__, name);
 
 	return clk;
 }
@@ -155,15 +167,9 @@  struct clk * __init samsung_clk_register_pll36xx(const char *name,
 	pll->hw.init = &init;
 	pll->con_reg = con_reg;
 
-	clk = clk_register(NULL, &pll->hw);
-	if (IS_ERR(clk)) {
-		pr_err("%s: failed to register pll clock %s\n", __func__,
-				name);
+	clk = samsung_register_pll(&pll->hw);
+	if (IS_ERR(clk))
 		kfree(pll);
-	}
-
-	if (clk_register_clkdev(clk, name, NULL))
-		pr_err("%s: failed to register lookup for %s", __func__, name);
 
 	return clk;
 }
@@ -236,15 +242,9 @@  struct clk * __init samsung_clk_register_pll45xx(const char *name,
 	pll->con_reg = con_reg;
 	pll->type = type;
 
-	clk = clk_register(NULL, &pll->hw);
-	if (IS_ERR(clk)) {
-		pr_err("%s: failed to register pll clock %s\n", __func__,
-				name);
+	clk = samsung_register_pll(&pll->hw);
+	if (IS_ERR(clk))
 		kfree(pll);
-	}
-
-	if (clk_register_clkdev(clk, name, NULL))
-		pr_err("%s: failed to register lookup for %s", __func__, name);
 
 	return clk;
 }
@@ -323,15 +323,9 @@  struct clk * __init samsung_clk_register_pll46xx(const char *name,
 	pll->con_reg = con_reg;
 	pll->type = type;
 
-	clk = clk_register(NULL, &pll->hw);
-	if (IS_ERR(clk)) {
-		pr_err("%s: failed to register pll clock %s\n", __func__,
-				name);
+	clk = samsung_register_pll(&pll->hw);
+	if (IS_ERR(clk))
 		kfree(pll);
-	}
-
-	if (clk_register_clkdev(clk, name, NULL))
-		pr_err("%s: failed to register lookup for %s", __func__, name);
 
 	return clk;
 }
@@ -406,15 +400,9 @@  struct clk * __init samsung_clk_register_pll2550x(const char *name,
 	pll->reg_base = reg_base;
 	pll->offset = offset;
 
-	clk = clk_register(NULL, &pll->hw);
-	if (IS_ERR(clk)) {
-		pr_err("%s: failed to register pll clock %s\n", __func__,
-				name);
+	clk = samsung_register_pll(&pll->hw);
+	if (IS_ERR(clk))
 		kfree(pll);
-	}
-
-	if (clk_register_clkdev(clk, name, NULL))
-		pr_err("%s: failed to register lookup for %s", __func__, name);
 
 	return clk;
 }