[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <50ABDDEF.10403@wwwdotorg.org>
Date: Tue, 20 Nov 2012 12:45:51 -0700
From: Stephen Warren <swarren@...dotorg.org>
To: Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>
CC: John Stultz <johnstul@...ibm.com>,
Thomas Gleixner <tglx@...utronix.de>,
Arnd Bergmann <arnd@...db.de>, Olof Johansson <olof@...om.net>,
Josh Cartwright <josh.cartwright@...il.com>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-tegra@...r.kernel.org, Stephen Warren <swarren@...dia.com>
Subject: Re: [PATCH V3 1/2] clocksource: add common of_clksrc_init() function
On 11/20/2012 12:31 PM, Thomas Petazzoni wrote:
> Stephen,
>
> On Tue, 20 Nov 2012 12:20:05 -0700, Stephen Warren wrote:
>
>> It is desirable to move all clocksource drivers to drivers/clocksource,
>> yet each requires its own initialization function. We'd rather not
>> pollute <linux/> with a header for each function. Instead, create a
>> single of_clksrc_init() function which will determine which clocksource
>> driver to initialize based on device tree.
...
> The way I did things for irqchip is a bit different: I used the
> standard of_irq_init(), which requires a table that is terminated by a
> sentinel. In order to guarantee that I have a sentinel, I did:
>
> #define IRQCHIP_DECLARE(compstr,fn) \
> static const struct of_device_id irqchip_of_match \
> __used __section(.init.irqchip) \
> = { .compatible = compstr, .data = fn }
>
> which is used to declare all irq drivers. But then in the main
> irqchip.c file, I did:
>
> static const struct of_device_id
> irqchip_of_match_end __used __section(.init.irqchip.end);
>
> and my linker script looks like:
>
> .init.irqchip : {
> __irqchip_begin = .;
> *(.init.irqchip)
> *(.init.irqchip.end)
> }
>
> So I gather all the of_device_id definitions and then the special
> sentinel of_device_id. I don't know if it is better than your solution,
> or even if my solution is good at all.
That does have the advantage of constructing a single table for all
irqchips, rather than the approach in my patch was to construct an array
of pointers to those tables. Your approach is one less loop at runtime,
and one less sentinel and pointer data item per irqchip. Perhaps I
should convert mine to do the same thing, unless anyone gives feedback
against it.
--
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