diff options
author | Vaishali Thakkar <vthakkar1994@gmail.com> | 2015-03-18 23:13:04 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-03-20 13:27:13 +0100 |
commit | c950a892cc302336d2a0900eba6d40ac0fb7cacb (patch) | |
tree | f3edbe51b2d535f2ef3166425eaba82dda3e4f9a | |
parent | f6b43c2e85c631a05ab8aece0cbde5e12deb0701 (diff) | |
download | op-kernel-dev-c950a892cc302336d2a0900eba6d40ac0fb7cacb.zip op-kernel-dev-c950a892cc302336d2a0900eba6d40ac0fb7cacb.tar.gz |
Staging: speakup: Add helper macro for spk_synth boilerplate
For simple modules that contain a single spk_synth without
any additional setup code then ends up being a block of
duplicated boilerplate. This patch adds a new macro,
module_spk_synth(), which replaces the
module_init()/module_exit() registrations with template
functions.
Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/speakup/spk_types.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/staging/speakup/spk_types.h b/drivers/staging/speakup/spk_types.h index 8c565c9..55d6c9b 100644 --- a/drivers/staging/speakup/spk_types.h +++ b/drivers/staging/speakup/spk_types.h @@ -16,6 +16,7 @@ #include <linux/spinlock.h> #include <linux/mutex.h> #include <linux/io.h> /* for inb_p, outb_p, inb, outb, etc... */ +#include <linux/device.h> enum var_type_t { VAR_NUM = 0, @@ -179,6 +180,16 @@ struct spk_synth { struct attribute_group attributes; }; +/** + * module_spk_synth() - Helper macro for registering a speakup driver + * @__spk_synth: spk_synth struct + * Helper macro for speakup 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_spk_synth(__spk_synth) \ + module_driver(__spk_synth, synth_add, synth_remove) + struct speakup_info_t { spinlock_t spinlock; int port_tts; |