From patchwork Tue Apr 10 12:51:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 10333063 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 2F38C6053C for ; Tue, 10 Apr 2018 12:55:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F11B28A4E for ; Tue, 10 Apr 2018 12:55:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12FC128CF2; Tue, 10 Apr 2018 12:55:09 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A83AD28A4E for ; Tue, 10 Apr 2018 12:55:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=GnVutH71QW7d9wTPqMk2hnOM0OPlgch7WzlmEP/G2S8=; b=NNk3DmYIiAOUEffe66Eq2/BIJj UxSzTFp5QSE+Y6REEEvCO2RB7/0VZLwtthYaeJvkmXoN9j3UrhASfozgJoBpvQ0HBPRwnnsFqWu0X N84wKGI4isnSb4UcL9p9gAxoExpIymyJqxj5gj5KF1zLQrN5rvfzEDA6U9I8R73Rqy5Aypq5DiiCr 4AxL0AOSViHJnOe9oE5FM8yxAsx2kt6KyZbcj7uGB5KBsJl2VWrqaBEQb6D07VQGPb4GJCQ5lUgTr u3iV+uXm+C5HdVjZ3HO06qtqLjwiKXUJ2osbwl3WJ0JHRYNKUZx9oi6GoZLoub4uN8ha4yGs3vye5 2184tRwQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f5snb-0004k5-Lw; Tue, 10 Apr 2018 12:54:59 +0000 Received: from baptiste.telenet-ops.be ([2a02:1800:120:4::f00:13]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f5sl0-00034G-BB for linux-rockchip@lists.infradead.org; Tue, 10 Apr 2018 12:52:21 +0000 Received: from ayla.of.borg ([84.194.111.163]) by baptiste.telenet-ops.be with bizsmtp id Ycrj1x00U3XaVaC01crj7N; Tue, 10 Apr 2018 14:52:00 +0200 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.86_2) (envelope-from ) id 1f5skR-00054M-N7; Tue, 10 Apr 2018 14:51:43 +0200 Received: from geert by ramsan with local (Exim 4.86_2) (envelope-from ) id 1f5skR-000410-Lx; Tue, 10 Apr 2018 14:51:43 +0200 From: Geert Uytterhoeven To: Michael Turquette , Stephen Boyd Subject: [PATCH v2 1/5] clk: Extract OF clock helpers in Date: Tue, 10 Apr 2018 14:51:37 +0200 Message-Id: <1523364701-15383-2-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523364701-15383-1-git-send-email-geert+renesas@glider.be> References: <1523364701-15383-1-git-send-email-geert+renesas@glider.be> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180410_055218_567863_64FC2753 X-CRM114-Status: GOOD ( 14.34 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Heiko Stuebner , Geert Uytterhoeven , linux-rockchip@lists.infradead.org, Maxime Ripard , Linus Walleij , Daniel Lezcano , linux-kernel@vger.kernel.org, Jonathan Hunter , linux-gpio@vger.kernel.org, Chen-Yu Tsai , Rob Herring , Thierry Reding , linux-tegra@vger.kernel.org, Thomas Gleixner , Frank Rowand , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The use of of_clk_get_parent_{count,name}() and of_clk_init() is not limited to clock providers. Hence move these helpers into their own header file, so callers that are not clock providers no longer have to include . Suggested-by: Stephen Boyd Signed-off-by: Geert Uytterhoeven Reviewed-by: Heiko Stuebner --- v2: - New. I have't added an SPDX-License-Identifier line, as also doesn't have one yet. Other candidates to be moved here later? - of_clk_get(), - of_clk_get_by_name(), - of_clk_get_from_provider(). --- include/linux/clk-provider.h | 14 +------------- include/linux/of_clk.h | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 13 deletions(-) create mode 100644 include/linux/of_clk.h diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 210a890008f9e129..61cb4729f22acd6b 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -13,6 +13,7 @@ #include #include +#include #ifdef CONFIG_COMMON_CLK @@ -890,13 +891,10 @@ struct clk_hw *of_clk_hw_simple_get(struct of_phandle_args *clkspec, struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data); struct clk_hw *of_clk_hw_onecell_get(struct of_phandle_args *clkspec, void *data); -unsigned int of_clk_get_parent_count(struct device_node *np); int of_clk_parent_fill(struct device_node *np, const char **parents, unsigned int size); -const char *of_clk_get_parent_name(struct device_node *np, int index); int of_clk_detect_critical(struct device_node *np, int index, unsigned long *flags); -void of_clk_init(const struct of_device_id *matches); #else /* !CONFIG_OF */ @@ -943,26 +941,16 @@ of_clk_hw_onecell_get(struct of_phandle_args *clkspec, void *data) { return ERR_PTR(-ENOENT); } -static inline unsigned int of_clk_get_parent_count(struct device_node *np) -{ - return 0; -} static inline int of_clk_parent_fill(struct device_node *np, const char **parents, unsigned int size) { return 0; } -static inline const char *of_clk_get_parent_name(struct device_node *np, - int index) -{ - return NULL; -} static inline int of_clk_detect_critical(struct device_node *np, int index, unsigned long *flags) { return 0; } -static inline void of_clk_init(const struct of_device_id *matches) {} #endif /* CONFIG_OF */ /* diff --git a/include/linux/of_clk.h b/include/linux/of_clk.h new file mode 100644 index 0000000000000000..ba3c0e6983ec1543 --- /dev/null +++ b/include/linux/of_clk.h @@ -0,0 +1,29 @@ +/* + * OF clock helpers + */ + +#ifndef __LINUX_OF_CLK_H +#define __LINUX_OF_CLK_H + +#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_OF) + +unsigned int of_clk_get_parent_count(struct device_node *np); +const char *of_clk_get_parent_name(struct device_node *np, int index); +void of_clk_init(const struct of_device_id *matches); + +#else /* !CONFIG_COMMON_CLK || !CONFIG_OF */ + +static inline unsigned int of_clk_get_parent_count(struct device_node *np) +{ + return 0; +} +static inline const char *of_clk_get_parent_name(struct device_node *np, + int index) +{ + return NULL; +} +static inline void of_clk_init(const struct of_device_id *matches) {} + +#endif /* !CONFIG_COMMON_CLK || !CONFIG_OF */ + +#endif /* __LINUX_OF_CLK_H */