Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1373456
| From | William Breathitt Gray <vilhelm.gray@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 01/10] isa: Implement the module_isa_driver macro |
| Date | 2016-04-07 16:50 +0200 |
| Message-ID | <rljpV-5mp-47@gated-at.bofh.it> (permalink) |
| References | <rljpT-5mp-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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: William Breathitt Gray <vilhelm.gray@gmail.com>
---
include/linux/isa.h | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/include/linux/isa.h b/include/linux/isa.h
index 2a02862..d410259 100644
--- a/include/linux/isa.h
+++ b/include/linux/isa.h
@@ -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 */
--
2.7.3
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/10] Use the ISA bus driver for PC/104 and ISA devices William Breathitt Gray <vilhelm.gray@gmail.com> - 2016-04-07 16:50 +0200
[PATCH 01/10] isa: Implement the module_isa_driver macro William Breathitt Gray <vilhelm.gray@gmail.com> - 2016-04-07 16:50 +0200
[PATCH 06/10] watchdog: ebc-c384_wdt: Utilize the ISA bus driver William Breathitt Gray <vilhelm.gray@gmail.com> - 2016-04-07 16:50 +0200
Re: [PATCH 06/10] watchdog: ebc-c384_wdt: Utilize the ISA bus driver Guenter Roeck <linux@roeck-us.net> - 2016-04-08 02:40 +0200
Re: [PATCH 06/10] watchdog: ebc-c384_wdt: Utilize the ISA bus driver William Breathitt Gray <vilhelm.gray@gmail.com> - 2016-04-08 14:10 +0200
[PATCH 04/10] iio: stx104: Change STX104 dependency to ISA_BUS William Breathitt Gray <vilhelm.gray@gmail.com> - 2016-04-07 17:00 +0200
Re: [PATCH 04/10] iio: stx104: Change STX104 dependency to ISA_BUS Guenter Roeck <linux@roeck-us.net> - 2016-04-08 02:50 +0200
Re: [PATCH 04/10] iio: stx104: Change STX104 dependency to ISA_BUS William Breathitt Gray <vilhelm.gray@gmail.com> - 2016-04-08 14:40 +0200
Re: [PATCH 04/10] iio: stx104: Change STX104 dependency to ISA_BUS Guenter Roeck <linux@roeck-us.net> - 2016-04-08 15:20 +0200
Re: [PATCH 04/10] iio: stx104: Change STX104 dependency to ISA_BUS William Breathitt Gray <vilhelm.gray@gmail.com> - 2016-04-08 17:20 +0200
Re: [PATCH 04/10] iio: stx104: Change STX104 dependency to ISA_BUS Guenter Roeck <linux@roeck-us.net> - 2016-04-08 20:30 +0200
Re: [PATCH 04/10] iio: stx104: Change STX104 dependency to ISA_BUS William Breathitt Gray <vilhelm.gray@gmail.com> - 2016-04-08 21:30 +0200
Re: [PATCH 04/10] iio: stx104: Change STX104 dependency to ISA_BUS One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-04-09 15:00 +0200
Re: [PATCH 04/10] iio: stx104: Change STX104 dependency to ISA_BUS William Breathitt Gray <vilhelm.gray@gmail.com> - 2016-04-09 16:00 +0200
Re: [PATCH 04/10] iio: stx104: Change STX104 dependency to ISA_BUS One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-04-09 18:00 +0200
[PATCH 02/10] isa: Implement the max_num_isa_dev macro William Breathitt Gray <vilhelm.gray@gmail.com> - 2016-04-07 17:00 +0200
Re: [PATCH 00/10] Use the ISA bus driver for PC/104 and ISA devices Linus Walleij <linus.walleij@linaro.org> - 2016-04-11 09:00 +0200
csiph-web