From patchwork Mon Dec 17 21:02:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 1888991 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id A2B133FCA5 for ; Mon, 17 Dec 2012 21:06:04 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Tkhpi-0002bX-EL; Mon, 17 Dec 2012 21:02:42 +0000 Received: from wolverine02.qualcomm.com ([199.106.114.251]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TkhpN-0002Z5-Jd for linux-arm-kernel@lists.infradead.org; Mon, 17 Dec 2012 21:02:22 +0000 X-IronPort-AV: E=Sophos;i="4.84,304,1355126400"; d="scan'208";a="14773299" Received: from pdmz-ns-mip.qualcomm.com (HELO mostmsg01.qualcomm.com) ([199.106.114.10]) by wolverine02.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 17 Dec 2012 13:02:19 -0800 Received: from sboyd-linux.qualcomm.com (pdmz-ns-snip_218_1.qualcomm.com [192.168.218.1]) by mostmsg01.qualcomm.com (Postfix) with ESMTPA id DCE2C10004D7; Mon, 17 Dec 2012 13:02:18 -0800 (PST) From: Stephen Boyd To: Mike Turquette Subject: [PATCH 3/4] clk: vt8500: Use of_init_clk_data() Date: Mon, 17 Dec 2012 13:02:14 -0800 Message-Id: <1355778135-32458-4-git-send-email-sboyd@codeaurora.org> X-Mailer: git-send-email 1.8.1.rc1 In-Reply-To: <1355778135-32458-1-git-send-email-sboyd@codeaurora.org> References: <1355778135-32458-1-git-send-email-sboyd@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121217_160221_923632_01F5D244 X-CRM114-Status: GOOD ( 11.98 ) X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [199.106.114.251 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Reduce lines of code and simplify this driver by using the generic clock binding parsing function. Signed-off-by: Stephen Boyd Cc: Tony Prisk Acked-by: Tony Prisk --- 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); }