diff options
Diffstat (limited to 'include/linux/isa.h')
-rw-r--r-- | include/linux/isa.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/include/linux/isa.h b/include/linux/isa.h index b0270e3814c8..5ab85281230b 100644 --- a/include/linux/isa.h +++ b/include/linux/isa.h | |||
@@ -36,4 +36,36 @@ static inline void isa_unregister_driver(struct isa_driver *d) | |||
36 | } | 36 | } |
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | /** | ||
40 | * module_isa_driver() - Helper macro for registering a ISA driver | ||
41 | * @__isa_driver: isa_driver struct | ||
42 | * @__num_isa_dev: number of devices to register | ||
43 | * | ||
44 | * Helper macro for ISA drivers which do not do anything special in module | ||
45 | * init/exit. This eliminates a lot of boilerplate code. Each module may only | ||
46 | * use this macro once, and calling it replaces module_init and module_exit. | ||
47 | */ | ||
48 | #define module_isa_driver(__isa_driver, __num_isa_dev) \ | ||
49 | static int __init __isa_driver##_init(void) \ | ||
50 | { \ | ||
51 | return isa_register_driver(&(__isa_driver), __num_isa_dev); \ | ||
52 | } \ | ||
53 | module_init(__isa_driver##_init); \ | ||
54 | static void __exit __isa_driver##_exit(void) \ | ||
55 | { \ | ||
56 | isa_unregister_driver(&(__isa_driver)); \ | ||
57 | } \ | ||
58 | module_exit(__isa_driver##_exit); | ||
59 | |||
60 | /** | ||
61 | * max_num_isa_dev() - Maximum possible number registered of an ISA device | ||
62 | * @__ida_dev_ext: ISA device address extent | ||
63 | * | ||
64 | * The highest base address possible for an ISA device is 0x3FF; this results in | ||
65 | * 1024 possible base addresses. Dividing the number of possible base addresses | ||
66 | * by the address extent taken by each device results in the maximum number of | ||
67 | * devices on a system. | ||
68 | */ | ||
69 | #define max_num_isa_dev(__isa_dev_ext) (1024 / __isa_dev_ext) | ||
70 | |||
39 | #endif /* __LINUX_ISA_H */ | 71 | #endif /* __LINUX_ISA_H */ |