From patchwork Wed Jun 1 23:15:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 9148797 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AE7B3600BC for ; Wed, 1 Jun 2016 23:26:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E64B26FA0 for ; Wed, 1 Jun 2016 23:26:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92EFA271F1; Wed, 1 Jun 2016 23:26:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EAA4626FA0 for ; Wed, 1 Jun 2016 23:26:01 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b8FUF-0008I0-Hy; Wed, 01 Jun 2016 23:23:43 +0000 Received: from mail-pf0-x22e.google.com ([2607:f8b0:400e:c00::22e]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b8FNF-0005Kd-9p for linux-arm-kernel@lists.infradead.org; Wed, 01 Jun 2016 23:16:31 +0000 Received: by mail-pf0-x22e.google.com with SMTP id f144so23301872pfa.3 for ; Wed, 01 Jun 2016 16:16:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VAUFnTHmf61tNC8R9Pru8hFUuT762+PhFU2RcNBOXjA=; b=LKS4aGpauRXlhLzjvvrB6g6vrEEb6ptfGPb165UyvISjJnBU86hP4/qKDi1vfWUaU4 8BZM7fYGSf3xYK7YxG72B/wERINmjR3BO+hP6PiOlvTugvhfUr2gtfaZ/KBE17BDvLbe jTwo7sYixEZYD/scq1ofbaVS1km8c/jajDBac= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VAUFnTHmf61tNC8R9Pru8hFUuT762+PhFU2RcNBOXjA=; b=f+X4S4ktYb7pAGj2sYLyqcui/k1R04cC4KJ4m19IRZtswFVJWPOh9VUZjWmFPfpq6W Yp2QYQLq2eCdRPEiTdiO0m6Mg50Qh8lD5tEMHZ5kykZXpwKpamA9sVMAw7FgbXeqs91R 2dHKjHooBsdZsskZldB/S2rBIoJipPEwkuzg8zMqjDKSbPieVcYBD9HS06y9nnHVsTWg 9BajNAi3VxZA2lG9AvUik/nFSW7bXtDuCBCsvaopEiwJo6gj6NLDoURr+ivZecAZl7T0 GKUzIgr+Zc7HWr8b7G+eDhe+bRFOZHVLFbw6z4Wwfj1t2H10J4LhUdJ8b/ZEMhvo3sRP lxeg== X-Gm-Message-State: ALyK8tIZt9gKPTC2ccsjnQGh3bCc8e+2lo73v4BH4lmfZYh7sBBNtSAhdZ37sPdLYZU9lO1F X-Received: by 10.98.8.91 with SMTP id c88mr13509337pfd.57.1464822969075; Wed, 01 Jun 2016 16:16:09 -0700 (PDT) Received: from localhost.localdomain (pat_11.qualcomm.com. [192.35.156.11]) by smtp.gmail.com with ESMTPSA id r64sm20967395pfi.54.2016.06.01.16.16.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 01 Jun 2016 16:16:08 -0700 (PDT) From: Stephen Boyd To: Michael Turquette , Stephen Boyd Subject: [PATCH 32/34] clk: u300: Migrate to clk_hw based registration APIs Date: Wed, 1 Jun 2016 16:15:31 -0700 Message-Id: <20160601231533.9354-33-stephen.boyd@linaro.org> X-Mailer: git-send-email 2.9.0-rc1 In-Reply-To: <20160601231533.9354-1-stephen.boyd@linaro.org> References: <20160601231533.9354-1-stephen.boyd@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160601_161629_561938_D8ECD533 X-CRM114-Status: GOOD ( 16.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linus Walleij , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Now that we have clk_hw based provider APIs to register clks, we can get rid of struct clk pointers while registering clks in these drivers, allowing us to move closer to a clear split of consumer and provider clk APIs. Cc: Linus Walleij Signed-off-by: Stephen Boyd Acked-by: Linus Walleij --- See commit 58657d189a2f and it's children for details on this new registration API. drivers/clk/clk-u300.c | 59 ++++++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 26 deletions(-) diff --git a/drivers/clk/clk-u300.c b/drivers/clk/clk-u300.c index 95d1742dac30..ec8aafda6e24 100644 --- a/drivers/clk/clk-u300.c +++ b/drivers/clk/clk-u300.c @@ -689,7 +689,7 @@ static const struct clk_ops syscon_clk_ops = { .set_rate = syscon_clk_set_rate, }; -static struct clk * __init +static struct clk_hw * __init syscon_clk_register(struct device *dev, const char *name, const char *parent_name, unsigned long flags, bool hw_ctrld, @@ -697,9 +697,10 @@ syscon_clk_register(struct device *dev, const char *name, void __iomem *en_reg, u8 en_bit, u16 clk_val) { - struct clk *clk; + struct clk_hw *hw; struct clk_syscon *sclk; struct clk_init_data init; + int ret; sclk = kzalloc(sizeof(struct clk_syscon), GFP_KERNEL); if (!sclk) { @@ -722,11 +723,14 @@ syscon_clk_register(struct device *dev, const char *name, sclk->en_bit = en_bit; sclk->clk_val = clk_val; - clk = clk_register(dev, &sclk->hw); - if (IS_ERR(clk)) + hw = &sclk->hw; + ret = clk_hw_register(dev, hw); + if (ret) { kfree(sclk); + hw = ERR_PTR(ret); + } - return clk; + return hw; } #define U300_CLK_TYPE_SLOW 0 @@ -868,7 +872,7 @@ static struct u300_clock const u300_clk_lookup[] __initconst = { static void __init of_u300_syscon_clk_init(struct device_node *np) { - struct clk *clk = ERR_PTR(-EINVAL); + struct clk_hw *hw = ERR_PTR(-EINVAL); const char *clk_name = np->name; const char *parent_name; void __iomem *res_reg; @@ -911,16 +915,15 @@ static void __init of_u300_syscon_clk_init(struct device_node *np) const struct u300_clock *u3clk = &u300_clk_lookup[i]; if (u3clk->type == clk_type && u3clk->id == clk_id) - clk = syscon_clk_register(NULL, - clk_name, parent_name, - 0, u3clk->hw_ctrld, - res_reg, u3clk->id, - en_reg, u3clk->id, - u3clk->clk_val); + hw = syscon_clk_register(NULL, clk_name, parent_name, + 0, u3clk->hw_ctrld, + res_reg, u3clk->id, + en_reg, u3clk->id, + u3clk->clk_val); } - if (!IS_ERR(clk)) { - of_clk_add_provider(np, of_clk_src_simple_get, clk); + if (!IS_ERR(hw)) { + of_clk_add_hw_provider(np, of_clk_hw_simple_get, hw); /* * Some few system clocks - device tree does not @@ -928,11 +931,11 @@ static void __init of_u300_syscon_clk_init(struct device_node *np) * for now we add these three clocks here. */ if (clk_type == U300_CLK_TYPE_REST && clk_id == 5) - clk_register_clkdev(clk, NULL, "pl172"); + clk_hw_register_clkdev(hw, NULL, "pl172"); if (clk_type == U300_CLK_TYPE_REST && clk_id == 9) - clk_register_clkdev(clk, NULL, "semi"); + clk_hw_register_clkdev(hw, NULL, "semi"); if (clk_type == U300_CLK_TYPE_REST && clk_id == 12) - clk_register_clkdev(clk, NULL, "intcon"); + clk_hw_register_clkdev(hw, NULL, "intcon"); } } @@ -1111,13 +1114,14 @@ static const struct clk_ops mclk_ops = { .set_rate = mclk_clk_set_rate, }; -static struct clk * __init +static struct clk_hw * __init mclk_clk_register(struct device *dev, const char *name, const char *parent_name, bool is_mspro) { - struct clk *clk; + struct clk_hw *hw; struct clk_mclk *mclk; struct clk_init_data init; + int ret; mclk = kzalloc(sizeof(struct clk_mclk), GFP_KERNEL); if (!mclk) { @@ -1133,23 +1137,26 @@ mclk_clk_register(struct device *dev, const char *name, mclk->hw.init = &init; mclk->is_mspro = is_mspro; - clk = clk_register(dev, &mclk->hw); - if (IS_ERR(clk)) + hw = &mclk->hw; + ret = clk_hw_register(dev, hw); + if (ret) { kfree(mclk); + hw = ERR_PTR(ret); + } - return clk; + return hw; } static void __init of_u300_syscon_mclk_init(struct device_node *np) { - struct clk *clk = ERR_PTR(-EINVAL); + struct clk_hw *hw; const char *clk_name = np->name; const char *parent_name; parent_name = of_clk_get_parent_name(np, 0); - clk = mclk_clk_register(NULL, clk_name, parent_name, false); - if (!IS_ERR(clk)) - of_clk_add_provider(np, of_clk_src_simple_get, clk); + hw = mclk_clk_register(NULL, clk_name, parent_name, false); + if (!IS_ERR(hw)) + of_clk_add_hw_provider(np, of_clk_hw_simple_get, hw); } static const struct of_device_id u300_clk_match[] __initconst = {