Skip to content

Commit

Permalink
s390/ccwgroup: allow drivers to call set_{on,off}line
Browse files Browse the repository at this point in the history
Allow drivers to enable/disable ccwgroup devices.

Acked-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
Sebastian Ott authored and Martin Schwidefsky committed Nov 23, 2012
1 parent cff9710 commit 683c3dc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
3 changes: 3 additions & 0 deletions arch/s390/include/asm/ccwgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ extern void ccwgroup_driver_unregister (struct ccwgroup_driver *cdriver);
int ccwgroup_create_dev(struct device *root, struct ccwgroup_driver *gdrv,
int num_devices, const char *buf);

extern int ccwgroup_set_online(struct ccwgroup_device *gdev);
extern int ccwgroup_set_offline(struct ccwgroup_device *gdev);

extern int ccwgroup_probe_ccwdev(struct ccw_device *cdev);
extern void ccwgroup_remove_ccwdev(struct ccw_device *cdev);

Expand Down
22 changes: 20 additions & 2 deletions drivers/s390/cio/ccwgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,15 @@ static void __ccwgroup_remove_cdev_refs(struct ccwgroup_device *gdev)
}
}

static int ccwgroup_set_online(struct ccwgroup_device *gdev)
/**
* ccwgroup_set_online() - enable a ccwgroup device
* @gdev: target ccwgroup device
*
* This function attempts to put the ccwgroup device into the online state.
* Returns:
* %0 on success and a negative error value on failure.
*/
int ccwgroup_set_online(struct ccwgroup_device *gdev)
{
struct ccwgroup_driver *gdrv = to_ccwgroupdrv(gdev->dev.driver);
int ret = -EINVAL;
Expand All @@ -84,8 +92,17 @@ static int ccwgroup_set_online(struct ccwgroup_device *gdev)
atomic_set(&gdev->onoff, 0);
return ret;
}
EXPORT_SYMBOL(ccwgroup_set_online);

static int ccwgroup_set_offline(struct ccwgroup_device *gdev)
/**
* ccwgroup_set_offline() - disable a ccwgroup device
* @gdev: target ccwgroup device
*
* This function attempts to put the ccwgroup device into the offline state.
* Returns:
* %0 on success and a negative error value on failure.
*/
int ccwgroup_set_offline(struct ccwgroup_device *gdev)
{
struct ccwgroup_driver *gdrv = to_ccwgroupdrv(gdev->dev.driver);
int ret = -EINVAL;
Expand All @@ -104,6 +121,7 @@ static int ccwgroup_set_offline(struct ccwgroup_device *gdev)
atomic_set(&gdev->onoff, 0);
return ret;
}
EXPORT_SYMBOL(ccwgroup_set_offline);

static ssize_t ccwgroup_online_store(struct device *dev,
struct device_attribute *attr,
Expand Down

0 comments on commit 683c3dc

Please sign in to comment.