[PATCH v2 2/2] [POWERPC] Use new machine_xxx_initcall hooks in platform code

Arnd Bergmann arnd at arndb.de
Wed Dec 5 06:35:59 EST 2007


On Tuesday 04 December 2007, Grant Likely wrote:
> On 12/4/07, Grant Likely <grant.likely at secretlab.ca> wrote:
> > On 12/4/07, Geert Uytterhoeven <Geert.Uytterhoeven at sonycom.com> wrote:
> > > You seem to have missed the PS3 *_initcall()s.
> > > Probably because they test for firmware_has_feature(FW_FEATURE_PS3_LV1) instead
> > > of machine_is(ps3).
> >
> > That's exactly why; I didn't know if 'machine_is(ps3)' was a suitable
> > substitute so I left it alone.
> 
> On that topic; I left some pseries and iseries stuff alone also for
> the same reason.

Yes, and in many cases it's the right answer to base a decision on a specific
feature rather than a platform name, for two reasons:

1. If another platform gets added that uses the same firmware feature, it
will automatically do the right thing.

2. The call to firmware_has_feature() turns into a compile-time check in
many cases, so if the kernel does not contain support for any firmware
with the given feature, all the code referenced it can get optimized
away by the compiler.

If we have many cases where an initcall is done based on a specific fw-feature
or cpu-feature, we might want to add a similar initcall mechanism for those
along the lines of machine_xxx_initcall, but of course we should be sure
not to overengineer things here.

	Arnd <><



More information about the Linuxppc-dev mailing list