All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Axel Lin <axel.lin@ingics.com>
Cc: Rob Herring <rob.herring@calxeda.com>,
	John Stultz <john.stultz@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org,
	Thomas Abraham <thomas.abraham@linaro.org>
Subject: Re: [PATCH] clocksource: Fix build error when !CONFIG_CLKSRC_OF
Date: Tue, 26 Mar 2013 09:24:24 +0000	[thread overview]
Message-ID: <201303260924.24549.arnd@arndb.de> (raw)
In-Reply-To: <1364272469.18836.1.camel@phoenix>

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 */

      reply	other threads:[~2013-03-26  9:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-26  4:34 [PATCH] clocksource: Fix build error when !CONFIG_CLKSRC_OF Axel Lin
2013-03-26  9:24 ` Arnd Bergmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201303260924.24549.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=axel.lin@ingics.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rob.herring@calxeda.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.abraham@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.