Re: [RFC] drivercore: Add helper macro for platform_driver boilerplate

From: Geert Uytterhoeven
Date: Sun Dec 04 2011 - 03:39:20 EST


On Wed, Oct 5, 2011 at 08:56, Greg KH <greg@xxxxxxxxx> wrote:
> On Tue, Oct 04, 2011 at 05:26:55PM -0600, Grant Likely wrote:
>> For simple modules that contain a single platform_driver without any
>> additional setup code then ends up being a block of duplicated
>> boilerplate. ÂThis patch adds a new macro, module_platform_driver(),
>> which replaces the module_init()/module_exit() registrations with
>> template functions.
>>
>> This patch also converts all the relevant spi drivers to use the new
>> macro. ÂThere are a lot of drivers in the tree that are using this
>> pattern and could be converted.
>>
>> It also fixes up some incorrect section annotations where I found
>> them.
>>
>> Signed-off-by: Grant Likely <grant.likely@xxxxxxxxxxxx>
>> ---
>>
>> I think this is useful, and I like the diffstat that it produces.
>> What does everyone else think of this approach? ÂI can do versions for
>> i2c_drivers and spi_drivers too.
>>
>> This is *not* tested very much. ÂI'm circulating mostly for review for
>> now.
>
> The idea looks sane to me, I like the diffstat it ends up creating, nice
> job.

I guess the macro can be extended (or wrapped around another one) to include
the bus type, so it applies to all bus types?

It's a pity some use <bus>_register_driver(), while others use
<bus>_driver_register(),
so this needs some refactoring for unification.

Gr{oetje,eeting}s,

            Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
             Â Â -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/