From patchwork Wed May 1 00:58:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Hesselbarth X-Patchwork-Id: 2506991 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id 8FBDA3FD85 for ; Wed, 1 May 2013 00:59:51 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UXLOU-0007Lw-Sm; Wed, 01 May 2013 00:59:39 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UXLOO-0005N6-FA; Wed, 01 May 2013 00:59:32 +0000 Received: from mail-ea0-x22a.google.com ([2a00:1450:4013:c01::22a]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UXLO8-0005L9-Qy for linux-arm-kernel@lists.infradead.org; Wed, 01 May 2013 00:59:21 +0000 Received: by mail-ea0-f170.google.com with SMTP id z7so494067eaf.1 for ; Tue, 30 Apr 2013 17:58:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=TBY3oV4pceK2xnrXKF//2fwmAtNfiYJUX7v71RYc20c=; b=p4LoDhvtjfcRgUA/OgSFG2HIcmRjZgIRcYHOipiKgzMM53OZb+6ywIyHybz86HSpbo O7chvrUlMwCu6XFAnEgboNAcm8ugFsq9HysfnvMBxui5pfJJYduTRsgEXcR3k1EoGRJT ovqfRg4GVpp8Ylr9M0Ukr+U4cEh55rAanHKFBFos9odQC4AJCROI0iDG8uj+lxu3wUxB by+kfCVTyfvyt+D7rn+RlXX1BiwPw4mssvyzRdt34usYyJ5vltpH2uUa8hq0vtsCoGbh MRCP/uMDVga6gvcTfFnH3mSphFbymizc22glI1Nj3Viypg5VwissO7hS2PUEdcOyVP/W rbtA== X-Received: by 10.14.202.201 with SMTP id d49mr2009920eeo.1.1367369933657; Tue, 30 Apr 2013 17:58:53 -0700 (PDT) Received: from topkick.lan (dslc-082-083-251-181.pools.arcor-ip.net. [82.83.251.181]) by mx.google.com with ESMTPSA id k43sm910643een.2.2013.04.30.17.58.51 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 30 Apr 2013 17:58:52 -0700 (PDT) Received: from edge.lan (magicgate.lan [192.168.1.1]) by topkick.lan (Postfix) with ESMTPSA id 4D9B8605B1; Wed, 1 May 2013 02:58:28 +0200 (CEST) From: Sebastian Hesselbarth To: Sebastian Hesselbarth Subject: [PATCH 1/2] clk: add non CONFIG_OF routines for clk-provider Date: Wed, 1 May 2013 02:58:28 +0200 Message-Id: <1367369910-20402-2-git-send-email-sebastian.hesselbarth@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1367369910-20402-1-git-send-email-sebastian.hesselbarth@gmail.com> References: <1367369910-20402-1-git-send-email-sebastian.hesselbarth@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130430_205917_030779_E09339DC X-CRM114-Status: GOOD ( 15.13 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (sebastian.hesselbarth[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Lars-Peter Clausen , Stephen Warren , Arnd Bergmann , Linus Walleij , linux-kernel@vger.kernel.org, Daniel Mack , Peter Ujfalusi , linux-arm-kernel@lists.infradead.org, Marek Belisko , Mike Turquette , Andrew Morton , Guenter Roeck X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Some drivers that are shared between architectures have HAVE_CLK selected but don't have OF. To remove compilation errors for drivers that provide clocks on DT with of_clk_add_provider we would have to enclose these calls within #ifdef CONFIG_OF, #endif. This patch adds some stubs for OF related clk-provider functions that either do nothing or return appropriate values if CONFIG_OF is not set. So, definition of these routines will always be available. Signed-off-by: Sebastian Hesselbarth Suggested-by: Arnd Bergmann --- Cc: Mike Turquette Cc: Linus Walleij Cc: Andrew Morton Cc: Peter Ujfalusi Cc: Arnd Bergmann Cc: Stephen Warren Cc: Daniel Mack Cc: Lars-Peter Clausen Cc: Guenter Roeck Cc: Marek Belisko Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- include/linux/clk-provider.h | 47 +++++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 1186098..265f384 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -423,6 +423,17 @@ struct of_device_id; typedef void (*of_clk_init_cb_t)(struct device_node *); +struct clk_onecell_data { + struct clk **clks; + unsigned int clk_num; +}; + +#define CLK_OF_DECLARE(name, compat, fn) \ + static const struct of_device_id __clk_of_table_##name \ + __used __section(__clk_of_table) \ + = { .compatible = compat, .data = fn }; + +#ifdef CONFIG_OF int of_clk_add_provider(struct device_node *np, struct clk *(*clk_src_get)(struct of_phandle_args *args, void *data), @@ -430,19 +441,39 @@ int of_clk_add_provider(struct device_node *np, void of_clk_del_provider(struct device_node *np); struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec, void *data); -struct clk_onecell_data { - struct clk **clks; - unsigned int clk_num; -}; struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data); const char *of_clk_get_parent_name(struct device_node *np, int index); void of_clk_init(const struct of_device_id *matches); -#define CLK_OF_DECLARE(name, compat, fn) \ - static const struct of_device_id __clk_of_table_##name \ - __used __section(__clk_of_table) \ - = { .compatible = compat, .data = fn }; +#else /* !CONFIG_OF */ +static inline int of_clk_add_provider(struct device_node *np, + struct clk *(*clk_src_get)(struct of_phandle_args *args, + void *data), + void *data) +{ + return 0; +} +#define of_clk_del_provider(np) \ + { while (0); } +static inline struct clk *of_clk_src_simple_get( + struct of_phandle_args *clkspec, void *data) +{ + return ERR_PTR(-ENOENT); +} +static inline struct clk *of_clk_src_onecell_get( + struct of_phandle_args *clkspec, void *data) +{ + return ERR_PTR(-ENOENT); +} +static inline const char *of_clk_get_parent_name(struct device_node *np, + int index) +{ + return NULL; +} +#define of_clk_init(matches) \ + { while (0); } +#endif /* CONFIG_OF */ #endif /* CONFIG_COMMON_CLK */ #endif /* CLK_PROVIDER_H */