[PATCH 08/10] macintosh: Use the new of_device common uevent handler

Sylvain Munaut tnt at 246tNt.com
Wed Mar 28 20:58:52 EST 2007


Johannes Berg wrote:
> On Tue, 2007-03-27 at 09:11 +0200, Sylvain Munaut wrote:
>
>> I had a look at sound/aoa/soundbus/i2sbus/i2sbus-core.c , which is the
>> only part of aoa with of_device_id and I see that it uses the
>> MODULE_ALIAS directly :
>> MODULE_ALIAS("of:Ni2sTi2sC");
>> instead of using
>> MODULE_DEVICE_TABLE(of, i2sbus_match);
>> and letting modpost do the job. Because that module alias is not the one
>> that's gonna be generated by modpost.
>
> Can you elaborate on that for me? If that's the incorrect thing to do I
> should probably change that :)
To avoid to the driver writer the burden of writing the module_alias
himself, there is
a mechanism to do it automatically.

You just add

MODULE_DEVICE_TABLE(of, i2sbus_match);

to your driver, with "of" being the bus type and i2sbus_match the match table used when registering the driver.

And during the modpost step of module compilation, the module_device_table will be use to magically generate the module_alias string. This also has the advantages that if the format of that string changes, you don't have to go change all the driver code but just the "of" bus handler in modpost.


	Sylvain





More information about the Linuxppc-dev mailing list