[S390] cio: make wait_events interruptible

Make the potentially long blocking wait_event's used by the cio
settle mechanism interruptible.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
Sebastian Ott 2010-02-26 22:37:27 +01:00 committed by Martin Schwidefsky
parent b4563e891a
commit b4c707214c
3 changed files with 21 additions and 10 deletions

View File

@ -1016,19 +1016,22 @@ static int css_settle(struct device_driver *drv, void *unused)
struct css_driver *cssdrv = to_cssdriver(drv); struct css_driver *cssdrv = to_cssdriver(drv);
if (cssdrv->settle) if (cssdrv->settle)
cssdrv->settle(); return cssdrv->settle();
return 0; return 0;
} }
static inline void css_complete_work(void) static inline int css_complete_work(void)
{ {
int ret; int ret;
/* Wait for the evaluation of subchannels to finish. */ /* Wait for the evaluation of subchannels to finish. */
wait_event(css_eval_wq, atomic_read(&css_eval_scheduled) == 0); ret = wait_event_interruptible(css_eval_wq,
atomic_read(&css_eval_scheduled) == 0);
if (ret)
return -EINTR;
flush_workqueue(cio_work_q); flush_workqueue(cio_work_q);
/* Wait for the subchannel type specific initialization to finish */ /* Wait for the subchannel type specific initialization to finish */
ret = bus_for_each_drv(&css_bus_type, NULL, NULL, css_settle); return bus_for_each_drv(&css_bus_type, NULL, NULL, css_settle);
} }
@ -1049,10 +1052,13 @@ subsys_initcall_sync(channel_subsystem_init_sync);
static ssize_t cio_settle_write(struct file *file, const char __user *buf, static ssize_t cio_settle_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
int ret;
/* Handle pending CRW's. */ /* Handle pending CRW's. */
crw_wait_for_channel_report(); crw_wait_for_channel_report();
css_complete_work(); ret = css_complete_work();
return count;
return ret ? ret : count;
} }
static const struct file_operations cio_settle_proc_fops = { static const struct file_operations cio_settle_proc_fops = {

View File

@ -95,7 +95,7 @@ struct css_driver {
int (*freeze)(struct subchannel *); int (*freeze)(struct subchannel *);
int (*thaw) (struct subchannel *); int (*thaw) (struct subchannel *);
int (*restore)(struct subchannel *); int (*restore)(struct subchannel *);
void (*settle)(void); int (*settle)(void);
const char *name; const char *name;
}; };

View File

@ -158,11 +158,16 @@ static int io_subchannel_prepare(struct subchannel *sch)
return 0; return 0;
} }
static void io_subchannel_settle(void) static int io_subchannel_settle(void)
{ {
wait_event(ccw_device_init_wq, int ret;
atomic_read(&ccw_device_init_count) == 0);
ret = wait_event_interruptible(ccw_device_init_wq,
atomic_read(&ccw_device_init_count) == 0);
if (ret)
return -EINTR;
flush_workqueue(cio_work_q); flush_workqueue(cio_work_q);
return 0;
} }
static struct css_driver io_subchannel_driver = { static struct css_driver io_subchannel_driver = {