diff options
author | Sebastian Ott <sebott@linux.vnet.ibm.com> | 2013-04-13 06:53:21 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2013-04-17 08:07:30 -0400 |
commit | 188561a462d3b82451d6ba09e2e32c9ba2c9938c (patch) | |
tree | ced10861aad02cad5cac0e232c8c85964dd2dc1f /drivers/s390/cio/device.c | |
parent | 91c15a951091a64a5f048ff93292057e3b590b6f (diff) |
s390/cio: wait_cons_dev don't use static variable
wait_cons_dev is used to busy wait for an interrupt on the console
ccw device. Stop using the static console_subchannel and add a
parameter to this function to specify on which ccw device/subchannel
we have to do the polling.
While at it rename the function to ccw_device_wait_idle and
move it to device.c
Reviewed-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
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.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index c6767f5a58b2..2e1e9086e916 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/list.h> | 19 | #include <linux/list.h> |
20 | #include <linux/device.h> | 20 | #include <linux/device.h> |
21 | #include <linux/workqueue.h> | 21 | #include <linux/workqueue.h> |
22 | #include <linux/delay.h> | ||
22 | #include <linux/timer.h> | 23 | #include <linux/timer.h> |
23 | #include <linux/kernel_stat.h> | 24 | #include <linux/kernel_stat.h> |
24 | 25 | ||
@@ -1612,13 +1613,15 @@ static int ccw_device_console_enable(struct ccw_device *cdev, | |||
1612 | /* Now wait for the async. recognition to come to an end. */ | 1613 | /* Now wait for the async. recognition to come to an end. */ |
1613 | spin_lock_irq(cdev->ccwlock); | 1614 | spin_lock_irq(cdev->ccwlock); |
1614 | while (!dev_fsm_final_state(cdev)) | 1615 | while (!dev_fsm_final_state(cdev)) |
1615 | wait_cons_dev(); | 1616 | ccw_device_wait_idle(cdev); |
1617 | |||
1616 | rc = -EIO; | 1618 | rc = -EIO; |
1617 | if (cdev->private->state != DEV_STATE_OFFLINE) | 1619 | if (cdev->private->state != DEV_STATE_OFFLINE) |
1618 | goto out_unlock; | 1620 | goto out_unlock; |
1619 | ccw_device_online(cdev); | 1621 | ccw_device_online(cdev); |
1620 | while (!dev_fsm_final_state(cdev)) | 1622 | while (!dev_fsm_final_state(cdev)) |
1621 | wait_cons_dev(); | 1623 | ccw_device_wait_idle(cdev); |
1624 | |||
1622 | if (cdev->private->state != DEV_STATE_ONLINE) | 1625 | if (cdev->private->state != DEV_STATE_ONLINE) |
1623 | goto out_unlock; | 1626 | goto out_unlock; |
1624 | rc = 0; | 1627 | rc = 0; |
@@ -1655,6 +1658,26 @@ ccw_device_probe_console(void) | |||
1655 | return &console_cdev; | 1658 | return &console_cdev; |
1656 | } | 1659 | } |
1657 | 1660 | ||
1661 | /** | ||
1662 | * ccw_device_wait_idle() - busy wait for device to become idle | ||
1663 | * @cdev: ccw device | ||
1664 | * | ||
1665 | * Poll until activity control is zero, that is, no function or data | ||
1666 | * transfer is pending/active. | ||
1667 | * Called with device lock being held. | ||
1668 | */ | ||
1669 | void ccw_device_wait_idle(struct ccw_device *cdev) | ||
1670 | { | ||
1671 | struct subchannel *sch = to_subchannel(cdev->dev.parent); | ||
1672 | |||
1673 | while (1) { | ||
1674 | cio_tsch(sch); | ||
1675 | if (sch->schib.scsw.cmd.actl == 0) | ||
1676 | break; | ||
1677 | udelay_simple(100); | ||
1678 | } | ||
1679 | } | ||
1680 | |||
1658 | static int ccw_device_pm_restore(struct device *dev); | 1681 | static int ccw_device_pm_restore(struct device *dev); |
1659 | 1682 | ||
1660 | int ccw_device_force_console(void) | 1683 | int ccw_device_force_console(void) |