Skip to contentSkip to conversation

clocksource: Fix build error when !CONFIG_CLKSRC_OF

PATCH In review Axel Lin 2 participants 2 messages Mar 26, 2013

Subsystems (4)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 clocksource: Fix build error when !CONFIG_CLKSRC_OF

Fix below build error:

CC drivers/clocksource/exynos_mct.o
drivers/clocksource/exynos_mct.c:557:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__unused' drivers/clocksource/exynos_mct.c:558:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__unused' make[2]: *** [drivers/clocksource/exynos_mct.o] Error 1
make[1]: *** [drivers/clocksource] Error 2
make: *** [drivers] Error 2

This build error is introduced by commit 4d10f054 "clocksource: make CLOCKSOURCE_OF_DECLARE type safe".

---
 include/linux/clocksource.h |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
include/linux/clocksource.h +1 -5
index ac33184..b84a2f3 100644
@@ -344,11 +344,7 @@ extern void clocksource_of_init(void);
 		     .data = (fn == (clocksource_of_init_fn)NULL) ? fn : fn }
 #else
 static inline void clocksource_of_init(void) {}
-#define CLOCKSOURCE_OF_DECLARE(name, compat, fn)			\
-	static const struct of_device_id __clksrc_of_table_##name	\
-		__unused __section(__clksrc_of_table)			\
-		 = { .compatible = compat,				\
-		     .data = (fn == (clocksource_of_init_fn)NULL) ? fn : fn }
+#define CLOCKSOURCE_OF_DECLARE(name, compat, fn)
 #endif
 
 #endif /* _LINUX_CLOCKSOURCE_H */
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 11 lines · Axel Lin

Fix below build error:

CC drivers/clocksource/exynos_mct.o
drivers/clocksource/exynos_mct.c:557:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__unused' drivers/clocksource/exynos_mct.c:558:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__unused' make[2]: *** [drivers/clocksource/exynos_mct.o] Error 1
make[1]: *** [drivers/clocksource] Error 2
make: *** [drivers] Error 2

This build error is introduced by commit 4d10f054 "clocksource: make CLOCKSOURCE_OF_DECLARE type safe".

Hi Axel,

Thanks for the bug report. It seems that the __unused does not exist in the kernel, so I'll have to use __attribute__((unused)) instead. I definitely want to keep the feature of checking the function prototype even for CONFIG_OF=n though, so I won't remove the macro definition.

I'll apply this patch unless there are further concerns with it.

include/linux/clocksource.h +1 -1
index ac33184..818be77 100644
@@ -346,7 +346,7 @@ extern void clocksource_of_init(void);
 static inline void clocksource_of_init(void) {}
 #define CLOCKSOURCE_OF_DECLARE(name, compat, fn)			\
 	static const struct of_device_id __clksrc_of_table_##name	\
-		__unused __section(__clksrc_of_table)			\
+		__attribute__((__unused__))				\
 		 = { .compatible = compat,				\
 		     .data = (fn == (clocksource_of_init_fn)NULL) ? fn : fn }
 #endif

Since Rob's earlier patches changed the interface for CLOCKSOURCE_OF_DECLARE, we will also need to have a patch like the one below for the exynos_mct driver.

drivers/clocksource/exynos_mct.c +26 -37

74 lines not on this page · raw message

include/linux/of_irq.h +6 -0
index 535cecf..5cac5ce 100644
@@ -88,6 +88,12 @@ static inline void *of_irq_find_parent(struct device_node *child)
 {
 	return NULL;
 }
+
+static inline int of_irq_count(struct device_node *dev)
+{
+	return 0;
+}
+
 #endif /* !CONFIG_OF */
 
 #endif /* __OF_IRQ_H */