Thread (65 messages) flat view 65 messages, 10 authors, 2011-07-19
STALE5538d

[PATCH 16/17] mach-sa1100: retire custom LED code

From: Bryan Wu <hidden>
Date: 2011-07-12 00:31:28

On Tue, Jul 12, 2011 at 5:52 AM, Arnd Bergmann [off-list ref] wrote:
On Monday 11 July 2011, Russell King - ARM Linux wrote:
quoted
On Mon, Jul 11, 2011 at 10:36:49PM +0800, Bryan Wu wrote:
quoted
Right, I got it. So if we are going to run a single binary for all the
sa1100 machines, how about we check the machine in each fs_initcall

static int __init assabet_leds_init(void)
{
? ? ?int i;

? ? ?if (!machine_is_assabet())
? ? ? ? ? return -ENODEV,

? ? ?for (i = 0; i < ARRAY_SIZE(assabet_leds); i++) {
? ? ? ? ? ? ?struct assabet_led *led;
Yes, that'll do, thanks.
Do you think it's worth copying the logic from powerpc for this?


arch/powerpc/include/asm/machdep.h:
#define __define_machine_initcall(mach,level,fn,id) \
? ? ? ?static int __init __machine_initcall_##mach##_##fn(void) { \
? ? ? ? ? ? ? ?if (machine_is(mach)) return fn(); \
? ? ? ? ? ? ? ?return 0; \
? ? ? ?} \
? ? ? ?__define_initcall(level,__machine_initcall_##mach##_##fn,id);
#define machine_core_initcall(mach,fn) ? ? ? ? ?__define_machine_initcall(mach,"1",fn,1)
#define machine_core_initcall_sync(mach,fn) ? ? __define_machine_initcall(mach,"1s",fn,1s)
#define machine_postcore_initcall(mach,fn) ? ? ?__define_machine_initcall(mach,"2",fn,2)
#define machine_postcore_initcall_sync(mach,fn) __define_machine_initcall(mach,"2s",fn,2s)
#define machine_arch_initcall(mach,fn) ? ? ? ? ?__define_machine_initcall(mach,"3",fn,3)
#define machine_arch_initcall_sync(mach,fn) ? ? __define_machine_initcall(mach,"3s",fn,3s)
#define machine_subsys_initcall(mach,fn) ? ? ? ?__define_machine_initcall(mach,"4",fn,4)
#define machine_subsys_initcall_sync(mach,fn) ? __define_machine_initcall(mach,"4s",fn,4s)
#define machine_fs_initcall(mach,fn) ? ? ? ? ? ?__define_machine_initcall(mach,"5",fn,5)
#define machine_fs_initcall_sync(mach,fn) ? ? ? __define_machine_initcall(mach,"5s",fn,5s)
#define machine_rootfs_initcall(mach,fn) ? ? ? ?__define_machine_initcall(mach,"rootfs",fn,rootfs)
#define machine_device_initcall(mach,fn) ? ? ? ?__define_machine_initcall(mach,"6",fn,6)
#define machine_device_initcall_sync(mach,fn) ? __define_machine_initcall(mach,"6s",fn,6s)
#define machine_late_initcall(mach,fn) ? ? ? ? ?__define_machine_initcall(mach,"7",fn,7)
#define machine_late_initcall_sync(mach,fn) ? ? __define_machine_initcall(mach,"7s",fn,7s)

I don't really like the magic macros, but my feeling is that it's easier
to do the conversion without introducing subtle bugs this way.
I think this is a great idea. what about moving it to include/asm-generic/

Thanks,
-- 
Bryan Wu [off-list ref]
Kernel Developer ? ?+86.138-1617-6545 Mobile
Ubuntu Kernel Team
Canonical Ltd. ? ? ?www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help