diff options
author | Axel Lin <axel.lin@gmail.com> | 2012-04-03 23:50:15 -0700 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-04-04 09:25:42 -0700 |
commit | fa7f86d157781515b74d658120552eafd890f4de (patch) | |
tree | c8df732db0ec59dc7756f3626eb928eb757b78c5 /include/linux/serio.h | |
parent | ae584ca473289377dd7fd8c61439db4bfab5489a (diff) | |
download | op-kernel-dev-fa7f86d157781515b74d658120552eafd890f4de.zip op-kernel-dev-fa7f86d157781515b74d658120552eafd890f4de.tar.gz |
Input: serio - add helper macro for serio_driver boilerplate
This patch introduces the module_serio_driver macro which is a
convenience macro for serio 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 serio driver. By using this macro it is possible to eliminate
a few lines of boilerplate code per serio 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>
Diffstat (limited to 'include/linux/serio.h')
-rw-r--r-- | include/linux/serio.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/serio.h b/include/linux/serio.h index ca82861..6d6cfd3 100644 --- a/include/linux/serio.h +++ b/include/linux/serio.h @@ -96,6 +96,19 @@ int __must_check __serio_register_driver(struct serio_driver *drv, void serio_unregister_driver(struct serio_driver *drv); +/** + * module_serio_driver() - Helper macro for registering a serio driver + * @__serio_driver: serio_driver struct + * + * Helper macro for serio 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_serio_driver(__serio_driver) \ + module_driver(__serio_driver, serio_register_driver, \ + serio_unregister_driver) + static inline int serio_write(struct serio *serio, unsigned char data) { if (serio->write) |