linux-next: build failure after merge of the clk tree

From: Stephen Rothwell
Date: Mon Jul 01 2019 - 20:01:09 EST


Hi all,

After merging the clk tree, today's linux-next build (arm omap1_defconfig
and many others) failed like this:

In file included from drivers/clk/clkdev.c:22:0:
drivers/clk/clk.h:36:23: error: static declaration of '__clk_get_hw' follows non-static declaration
include/linux/clk-provider.h:808:16: note: previous declaration of '__clk_get_hw' was here

Caused by commit

59fcdce425b7 ("clk: Remove ifdef for COMMON_CLK in clk-provider.h")

This commit exposed the CONFIG_COMMON_CLK version of the __clk_get_hw()
declaration to non CONFIG_COMMON_CLK code (where there is a static
declaration of __clk_get_hw() (which is BTW missing an "inline")
in drivers/clk/clk.h.

We need something like this (untested):

From: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
Date: Tue, 2 Jul 2019 09:58:18 +1000
Subject: [PATCH] clk: for up for "clk: Remove ifdef for COMMON_CLK in
clk-provider.h"

We were getting errors like:

In file included from drivers/clk/clkdev.c:22:0:
drivers/clk/clk.h:36:23: error: static declaration of '__clk_get_hw' follows non
-static declaration
include/linux/clk-provider.h:808:16: note: previous declaration of '__clk_get_hw
' was here

Signed-off-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
---
drivers/clk/clk.h | 2 +-
include/linux/clk-provider.h | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk.h b/drivers/clk/clk.h
index d8400d623b34..143acac2ec81 100644
--- a/drivers/clk/clk.h
+++ b/drivers/clk/clk.h
@@ -33,7 +33,7 @@ clk_hw_create_clk(struct device *dev, struct clk_hw *hw, const char *dev_id,
{
return (struct clk *)hw;
}
-static struct clk_hw *__clk_get_hw(struct clk *clk)
+static inline struct clk_hw *__clk_get_hw(struct clk *clk)
{
return (struct clk_hw *)clk;
}
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 0fbf3ccad849..35c8b1c315b4 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -805,7 +805,10 @@ void devm_clk_hw_unregister(struct device *dev, struct clk_hw *hw);
/* helper functions */
const char *__clk_get_name(const struct clk *clk);
const char *clk_hw_get_name(const struct clk_hw *hw);
+#ifdef CONFIG_COMON_CLK
+/* There is a !CONFIG_COMMON_CLK static inline for this in drivers/clk/clk.h */
struct clk_hw *__clk_get_hw(struct clk *clk);
+#endif
unsigned int clk_hw_get_num_parents(const struct clk_hw *hw);
struct clk_hw *clk_hw_get_parent(const struct clk_hw *hw);
struct clk_hw *clk_hw_get_parent_by_index(const struct clk_hw *hw,
--
2.20.1

--
Cheers,
Stephen Rothwell

Attachment: pgpx24WthWJ0s.pgp
Description: OpenPGP digital signature