ccwgroup.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #ifndef S390_CCWGROUP_H
  2. #define S390_CCWGROUP_H
  3. struct ccw_device;
  4. struct ccw_driver;
  5. /**
  6. * struct ccwgroup_device - ccw group device
  7. * @state: online/offline state
  8. * @count: number of attached slave devices
  9. * @dev: embedded device structure
  10. * @cdev: variable number of slave devices, allocated as needed
  11. * @ungroup_work: work to be done when a ccwgroup notifier has action
  12. * type %BUS_NOTIFY_UNBIND_DRIVER
  13. */
  14. struct ccwgroup_device {
  15. enum {
  16. CCWGROUP_OFFLINE,
  17. CCWGROUP_ONLINE,
  18. } state;
  19. /* private: */
  20. atomic_t onoff;
  21. struct mutex reg_mutex;
  22. /* public: */
  23. unsigned int count;
  24. struct device dev;
  25. struct work_struct ungroup_work;
  26. struct ccw_device *cdev[0];
  27. };
  28. /**
  29. * struct ccwgroup_driver - driver for ccw group devices
  30. * @setup: function called during device creation to setup the device
  31. * @remove: function called on remove
  32. * @set_online: function called when device is set online
  33. * @set_offline: function called when device is set offline
  34. * @shutdown: function called when device is shut down
  35. * @prepare: prepare for pm state transition
  36. * @complete: undo work done in @prepare
  37. * @freeze: callback for freezing during hibernation snapshotting
  38. * @thaw: undo work done in @freeze
  39. * @restore: callback for restoring after hibernation
  40. * @driver: embedded driver structure
  41. */
  42. struct ccwgroup_driver {
  43. int (*setup) (struct ccwgroup_device *);
  44. void (*remove) (struct ccwgroup_device *);
  45. int (*set_online) (struct ccwgroup_device *);
  46. int (*set_offline) (struct ccwgroup_device *);
  47. void (*shutdown)(struct ccwgroup_device *);
  48. int (*prepare) (struct ccwgroup_device *);
  49. void (*complete) (struct ccwgroup_device *);
  50. int (*freeze)(struct ccwgroup_device *);
  51. int (*thaw) (struct ccwgroup_device *);
  52. int (*restore)(struct ccwgroup_device *);
  53. struct device_driver driver;
  54. };
  55. extern int ccwgroup_driver_register (struct ccwgroup_driver *cdriver);
  56. extern void ccwgroup_driver_unregister (struct ccwgroup_driver *cdriver);
  57. int ccwgroup_create_dev(struct device *root, struct ccwgroup_driver *gdrv,
  58. int num_devices, const char *buf);
  59. extern int ccwgroup_set_online(struct ccwgroup_device *gdev);
  60. extern int ccwgroup_set_offline(struct ccwgroup_device *gdev);
  61. extern int ccwgroup_probe_ccwdev(struct ccw_device *cdev);
  62. extern void ccwgroup_remove_ccwdev(struct ccw_device *cdev);
  63. #define to_ccwgroupdev(x) container_of((x), struct ccwgroup_device, dev)
  64. #define to_ccwgroupdrv(x) container_of((x), struct ccwgroup_driver, driver)
  65. #endif