Commit cff97102 authored by Sebastian Ott's avatar Sebastian Ott Committed by Martin Schwidefsky

s390/ccwgroup: set_online return error when already online

Return -EINVAL if set_{on,off}line is called for already {on,off}line
devices. Also return -EINVAL for drivers which do not provide a callback
for set_{on,off}line. This behaviour is now consistent with the one for
ccw devices.
Reported-by: default avatarStefan Raspl <raspl@linux.vnet.ibm.com>
Signed-off-by: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
Acked-by: default avatarPeter Oberparleiter <peter.oberparleiter@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent ce6a04ac
...@@ -68,7 +68,7 @@ static void __ccwgroup_remove_cdev_refs(struct ccwgroup_device *gdev) ...@@ -68,7 +68,7 @@ static void __ccwgroup_remove_cdev_refs(struct ccwgroup_device *gdev)
static int ccwgroup_set_online(struct ccwgroup_device *gdev) static int ccwgroup_set_online(struct ccwgroup_device *gdev)
{ {
struct ccwgroup_driver *gdrv = to_ccwgroupdrv(gdev->dev.driver); struct ccwgroup_driver *gdrv = to_ccwgroupdrv(gdev->dev.driver);
int ret = 0; int ret = -EINVAL;
if (atomic_cmpxchg(&gdev->onoff, 0, 1) != 0) if (atomic_cmpxchg(&gdev->onoff, 0, 1) != 0)
return -EAGAIN; return -EAGAIN;
...@@ -88,7 +88,7 @@ static int ccwgroup_set_online(struct ccwgroup_device *gdev) ...@@ -88,7 +88,7 @@ static int ccwgroup_set_online(struct ccwgroup_device *gdev)
static int ccwgroup_set_offline(struct ccwgroup_device *gdev) static int ccwgroup_set_offline(struct ccwgroup_device *gdev)
{ {
struct ccwgroup_driver *gdrv = to_ccwgroupdrv(gdev->dev.driver); struct ccwgroup_driver *gdrv = to_ccwgroupdrv(gdev->dev.driver);
int ret = 0; int ret = -EINVAL;
if (atomic_cmpxchg(&gdev->onoff, 0, 1) != 0) if (atomic_cmpxchg(&gdev->onoff, 0, 1) != 0)
return -EAGAIN; return -EAGAIN;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment