1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef S390_CCWGROUP_H
3 #define S390_CCWGROUP_H
9 * struct ccwgroup_device - ccw group device
10 * @state: online/offline state
11 * @count: number of attached slave devices
12 * @dev: embedded device structure
13 * @cdev: variable number of slave devices, allocated as needed
14 * @ungroup_work: work to be done when a ccwgroup notifier has action
15 * type %BUS_NOTIFY_UNBIND_DRIVER
17 struct ccwgroup_device
{
24 struct mutex reg_mutex
;
28 struct work_struct ungroup_work
;
29 struct ccw_device
*cdev
[0];
33 * struct ccwgroup_driver - driver for ccw group devices
34 * @setup: function called during device creation to setup the device
35 * @remove: function called on remove
36 * @set_online: function called when device is set online
37 * @set_offline: function called when device is set offline
38 * @shutdown: function called when device is shut down
39 * @prepare: prepare for pm state transition
40 * @complete: undo work done in @prepare
41 * @freeze: callback for freezing during hibernation snapshotting
42 * @thaw: undo work done in @freeze
43 * @restore: callback for restoring after hibernation
44 * @driver: embedded driver structure
46 struct ccwgroup_driver
{
47 int (*setup
) (struct ccwgroup_device
*);
48 void (*remove
) (struct ccwgroup_device
*);
49 int (*set_online
) (struct ccwgroup_device
*);
50 int (*set_offline
) (struct ccwgroup_device
*);
51 void (*shutdown
)(struct ccwgroup_device
*);
52 int (*prepare
) (struct ccwgroup_device
*);
53 void (*complete
) (struct ccwgroup_device
*);
54 int (*freeze
)(struct ccwgroup_device
*);
55 int (*thaw
) (struct ccwgroup_device
*);
56 int (*restore
)(struct ccwgroup_device
*);
58 struct device_driver driver
;
61 extern int ccwgroup_driver_register (struct ccwgroup_driver
*cdriver
);
62 extern void ccwgroup_driver_unregister (struct ccwgroup_driver
*cdriver
);
63 int ccwgroup_create_dev(struct device
*root
, struct ccwgroup_driver
*gdrv
,
64 int num_devices
, const char *buf
);
66 extern int ccwgroup_set_online(struct ccwgroup_device
*gdev
);
67 extern int ccwgroup_set_offline(struct ccwgroup_device
*gdev
);
69 extern int ccwgroup_probe_ccwdev(struct ccw_device
*cdev
);
70 extern void ccwgroup_remove_ccwdev(struct ccw_device
*cdev
);
72 #define to_ccwgroupdev(x) container_of((x), struct ccwgroup_device, dev)
73 #define to_ccwgroupdrv(x) container_of((x), struct ccwgroup_driver, driver)