[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111006005831.GA18276@ponder.secretlab.ca>
Date: Wed, 5 Oct 2011 18:58:31 -0600
From: Grant Likely <grant.likely@...retlab.ca>
To: Stephen Boyd <sboyd@...eaurora.org>
Cc: greg@...ah.com, Mark Brown <broonie@...nsource.wolfsonmicro.com>,
linux-kernel@...r.kernel.org
Subject: Re: [RFC] drivercore: Add helper macro for platform_driver
boilerplate
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists