All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clocksource: Fix build error when !CONFIG_CLKSRC_OF
@ 2013-03-26  4:34 Axel Lin
  2013-03-26  9:24 ` Arnd Bergmann
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2013-03-26  4:34 UTC (permalink / raw)
  To: Arnd Bergmann, Rob Herring; +Cc: John Stultz, Thomas Gleixner, linux-kernel

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".

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 include/linux/clocksource.h |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index ac33184..b84a2f3 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -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 */
-- 
1.7.10.4




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] clocksource: Fix build error when !CONFIG_CLKSRC_OF
  2013-03-26  4:34 [PATCH] clocksource: Fix build error when !CONFIG_CLKSRC_OF Axel Lin
@ 2013-03-26  9:24 ` Arnd Bergmann
  0 siblings, 0 replies; 2+ messages in thread
From: Arnd Bergmann @ 2013-03-26  9:24 UTC (permalink / raw)
  To: Axel Lin
  Cc: Rob Herring, John Stultz, Thomas Gleixner, linux-kernel,
	Thomas Abraham

On Tuesday 26 March 2013, Axel Lin wrote:
> 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.

diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index ac33184..818be77 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -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.

diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c
index 203ac05..fc95114 100644
--- a/drivers/clocksource/exynos_mct.c
+++ b/drivers/clocksource/exynos_mct.c
@@ -511,48 +511,37 @@ static void __init exynos4_timer_resources(struct device_node *np)
 #endif /* CONFIG_LOCAL_TIMERS */
 }
 
-static const struct of_device_id exynos_mct_ids[] = {
-	{ .compatible = "samsung,exynos4210-mct", .data = (void *)MCT_INT_SPI },
-	{ .compatible = "samsung,exynos4412-mct", .data = (void *)MCT_INT_PPI },
-};
-
-void __init mct_init(void)
+static void __init mct_init(struct device_node *np)
 {
-	struct device_node *np = NULL;
-	const struct of_device_id *match;
 	u32 nr_irqs, i;
 
-#ifdef CONFIG_OF
-	np = of_find_matching_node_and_match(NULL, exynos_mct_ids, &match);
-#endif
-	if (np) {
-		mct_int_type = (u32)(match->data);
-
-		/* This driver uses only one global timer interrupt */
-		mct_irqs[MCT_G0_IRQ] = irq_of_parse_and_map(np, MCT_G0_IRQ);
-
-		/*
-		 * Find out the number of local irqs specified. The local
-		 * timer irqs are specified after the four global timer
-		 * irqs are specified.
-		 */
-#ifdef CONFIG_OF
-		nr_irqs = of_irq_count(np);
-#endif
-		for (i = MCT_L0_IRQ; i < nr_irqs; i++)
-			mct_irqs[i] = irq_of_parse_and_map(np, i);
-	} else if (soc_is_exynos4210()) {
-		mct_irqs[MCT_G0_IRQ] = EXYNOS4_IRQ_MCT_G0;
-		mct_irqs[MCT_L0_IRQ] = EXYNOS4_IRQ_MCT_L0;
-		mct_irqs[MCT_L1_IRQ] = EXYNOS4_IRQ_MCT_L1;
-		mct_int_type = MCT_INT_SPI;
-	} else {
-		panic("unable to determine mct controller type\n");
-	}
+	/* This driver uses only one global timer interrupt */
+	mct_irqs[MCT_G0_IRQ] = irq_of_parse_and_map(np, MCT_G0_IRQ);
+
+	/*
+	 * Find out the number of local irqs specified. The local
+	 * timer irqs are specified after the four global timer
+	 * irqs are specified.
+	 */
+	nr_irqs = of_irq_count(np);
+	for (i = MCT_L0_IRQ; i < nr_irqs; i++)
+		mct_irqs[i] = irq_of_parse_and_map(np, i);
 
 	exynos4_timer_resources(np);
 	exynos4_clocksource_init();
 	exynos4_clockevent_init();
 }
-CLOCKSOURCE_OF_DECLARE(exynos4210, "samsung,exynos4210-mct", mct_init)
-CLOCKSOURCE_OF_DECLARE(exynos4412, "samsung,exynos4412-mct", mct_init)
+
+static void __init exynos4210_mct_init(struct device_node *np)
+{
+	mct_int_type = MCT_INT_SPI;
+	mct_init(np);
+}
+CLOCKSOURCE_OF_DECLARE(exynos4210, "samsung,exynos4210-mct", exynos4210_mct_init);
+
+static void __init exynos4412_mct_init(struct device_node *np)
+{
+	mct_int_type = MCT_INT_PPI;
+	mct_init(np);
+}
+CLOCKSOURCE_OF_DECLARE(exynos4412, "samsung,exynos4412-mct", exynos4412_mct_init);

diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index 535cecf..5cac5ce 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -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 */

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-26  9:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-26  4:34 [PATCH] clocksource: Fix build error when !CONFIG_CLKSRC_OF Axel Lin
2013-03-26  9:24 ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.