Commit 339e6e31 authored by William Breathitt Gray's avatar William Breathitt Gray Committed by Greg Kroah-Hartman

isa: Implement the module_isa_driver macro

The module_isa_driver macro is a helper macro for ISA drivers which do
not do anything special in module init/exit. This eliminates a lot of
boilerplate code. Each module may only use this macro once, and calling
it replaces module_init and module_exit.
Signed-off-by: default avatarWilliam Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0619f394
......@@ -36,4 +36,25 @@ static inline void isa_unregister_driver(struct isa_driver *d)
}
#endif
/**
* module_isa_driver() - Helper macro for registering a ISA driver
* @__isa_driver: isa_driver struct
* @__num_isa_dev: number of devices to register
*
* Helper macro for ISA drivers which do not do anything special in module
* init/exit. This eliminates a lot of boilerplate code. Each module may only
* use this macro once, and calling it replaces module_init and module_exit.
*/
#define module_isa_driver(__isa_driver, __num_isa_dev) \
static int __init __isa_driver##_init(void) \
{ \
return isa_register_driver(&(__isa_driver), __num_isa_dev); \
} \
module_init(__isa_driver##_init); \
static void __exit __isa_driver##_exit(void) \
{ \
isa_unregister_driver(&(__isa_driver)); \
} \
module_exit(__isa_driver##_exit);
#endif /* __LINUX_ISA_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment