Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 280027
b: refs/heads/master
c: 907d0ed
h: refs/heads/master
i:
  280025: e403142
  280023: 02391ba
v: v3
  • Loading branch information
Lars-Peter Clausen authored and Greg Kroah-Hartman committed Nov 17, 2011
1 parent aca1f6c commit 240cd28
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 377195c438fc5e9e4ca59e69382c10771d817d6a
refs/heads/master: 907d0ed1c84114d4e8dafd66af982515d3739c90
21 changes: 21 additions & 0 deletions trunk/include/linux/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -922,4 +922,25 @@ extern long sysfs_deprecated;
#define sysfs_deprecated 0
#endif

/**
* module_driver() - Helper macro for drivers that don't do anything
* special in module init/exit. This eliminates a lot of boilerplate.
* Each module may only use this macro once, and calling it replaces
* module_init() and module_exit().
*
* Use this macro to construct bus specific macros for registering
* drivers, and do not use it on its own.
*/
#define module_driver(__driver, __register, __unregister) \
static int __init __driver##_init(void) \
{ \
return __register(&(__driver)); \
} \
module_init(__driver##_init); \
static void __exit __driver##_exit(void) \
{ \
__unregister(&(__driver)); \
} \
module_exit(__driver##_exit);

#endif /* _DEVICE_H_ */
12 changes: 2 additions & 10 deletions trunk/include/linux/platform_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,8 @@ static inline void platform_set_drvdata(struct platform_device *pdev, void *data
* calling it replaces module_init() and module_exit()
*/
#define module_platform_driver(__platform_driver) \
static int __init __platform_driver##_init(void) \
{ \
return platform_driver_register(&(__platform_driver)); \
} \
module_init(__platform_driver##_init); \
static void __exit __platform_driver##_exit(void) \
{ \
platform_driver_unregister(&(__platform_driver)); \
} \
module_exit(__platform_driver##_exit);
module_driver(__platform_driver, platform_driver_register, \
platform_driver_unregister)

extern struct platform_device *platform_create_bundle(struct platform_driver *driver,
int (*probe)(struct platform_device *),
Expand Down

0 comments on commit 240cd28

Please sign in to comment.