diff options
author | Sebastian Ott <sebott@linux.vnet.ibm.com> | 2009-12-07 06:51:34 -0500 |
---|---|---|
committer | Martin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com> | 2009-12-07 06:51:32 -0500 |
commit | 24a1872d6411c7cce82c0888a4fbea23e993e051 (patch) | |
tree | 459d07c0b4da081a068b3e78cb1634876575c254 | |
parent | 7d253b9a1aaf5192808e641659f4feb122faa536 (diff) |
[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>
-rw-r--r-- | drivers/s390/cio/device.c | 6 | ||||
-rw-r--r-- | drivers/s390/cio/io_sch.h | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index f4401ede768a..e8cb99a63cc6 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) | |||
304 | static void ccw_device_unregister(struct ccw_device *cdev) | 304 | static void ccw_device_unregister(struct ccw_device *cdev) |
305 | { | 305 | { |
306 | if (device_is_registered(&cdev->dev)) { | 306 | if (device_is_registered(&cdev->dev)) { |
307 | /* Undo device_add(). */ | ||
307 | device_del(&cdev->dev); | 308 | device_del(&cdev->dev); |
309 | } | ||
310 | if (cdev->private->flags.initialized) { | ||
311 | cdev->private->flags.initialized = 0; | ||
308 | /* Release reference from device_initialize(). */ | 312 | /* Release reference from device_initialize(). */ |
309 | put_device(&cdev->dev); | 313 | put_device(&cdev->dev); |
310 | } | 314 | } |
@@ -716,6 +720,7 @@ static int io_subchannel_initialize_dev(struct subchannel *sch, | |||
716 | put_device(&cdev->dev); | 720 | put_device(&cdev->dev); |
717 | return -ENODEV; | 721 | return -ENODEV; |
718 | } | 722 | } |
723 | cdev->private->flags.initialized = 1; | ||
719 | return 0; | 724 | return 0; |
720 | } | 725 | } |
721 | 726 | ||
@@ -998,6 +1003,7 @@ static int io_subchannel_probe(struct subchannel *sch) | |||
998 | cdev = sch_get_cdev(sch); | 1003 | cdev = sch_get_cdev(sch); |
999 | cdev->dev.groups = ccwdev_attr_groups; | 1004 | cdev->dev.groups = ccwdev_attr_groups; |
1000 | device_initialize(&cdev->dev); | 1005 | device_initialize(&cdev->dev); |
1006 | cdev->private->flags.initialized = 1; | ||
1001 | ccw_device_register(cdev); | 1007 | ccw_device_register(cdev); |
1002 | /* | 1008 | /* |
1003 | * Check if the device is already online. If it is | 1009 | * Check if the device is already online. If it is |
diff --git a/drivers/s390/cio/io_sch.h b/drivers/s390/cio/io_sch.h index ca1063d6b505..dbc69a5a043e 100644 --- a/drivers/s390/cio/io_sch.h +++ b/drivers/s390/cio/io_sch.h | |||
@@ -167,6 +167,7 @@ struct ccw_device_private { | |||
167 | unsigned int resuming:1; /* recognition while resume */ | 167 | unsigned int resuming:1; /* recognition while resume */ |
168 | unsigned int pgroup:1; /* pathgroup is set up */ | 168 | unsigned int pgroup:1; /* pathgroup is set up */ |
169 | unsigned int mpath:1; /* multipathing is set up */ | 169 | unsigned int mpath:1; /* multipathing is set up */ |
170 | unsigned int initialized:1; /* set if initial reference held */ | ||
170 | } __attribute__((packed)) flags; | 171 | } __attribute__((packed)) flags; |
171 | unsigned long intparm; /* user interruption parameter */ | 172 | unsigned long intparm; /* user interruption parameter */ |
172 | struct qdio_irq *qdio_data; | 173 | struct qdio_irq *qdio_data; |