aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/cio/device.c
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2009-12-07 12:51:34 +0100
committerMartin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com>2009-12-07 12:51:32 +0100
commit24a1872d6411c7cce82c0888a4fbea23e993e051 (patch)
tree459d07c0b4da081a068b3e78cb1634876575c254 /drivers/s390/cio/device.c
parent7d253b9a1aaf5192808e641659f4feb122faa536 (diff)
downloadkernel_samsung_smdk4412-24a1872d6411c7cce82c0888a4fbea23e993e051.zip
kernel_samsung_smdk4412-24a1872d6411c7cce82c0888a4fbea23e993e051.tar.gz
kernel_samsung_smdk4412-24a1872d6411c7cce82c0888a4fbea23e993e051.tar.bz2
[S390] cio: add per device initialization status flag
The function ccw_device_unregister has to ensure to remove all references obtained by device_add and device_initialize. Unfortunately it gets called for devices which are 1) uninitialized, 2) initialized but unregistered, and 3) registered devices. To distinguish 1) and 2) this patch introduces a new flag "initialized", which is 1 as long as we hold the initial device reference. Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/cio/device.c')
-rw-r--r--drivers/s390/cio/device.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index f4401ed..e8cb99a 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -304,7 +304,11 @@ int ccw_device_is_orphan(struct ccw_device *cdev)
static void ccw_device_unregister(struct ccw_device *cdev)
{
if (device_is_registered(&cdev->dev)) {
+ /* Undo device_add(). */
device_del(&cdev->dev);
+ }
+ if (cdev->private->flags.initialized) {
+ cdev->private->flags.initialized = 0;
/* Release reference from device_initialize(). */
put_device(&cdev->dev);
}
@@ -716,6 +720,7 @@ static int io_subchannel_initialize_dev(struct subchannel *sch,
put_device(&cdev->dev);
return -ENODEV;
}
+ cdev->private->flags.initialized = 1;
return 0;
}
@@ -998,6 +1003,7 @@ static int io_subchannel_probe(struct subchannel *sch)
cdev = sch_get_cdev(sch);
cdev->dev.groups = ccwdev_attr_groups;
device_initialize(&cdev->dev);
+ cdev->private->flags.initialized = 1;
ccw_device_register(cdev);
/*
* Check if the device is already online. If it is