From patchwork Mon Dec 17 21:02:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 1888981 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id F3F93DF266 for ; Mon, 17 Dec 2012 21:06:03 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Tkhq1-0002eV-CO; Mon, 17 Dec 2012 21:03:01 +0000 Received: from wolverine01.qualcomm.com ([199.106.114.254]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TkhpO-0002ZF-P3 for linux-arm-kernel@lists.infradead.org; Mon, 17 Dec 2012 21:02:24 +0000 X-IronPort-AV: E=Sophos;i="4.84,304,1355126400"; d="scan'208";a="14662750" Received: from pdmz-ns-snip_115_219.qualcomm.com (HELO mostmsg01.qualcomm.com) ([199.106.115.219]) by wolverine01.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 17 Dec 2012 13:02:18 -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 AE0D510004B4; Mon, 17 Dec 2012 13:02:18 -0800 (PST) From: Stephen Boyd To: Mike Turquette Subject: [PATCH 2/4] clk: highbank: Use of_init_clk_data() Date: Mon, 17 Dec 2012 13:02:13 -0800 Message-Id: <1355778135-32458-3-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_160223_079192_CD6B1D81 X-CRM114-Status: GOOD ( 10.36 ) 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.254 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Rob Herring , 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: Rob Herring --- 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)