lkml.org 
[lkml]   [2011]   [Oct]   [5]   [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/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?

    --
    Sent by an employee of the Qualcomm Innovation Center, Inc.
    The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.



    \
     
     \ /
      Last update: 2011-10-05 23:39    [W:2.366 / U:0.068 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site