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

From: Jonathan Cameron
Date: Thu Oct 06 2011 - 07:32:15 EST


On 10/05/11 00:26, 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.
Excellent idea. Great to shrink this boilerplate where ever you can.
i2c and spi version would be excellent. Look to be 426 instances
(I haven't checked but most are of the standard trivial form). So that is
another few thousand lines gone. It's getting on for 500 in IIO alone where
they are all of the trivial form, so this will make me very happy :)

Thanks Grant!

Jonathan
--
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/