From: Grant Likely <grant.likely@secretlab.ca>
To: Stephen Boyd <sboyd@codeaurora.org>
Cc: greg@kroah.com, Mark Brown <broonie@opensource.wolfsonmicro.com>,
linux-kernel@vger.kernel.org
Subject: Re: [RFC] drivercore: Add helper macro for platform_driver boilerplate
Date: Wed, 5 Oct 2011 18:58:31 -0600 [thread overview]
Message-ID: <20111006005831.GA18276@ponder.secretlab.ca> (raw)
In-Reply-To: <4E8CCE22.9050205@codeaurora.org>
On Wed, Oct 05, 2011 at 02:37:38PM -0700, Stephen Boyd wrote:
> On 10/04/11 16:26, Grant Likely wrote:
> > diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
> > index 27bb05a..991a678 100644
> > --- a/include/linux/platform_device.h
> > +++ b/include/linux/platform_device.h
> > @@ -146,6 +146,21 @@ static inline void platform_set_drvdata(struct platform_device *pdev, void *data
> > dev_set_drvdata(&pdev->dev, data);
> > }
> >
> > +/* Helper macro for drivers that don't do anything special in module
> > + * init/exit. This eliminates a lot of boilerplate */
> > +#define module_platform_driver(__platform_driver) \
> > +int __platform_driver##_init(void) \
> > +{ \
> > + return platform_driver_register(&(__platform_driver)); \
> > +} \
> > +module_init(__platform_driver##_init); \
> > +void __platform_driver##_exit(void) \
> > +{ \
> > + platform_driver_unregister(&(__platform_driver)); \
> > +} \
> > +module_exit(__platform_driver##_exit);
> > +
> > +
> >
>
> Can you add __init, __exit, and static as well?
Done, thanks for the review.
g.
next prev parent reply other threads:[~2011-10-06 2:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-04 23:26 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
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 [this message]
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=20111006005831.GA18276@ponder.secretlab.ca \
--to=grant.likely@secretlab.ca \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sboyd@codeaurora.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
all inboxes | Powered by JetHome®