提交 45b2604e 编写于 作者: A Axel Lin 提交者: Dmitry Torokhov

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: NAxel Lin <axel.lin@gmail.com>
Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
上级 65ac9f7a
......@@ -153,6 +153,19 @@ int __must_check __gameport_register_driver(struct gameport_driver *drv,
void gameport_unregister_driver(struct gameport_driver *drv);
/**
* module_gameport_driver() - Helper macro for registering a gameport driver
* @__gameport_driver: gameport_driver struct
*
* Helper macro for gameport drivers which do not 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().
*/
#define module_gameport_driver(__gameport_driver) \
module_driver(__gameport_driver, gameport_register_driver, \
gameport_unregister_driver)
#endif /* __KERNEL__ */
#define GAMEPORT_MODE_DISABLED 0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册