Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef S390_CCWGROUP_H |
| 2 | #define S390_CCWGROUP_H |
| 3 | |
| 4 | struct ccw_device; |
| 5 | struct ccw_driver; |
| 6 | |
| 7 | struct ccwgroup_device { |
| 8 | unsigned long creator_id; /* unique number of the driver */ |
| 9 | enum { |
| 10 | CCWGROUP_OFFLINE, |
| 11 | CCWGROUP_ONLINE, |
| 12 | } state; |
| 13 | atomic_t onoff; |
| 14 | unsigned int count; /* number of attached slave devices */ |
| 15 | struct device dev; /* master device */ |
| 16 | struct ccw_device *cdev[0]; /* variable number, allocate as needed */ |
| 17 | }; |
| 18 | |
| 19 | struct ccwgroup_driver { |
| 20 | struct module *owner; |
| 21 | char *name; |
| 22 | int max_slaves; |
| 23 | unsigned long driver_id; |
| 24 | |
| 25 | int (*probe) (struct ccwgroup_device *); |
| 26 | void (*remove) (struct ccwgroup_device *); |
| 27 | int (*set_online) (struct ccwgroup_device *); |
| 28 | int (*set_offline) (struct ccwgroup_device *); |
| 29 | |
| 30 | struct device_driver driver; /* this driver */ |
| 31 | }; |
| 32 | |
| 33 | extern int ccwgroup_driver_register (struct ccwgroup_driver *cdriver); |
| 34 | extern void ccwgroup_driver_unregister (struct ccwgroup_driver *cdriver); |
| 35 | extern int ccwgroup_create (struct device *root, |
| 36 | unsigned int creator_id, |
| 37 | struct ccw_driver *gdrv, |
| 38 | int argc, char *argv[]); |
| 39 | |
| 40 | extern int ccwgroup_probe_ccwdev(struct ccw_device *cdev); |
| 41 | extern void ccwgroup_remove_ccwdev(struct ccw_device *cdev); |
| 42 | |
| 43 | #define to_ccwgroupdev(x) container_of((x), struct ccwgroup_device, dev) |
| 44 | #define to_ccwgroupdrv(x) container_of((x), struct ccwgroup_driver, driver) |
| 45 | #endif |