lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 26 Mar 2013 09:24:24 +0000
From:	Arnd Bergmann <arnd@...db.de>
To:	Axel Lin <axel.lin@...ics.com>
Cc:	Rob Herring <rob.herring@...xeda.com>,
	John Stultz <john.stultz@...aro.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	linux-kernel@...r.kernel.org,
	Thomas Abraham <thomas.abraham@...aro.org>
Subject: Re: [PATCH] clocksource: Fix build error when !CONFIG_CLKSRC_OF

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 */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ