Rene Herman | a5117ba7 | 2006-06-06 23:54:02 +0200 | [diff] [blame] | 1 | /* |
| 2 | * ISA bus. |
| 3 | */ |
| 4 | |
| 5 | #ifndef __LINUX_ISA_H |
| 6 | #define __LINUX_ISA_H |
| 7 | |
| 8 | #include <linux/device.h> |
| 9 | #include <linux/kernel.h> |
| 10 | |
| 11 | struct isa_driver { |
| 12 | int (*match)(struct device *, unsigned int); |
| 13 | int (*probe)(struct device *, unsigned int); |
| 14 | int (*remove)(struct device *, unsigned int); |
| 15 | void (*shutdown)(struct device *, unsigned int); |
| 16 | int (*suspend)(struct device *, unsigned int, pm_message_t); |
| 17 | int (*resume)(struct device *, unsigned int); |
| 18 | |
| 19 | struct device_driver driver; |
| 20 | struct device *devices; |
| 21 | }; |
| 22 | |
| 23 | #define to_isa_driver(x) container_of((x), struct isa_driver, driver) |
| 24 | |
William Breathitt Gray | 8ac0fba | 2016-05-01 17:50:29 -0400 | [diff] [blame] | 25 | #ifdef CONFIG_ISA |
Rene Herman | a5117ba7 | 2006-06-06 23:54:02 +0200 | [diff] [blame] | 26 | int isa_register_driver(struct isa_driver *, unsigned int); |
| 27 | void isa_unregister_driver(struct isa_driver *); |
Matthew Wilcox | fa890d5 | 2007-09-16 17:01:26 -0600 | [diff] [blame] | 28 | #else |
| 29 | static inline int isa_register_driver(struct isa_driver *d, unsigned int i) |
| 30 | { |
| 31 | return 0; |
| 32 | } |
| 33 | |
| 34 | static inline void isa_unregister_driver(struct isa_driver *d) |
| 35 | { |
| 36 | } |
| 37 | #endif |
Rene Herman | a5117ba7 | 2006-06-06 23:54:02 +0200 | [diff] [blame] | 38 | |
William Breathitt Gray | 339e6e3 | 2016-05-01 18:42:47 -0400 | [diff] [blame^] | 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 | |
Rene Herman | a5117ba7 | 2006-06-06 23:54:02 +0200 | [diff] [blame] | 60 | #endif /* __LINUX_ISA_H */ |