summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Ott <sebott@linux.vnet.ibm.com>2009-12-07 12:51:33 +0100
committerMartin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com>2009-12-07 12:51:32 +0100
commit7d253b9a1aaf5192808e641659f4feb122faa536 (patch)
tree992c7bdfef42425d7af0390cb68a8e2070fe8b82
parentd7d12ef2befac4fed0dccaddff11338b654804df (diff)
downloadtalos-obmc-linux-7d253b9a1aaf5192808e641659f4feb122faa536.tar.gz
talos-obmc-linux-7d253b9a1aaf5192808e641659f4feb122faa536.zip
[S390] cio: remove registered flag from ccw_device_private
We used to maintain a "registered" flag in our ccw_device_private structure. This patch removes the "registered" flag and converts all users of it to device_is_registered which has the exact same meaning. Note: The usage the atomic operation test_and_clear_bit is replaced by the non-atomic if (device_is_registered()) device_del(). This will not do harm, since we serialize calls to ccw_device_unregister with a single-threaded workqueue. 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.c11
-rw-r--r--drivers/s390/cio/io_sch.h1
2 files changed, 3 insertions, 9 deletions
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index e24b9b1d1022..f4401ede768a 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -303,7 +303,7 @@ int ccw_device_is_orphan(struct ccw_device *cdev)
static void ccw_device_unregister(struct ccw_device *cdev)
{
- if (test_and_clear_bit(1, &cdev->private->registered)) {
+ if (device_is_registered(&cdev->dev)) {
device_del(&cdev->dev);
/* Release reference from device_initialize(). */
put_device(&cdev->dev);
@@ -640,12 +640,7 @@ static int ccw_device_register(struct ccw_device *cdev)
cdev->private->dev_id.devno);
if (ret)
return ret;
- ret = device_add(dev);
- if (ret)
- return ret;
-
- set_bit(1, &cdev->private->registered);
- return ret;
+ return device_add(dev);
}
static int match_dev_id(struct device *dev, void *data)
@@ -669,7 +664,7 @@ static void ccw_device_do_unbind_bind(struct ccw_device *cdev)
{
int ret;
- if (test_bit(1, &cdev->private->registered)) {
+ if (device_is_registered(&cdev->dev)) {
device_release_driver(&cdev->dev);
ret = device_attach(&cdev->dev);
WARN_ON(ret == -ENODEV);
diff --git a/drivers/s390/cio/io_sch.h b/drivers/s390/cio/io_sch.h
index 0559479073cc..ca1063d6b505 100644
--- a/drivers/s390/cio/io_sch.h
+++ b/drivers/s390/cio/io_sch.h
@@ -145,7 +145,6 @@ struct ccw_device_private {
struct subchannel *sch;
int state; /* device state */
atomic_t onoff;
- unsigned long registered;
struct ccw_dev_id dev_id; /* device id */
struct subchannel_id schid; /* subchannel number */
struct ccw_request req; /* internal I/O request */
OpenPOWER on IntegriCloud