From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/4] clk: vt8500: Use of_init_clk_data()
Date: Mon, 17 Dec 2012 13:02:14 -0800 [thread overview]
Message-ID: <1355778135-32458-4-git-send-email-sboyd@codeaurora.org> (raw)
In-Reply-To: <1355778135-32458-1-git-send-email-sboyd@codeaurora.org>
Reduce lines of code and simplify this driver by using the
generic clock binding parsing function.
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Cc: Tony Prisk <linux@prisktech.co.nz>
---
drivers/clk/clk-vt8500.c | 39 +++++++++++++++------------------------
1 file changed, 15 insertions(+), 24 deletions(-)
diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c
index fe25570..454efa7 100644
--- a/drivers/clk/clk-vt8500.c
+++ b/drivers/clk/clk-vt8500.c
@@ -200,8 +200,6 @@ static __init void vtwm_device_clk_init(struct device_node *node)
u32 en_reg, div_reg;
struct clk *clk;
struct clk_device *dev_clk;
- const char *clk_name = node->name;
- const char *parent_name;
struct clk_init_data init;
int rc;
int clk_init_flags = 0;
@@ -237,8 +235,6 @@ static __init void vtwm_device_clk_init(struct device_node *node)
clk_init_flags |= CLK_INIT_DIVISOR;
}
- of_property_read_string(node, "clock-output-names", &clk_name);
-
switch (clk_init_flags) {
case CLK_INIT_GATED:
init.ops = &vt8500_gated_clk_ops;
@@ -256,11 +252,11 @@ static __init void vtwm_device_clk_init(struct device_node *node)
return;
}
- init.name = clk_name;
- init.flags = 0;
- parent_name = of_clk_get_parent_name(node, 0);
- init.parent_names = &parent_name;
- init.num_parents = 1;
+ rc = of_init_clk_data(node, &init);
+ if (WARN_ON(rc)) {
+ kfree(dev_clk);
+ return;
+ }
dev_clk->hw.init = &init;
@@ -270,7 +266,7 @@ static __init void vtwm_device_clk_init(struct device_node *node)
return;
}
rc = of_clk_add_provider(node, of_clk_src_simple_get, clk);
- clk_register_clkdev(clk, clk_name, NULL);
+ clk_register_clkdev(clk, init.name, NULL);
}
@@ -458,8 +454,6 @@ static __init void vtwm_pll_clk_init(struct device_node *node, int pll_type)
u32 reg;
struct clk *clk;
struct clk_pll *pll_clk;
- const char *clk_name = node->name;
- const char *parent_name;
struct clk_init_data init;
int rc;
@@ -475,24 +469,21 @@ static __init void vtwm_pll_clk_init(struct device_node *node, int pll_type)
pll_clk->lock = &_lock;
pll_clk->type = pll_type;
- of_property_read_string(node, "clock-output-names", &clk_name);
-
- init.name = clk_name;
init.ops = &vtwm_pll_ops;
- init.flags = 0;
- parent_name = of_clk_get_parent_name(node, 0);
- init.parent_names = &parent_name;
- init.num_parents = 1;
+ rc = of_init_clk_data(node, &init);
+ if (WARN_ON(rc))
+ goto err;
pll_clk->hw.init = &init;
clk = clk_register(NULL, &pll_clk->hw);
- if (WARN_ON(IS_ERR(clk))) {
- kfree(pll_clk);
- return;
- }
+ if (WARN_ON(IS_ERR(clk)))
+ goto err;
rc = of_clk_add_provider(node, of_clk_src_simple_get, clk);
- clk_register_clkdev(clk, clk_name, NULL);
+ clk_register_clkdev(clk, init.name, NULL);
+ return;
+err:
+ kfree(pll_clk);
}
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
WARNING: multiple messages have this Message-ID (diff)
From: Stephen Boyd <sboyd@codeaurora.org>
To: Mike Turquette <mturquette@linaro.org>
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Tony Prisk <linux@prisktech.co.nz>
Subject: [PATCH 3/4] clk: vt8500: Use of_init_clk_data()
Date: Mon, 17 Dec 2012 13:02:14 -0800 [thread overview]
Message-ID: <1355778135-32458-4-git-send-email-sboyd@codeaurora.org> (raw)
In-Reply-To: <1355778135-32458-1-git-send-email-sboyd@codeaurora.org>
Reduce lines of code and simplify this driver by using the
generic clock binding parsing function.
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Cc: Tony Prisk <linux@prisktech.co.nz>
---
drivers/clk/clk-vt8500.c | 39 +++++++++++++++------------------------
1 file changed, 15 insertions(+), 24 deletions(-)
diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c
index fe25570..454efa7 100644
--- a/drivers/clk/clk-vt8500.c
+++ b/drivers/clk/clk-vt8500.c
@@ -200,8 +200,6 @@ static __init void vtwm_device_clk_init(struct device_node *node)
u32 en_reg, div_reg;
struct clk *clk;
struct clk_device *dev_clk;
- const char *clk_name = node->name;
- const char *parent_name;
struct clk_init_data init;
int rc;
int clk_init_flags = 0;
@@ -237,8 +235,6 @@ static __init void vtwm_device_clk_init(struct device_node *node)
clk_init_flags |= CLK_INIT_DIVISOR;
}
- of_property_read_string(node, "clock-output-names", &clk_name);
-
switch (clk_init_flags) {
case CLK_INIT_GATED:
init.ops = &vt8500_gated_clk_ops;
@@ -256,11 +252,11 @@ static __init void vtwm_device_clk_init(struct device_node *node)
return;
}
- init.name = clk_name;
- init.flags = 0;
- parent_name = of_clk_get_parent_name(node, 0);
- init.parent_names = &parent_name;
- init.num_parents = 1;
+ rc = of_init_clk_data(node, &init);
+ if (WARN_ON(rc)) {
+ kfree(dev_clk);
+ return;
+ }
dev_clk->hw.init = &init;
@@ -270,7 +266,7 @@ static __init void vtwm_device_clk_init(struct device_node *node)
return;
}
rc = of_clk_add_provider(node, of_clk_src_simple_get, clk);
- clk_register_clkdev(clk, clk_name, NULL);
+ clk_register_clkdev(clk, init.name, NULL);
}
@@ -458,8 +454,6 @@ static __init void vtwm_pll_clk_init(struct device_node *node, int pll_type)
u32 reg;
struct clk *clk;
struct clk_pll *pll_clk;
- const char *clk_name = node->name;
- const char *parent_name;
struct clk_init_data init;
int rc;
@@ -475,24 +469,21 @@ static __init void vtwm_pll_clk_init(struct device_node *node, int pll_type)
pll_clk->lock = &_lock;
pll_clk->type = pll_type;
- of_property_read_string(node, "clock-output-names", &clk_name);
-
- init.name = clk_name;
init.ops = &vtwm_pll_ops;
- init.flags = 0;
- parent_name = of_clk_get_parent_name(node, 0);
- init.parent_names = &parent_name;
- init.num_parents = 1;
+ rc = of_init_clk_data(node, &init);
+ if (WARN_ON(rc))
+ goto err;
pll_clk->hw.init = &init;
clk = clk_register(NULL, &pll_clk->hw);
- if (WARN_ON(IS_ERR(clk))) {
- kfree(pll_clk);
- return;
- }
+ if (WARN_ON(IS_ERR(clk)))
+ goto err;
rc = of_clk_add_provider(node, of_clk_src_simple_get, clk);
- clk_register_clkdev(clk, clk_name, NULL);
+ clk_register_clkdev(clk, init.name, NULL);
+ return;
+err:
+ kfree(pll_clk);
}
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
next prev parent reply other threads:[~2012-12-17 21:02 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-17 21:02 [PATCH 0/4] Introduce of_init_clk_data() for DT clock parsing Stephen Boyd
2012-12-17 21:02 ` Stephen Boyd
2012-12-17 21:02 ` [PATCH 1/4] clk: Add of_init_clk_data() to parse common clock bindings Stephen Boyd
2012-12-17 21:02 ` Stephen Boyd
2012-12-17 21:02 ` [PATCH 2/4] clk: highbank: Use of_init_clk_data() Stephen Boyd
2012-12-17 21:02 ` Stephen Boyd
2012-12-17 21:02 ` Stephen Boyd [this message]
2012-12-17 21:02 ` [PATCH 3/4] clk: vt8500: " Stephen Boyd
2012-12-18 6:20 ` Tony Prisk
2012-12-18 6:20 ` Tony Prisk
2012-12-17 21:02 ` [PATCH 4/4] clk: zynq: " Stephen Boyd
2012-12-17 21:02 ` Stephen Boyd
2012-12-19 17:26 ` Josh Cartwright
2012-12-19 17:26 ` Josh Cartwright
2012-12-19 18:20 ` Stephen Boyd
2012-12-19 18:20 ` Stephen Boyd
2012-12-19 18:36 ` Josh Cartwright
2012-12-19 18:36 ` Josh Cartwright
2012-12-19 19:12 ` Stephen Boyd
2012-12-19 19:12 ` Stephen Boyd
2012-12-19 19:22 ` Soren Brinkmann
2012-12-19 19:22 ` Soren Brinkmann
2012-12-19 20:30 ` Stephen Boyd
2012-12-19 20:30 ` Stephen Boyd
2012-12-19 20:53 ` Josh Cartwright
2012-12-19 20:53 ` Josh Cartwright
2012-12-21 15:28 ` Michal Simek
2012-12-21 15:28 ` Michal Simek
2012-12-21 15:48 ` Josh Cartwright
2012-12-21 15:48 ` Josh Cartwright
2012-12-28 15:11 ` Michal Simek
2012-12-28 15:11 ` Michal Simek
2012-12-19 20:54 ` Stephen Boyd
2012-12-19 20:54 ` Stephen Boyd
2012-12-21 15:52 ` Rob Herring
2012-12-21 15:52 ` Rob Herring
2012-12-20 0:41 ` Soren Brinkmann
2012-12-20 0:41 ` Soren Brinkmann
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=1355778135-32458-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.