diff options
author | Sebastian Ott <sebott@linux.vnet.ibm.com> | 2010-02-26 22:37:25 +0100 |
---|---|---|
committer | Martin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com> | 2010-02-26 22:37:29 +0100 |
commit | 879acca58a904c25487c89ab11e23eb556fb13d3 (patch) | |
tree | 6b645121090442eb74807ad8388f9986b551def3 /drivers/s390/cio | |
parent | be5d3823f29c09676abd2eeea4f9767bc4a1a531 (diff) |
[S390] cio: introduce cio_settle
This patch introduces a proc file cio_settle. A write request to
this file is blocked until all queued cio actions are handled.
This will allow userspace to wait for pending work affecting
device availability after changing cio_ignore or the hardware
configuration.
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')
-rw-r--r-- | drivers/s390/cio/css.c | 47 |
1 files changed, 42 insertions, 5 deletions
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index 99fcf9d0ea14..366affcd9bbf 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c @@ -18,6 +18,7 @@ #include <linux/list.h> #include <linux/reboot.h> #include <linux/suspend.h> +#include <linux/proc_fs.h> #include <asm/isc.h> #include <asm/crw.h> @@ -1019,6 +1020,18 @@ static int css_settle(struct device_driver *drv, void *unused) return 0; } +static inline void css_complete_work(void) +{ + int ret; + + /* Wait for the evaluation of subchannels to finish. */ + wait_event(css_eval_wq, atomic_read(&css_eval_scheduled) == 0); + flush_workqueue(cio_work_q); + /* Wait for the subchannel type specific initialization to finish */ + ret = bus_for_each_drv(&css_bus_type, NULL, NULL, css_settle); +} + + /* * Wait for the initialization of devices to finish, to make sure we are * done with our setup if the search for the root device starts. @@ -1027,14 +1040,38 @@ static int __init channel_subsystem_init_sync(void) { /* Start initial subchannel evaluation. */ css_schedule_eval_all(); - /* Wait for the evaluation of subchannels to finish. */ - wait_event(css_eval_wq, atomic_read(&css_eval_scheduled) == 0); - flush_workqueue(cio_work_q); - /* Wait for the subchannel type specific initialization to finish */ - return bus_for_each_drv(&css_bus_type, NULL, NULL, css_settle); + css_complete_work(); + return 0; } subsys_initcall_sync(channel_subsystem_init_sync); +#ifdef CONFIG_PROC_FS +static ssize_t cio_settle_write(struct file *file, const char __user *buf, + size_t count, loff_t *ppos) +{ + /* Handle pending CRW's. */ + crw_wait_for_channel_report(); + css_complete_work(); + return count; +} + +static const struct file_operations cio_settle_proc_fops = { + .write = cio_settle_write, +}; + +static int __init cio_settle_init(void) +{ + struct proc_dir_entry *entry; + + entry = proc_create("cio_settle", S_IWUSR, NULL, + &cio_settle_proc_fops); + if (!entry) + return -ENOMEM; + return 0; +} +device_initcall(cio_settle_init); +#endif /*CONFIG_PROC_FS*/ + int sch_is_pseudo_sch(struct subchannel *sch) { return sch == to_css(sch->dev.parent)->pseudo_subchannel; |