aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-04-04 02:51:08 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2012-04-04 12:25:44 -0400
commit45b2604eaaa105223ce60117b0482ca8a488f9c4 (patch)
tree0e08aff7f7a143819a21bd6ff8bd325c2bfc7770
parent65ac9f7a23c934ee8c40dc20955e75db4924bfea (diff)
Input: gameport - add helper macro for gameport_driver boilerplate
This patch introduces the module_gameport_driver macro which is a convenience macro for gameport driver modules similar to module_platform_driver. It is intended to be used by drivers which init/exit section does nothing but registers/unregisters the gameport driver. By using this macro it is possible to eliminate a few lines of boilerplate code per gameport driver. Based on work done by Lars-Peter Clausen <lars@metafoo.de> for other buses (i2c and spi). Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
-rw-r--r--include/linux/gameport.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/gameport.h b/include/linux/gameport.h
index b456b08d70ed..b986be513406 100644
--- a/include/linux/gameport.h
+++ b/include/linux/gameport.h
@@ -153,6 +153,19 @@ int __must_check __gameport_register_driver(struct gameport_driver *drv,
153 153
154void gameport_unregister_driver(struct gameport_driver *drv); 154void gameport_unregister_driver(struct gameport_driver *drv);
155 155
156/**
157 * module_gameport_driver() - Helper macro for registering a gameport driver
158 * @__gameport_driver: gameport_driver struct
159 *
160 * Helper macro for gameport drivers which do not do anything special in
161 * module init/exit. This eliminates a lot of boilerplate. Each module may
162 * only use this macro once, and calling it replaces module_init() and
163 * module_exit().
164 */
165#define module_gameport_driver(__gameport_driver) \
166 module_driver(__gameport_driver, gameport_register_driver, \
167 gameport_unregister_driver)
168
156#endif /* __KERNEL__ */ 169#endif /* __KERNEL__ */
157 170
158#define GAMEPORT_MODE_DISABLED 0 171#define GAMEPORT_MODE_DISABLED 0