[PATCH] s390 (2/8): common i/o layer.

From: Martin Schwidefsky
Date: Tue Oct 21 2003 - 10:08:18 EST


- Correctly initialize all spin_locks with spin_lock_init.
- Use subchannel lock directly instead of ccw device lock pointer in
ccw_device_recognition to avoid accessing an already free structure.
- Take/release ccw device lock in ccw_device_console_enable.

diffstat:
drivers/s390/cio/cio.c | 3 ++-
drivers/s390/cio/device.c | 13 +++++++++----
2 files changed, 11 insertions(+), 5 deletions(-)

diff -urN linux-2.6/drivers/s390/cio/cio.c linux-2.6-s390/drivers/s390/cio/cio.c
--- linux-2.6/drivers/s390/cio/cio.c Fri Oct 17 23:43:35 2003
+++ linux-2.6-s390/drivers/s390/cio/cio.c Tue Oct 21 16:36:08 2003
@@ -1,7 +1,7 @@
/*
* drivers/s390/cio/cio.c
* S/390 common I/O routines -- low level i/o calls
- * $Revision: 1.105 $
+ * $Revision: 1.106 $
*
* Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH,
* IBM Corporation
@@ -512,6 +512,7 @@
/* Nuke all fields. */
memset(sch, 0, sizeof(struct subchannel));

+ spin_lock_init(&sch->lock);
/*
* The first subchannel that is not-operational (ccode==3)
* indicates that there aren't any more devices available.
diff -urN linux-2.6/drivers/s390/cio/device.c linux-2.6-s390/drivers/s390/cio/device.c
--- linux-2.6/drivers/s390/cio/device.c Fri Oct 17 23:43:24 2003
+++ linux-2.6-s390/drivers/s390/cio/device.c Tue Oct 21 16:36:08 2003
@@ -562,9 +562,9 @@
atomic_inc(&ccw_device_init_count);

/* Start async. device sensing. */
- spin_lock_irq(cdev->ccwlock);
+ spin_lock_irq(&sch->lock);
rc = ccw_device_recognition(cdev);
- spin_unlock_irq(cdev->ccwlock);
+ spin_unlock_irq(&sch->lock);
if (rc) {
if (atomic_dec_and_test(&ccw_device_init_count))
wake_up(&ccw_device_init_wq);
@@ -662,15 +662,20 @@
return rc;

/* Now wait for the async. recognition to come to an end. */
+ spin_lock_irq(cdev->ccwlock);
while (!dev_fsm_final_state(cdev))
wait_cons_dev();
+ rc = -EIO;
if (cdev->private->state != DEV_STATE_OFFLINE)
- return -EIO;
+ goto out_unlock;
ccw_device_online(cdev);
while (!dev_fsm_final_state(cdev))
wait_cons_dev();
if (cdev->private->state != DEV_STATE_ONLINE)
- return -EIO;
+ goto out_unlock;
+ rc = 0;
+out_unlock:
+ spin_unlock_irq(cdev->ccwlock);
return 0;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/