linux/arch/s390/include/asm/ccwgroup.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 */
   2#ifndef S390_CCWGROUP_H
   3#define S390_CCWGROUP_H
   4
   5struct ccw_device;
   6struct ccw_driver;
   7
   8/**
   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: used to ungroup the ccwgroup device
  15 */
  16struct ccwgroup_device {
  17        enum {
  18                CCWGROUP_OFFLINE,
  19                CCWGROUP_ONLINE,
  20        } state;
  21/* private: */
  22        atomic_t onoff;
  23        struct mutex reg_mutex;
  24/* public: */
  25        unsigned int count;
  26        struct device   dev;
  27        struct work_struct ungroup_work;
  28        struct ccw_device *cdev[0];
  29};
  30
  31/**
  32 * struct ccwgroup_driver - driver for ccw group devices
  33 * @setup: function called during device creation to setup the device
  34 * @remove: function called on remove
  35 * @set_online: function called when device is set online
  36 * @set_offline: function called when device is set offline
  37 * @shutdown: function called when device is shut down
  38 * @driver: embedded driver structure
  39 * @ccw_driver: supported ccw_driver (optional)
  40 */
  41struct ccwgroup_driver {
  42        int (*setup) (struct ccwgroup_device *);
  43        void (*remove) (struct ccwgroup_device *);
  44        int (*set_online) (struct ccwgroup_device *);
  45        int (*set_offline) (struct ccwgroup_device *);
  46        void (*shutdown)(struct ccwgroup_device *);
  47
  48        struct device_driver driver;
  49        struct ccw_driver *ccw_driver;
  50};
  51
  52extern int  ccwgroup_driver_register   (struct ccwgroup_driver *cdriver);
  53extern void ccwgroup_driver_unregister (struct ccwgroup_driver *cdriver);
  54int ccwgroup_create_dev(struct device *root, struct ccwgroup_driver *gdrv,
  55                        int num_devices, const char *buf);
  56struct ccwgroup_device *get_ccwgroupdev_by_busid(struct ccwgroup_driver *gdrv,
  57                                                 char *bus_id);
  58
  59extern int ccwgroup_set_online(struct ccwgroup_device *gdev);
  60extern int ccwgroup_set_offline(struct ccwgroup_device *gdev);
  61
  62extern int ccwgroup_probe_ccwdev(struct ccw_device *cdev);
  63extern void ccwgroup_remove_ccwdev(struct ccw_device *cdev);
  64
  65#define to_ccwgroupdev(x) container_of((x), struct ccwgroup_device, dev)
  66#define to_ccwgroupdrv(x) container_of((x), struct ccwgroup_driver, driver)
  67
  68#if IS_ENABLED(CONFIG_CCWGROUP)
  69bool dev_is_ccwgroup(struct device *dev);
  70#else /* CONFIG_CCWGROUP */
  71static inline bool dev_is_ccwgroup(struct device *dev)
  72{
  73        return false;
  74}
  75#endif /* CONFIG_CCWGROUP */
  76
  77#endif
  78