public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Greg KH <greg@kroah.com>,
	Grant Likely <grant.likely@secretlab.ca>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC] drivercore: Add helper macro for platform_driver boilerplate
Date: Sun, 04 Dec 2011 10:36:42 +0100	[thread overview]
Message-ID: <4EDB3F2A.4030801@metafoo.de> (raw)
In-Reply-To: <CAMuHMdWP+a0jXVBKzJ_J-Rtxdv=CFacDPz91fu=ThwSU_5dOeg@mail.gmail.com>

On 12/04/2011 09:39 AM, Geert Uytterhoeven wrote:
> On Wed, Oct 5, 2011 at 08:56, Greg KH <greg@kroah.com> 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@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.
>>>
>>> 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.
>

I've recently posted a patch series which extends the macro to take the bus's
register/unregister function names so it can be used to build macros similar to
module_platform_driver. [1] I used the register/unregister function names
instead of the bus type, exactly because there is no common naming convention
for these. So you still need to define the macro for a new bus type, but it
should be a two-liner.

- Lars

[1] https://lkml.org/lkml/2011/11/16/77

  reply	other threads:[~2011-12-04  9:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-04 23:26 [RFC] drivercore: Add helper macro for platform_driver boilerplate Grant Likely
2011-10-05  6:56 ` Greg KH
2011-10-05 16:43   ` Grant Likely
2011-10-05 19:29     ` Greg KH
2011-12-04  8:39   ` Geert Uytterhoeven
2011-12-04  9:36     ` Lars-Peter Clausen [this message]
2011-12-04 10:27       ` Geert Uytterhoeven
2011-10-05  8:12 ` Magnus Damm
2011-10-05 10:02 ` Mark Brown
2011-10-05 16:42   ` Grant Likely
2011-10-05 21:37 ` Stephen Boyd
2011-10-06  0:58   ` Grant Likely
2011-10-06 11:40 ` Jonathan Cameron
2011-10-06 14:50 ` Mike Frysinger
2011-10-06 18:35 ` Tabi Timur-B04825

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EDB3F2A.4030801@metafoo.de \
    --to=lars@metafoo.de \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=geert@linux-m68k.org \
    --cc=grant.likely@secretlab.ca \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox