lkml.org 
[lkml]   [2011]   [Oct]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] drivercore: Add helper macro for platform_driver boilerplate
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@secretlab.ca>
> ---
>
> 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


\
 
 \ /
  Last update: 2011-10-06 13:35    [W:0.179 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site