From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/4] clk: highbank: Use of_init_clk_data()
Date: Mon, 17 Dec 2012 13:02:13 -0800 [thread overview]
Message-ID: <1355778135-32458-3-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: Rob Herring <rob.herring@calxeda.com>
---
drivers/clk/clk-highbank.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/drivers/clk/clk-highbank.c b/drivers/clk/clk-highbank.c
index 52fecad..5dbbf62 100644
--- a/drivers/clk/clk-highbank.c
+++ b/drivers/clk/clk-highbank.c
@@ -275,8 +275,6 @@ static __init struct clk *hb_clk_init(struct device_node *node, const struct clk
u32 reg;
struct clk *clk;
struct hb_clk *hb_clk;
- const char *clk_name = node->name;
- const char *parent_name;
struct clk_init_data init;
int rc;
@@ -290,24 +288,21 @@ static __init struct clk *hb_clk_init(struct device_node *node, const struct clk
hb_clk->reg = sregs_base + reg;
- of_property_read_string(node, "clock-output-names", &clk_name);
-
- init.name = clk_name;
init.ops = 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;
hb_clk->hw.init = &init;
clk = clk_register(NULL, &hb_clk->hw);
- if (WARN_ON(IS_ERR(clk))) {
- kfree(hb_clk);
- return NULL;
- }
+ if (WARN_ON(IS_ERR(clk)))
+ goto err;
rc = of_clk_add_provider(node, of_clk_src_simple_get, clk);
return clk;
+err:
+ kfree(hb_clk);
+ return NULL;
}
static void __init hb_pll_init(struct device_node *node)
--
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,
Rob Herring <rob.herring@calxeda.com>
Subject: [PATCH 2/4] clk: highbank: Use of_init_clk_data()
Date: Mon, 17 Dec 2012 13:02:13 -0800 [thread overview]
Message-ID: <1355778135-32458-3-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: Rob Herring <rob.herring@calxeda.com>
---
drivers/clk/clk-highbank.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/drivers/clk/clk-highbank.c b/drivers/clk/clk-highbank.c
index 52fecad..5dbbf62 100644
--- a/drivers/clk/clk-highbank.c
+++ b/drivers/clk/clk-highbank.c
@@ -275,8 +275,6 @@ static __init struct clk *hb_clk_init(struct device_node *node, const struct clk
u32 reg;
struct clk *clk;
struct hb_clk *hb_clk;
- const char *clk_name = node->name;
- const char *parent_name;
struct clk_init_data init;
int rc;
@@ -290,24 +288,21 @@ static __init struct clk *hb_clk_init(struct device_node *node, const struct clk
hb_clk->reg = sregs_base + reg;
- of_property_read_string(node, "clock-output-names", &clk_name);
-
- init.name = clk_name;
init.ops = 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;
hb_clk->hw.init = &init;
clk = clk_register(NULL, &hb_clk->hw);
- if (WARN_ON(IS_ERR(clk))) {
- kfree(hb_clk);
- return NULL;
- }
+ if (WARN_ON(IS_ERR(clk)))
+ goto err;
rc = of_clk_add_provider(node, of_clk_src_simple_get, clk);
return clk;
+err:
+ kfree(hb_clk);
+ return NULL;
}
static void __init hb_pll_init(struct device_node *node)
--
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 ` Stephen Boyd [this message]
2012-12-17 21:02 ` [PATCH 2/4] clk: highbank: Use of_init_clk_data() Stephen Boyd
2012-12-17 21:02 ` [PATCH 3/4] clk: vt8500: " Stephen Boyd
2012-12-17 21:02 ` 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-3-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.