Merge git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-linus
[safe/jmp/linux-2.6] / drivers / s390 / cio / css.c
index 99fcf9d..5116491 100644 (file)
@@ -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>
 
@@ -869,15 +870,10 @@ static int __init css_bus_init(void)
 
        /* Try to enable MSS. */
        ret = chsc_enable_facility(CHSC_SDA_OC_MSS);
-       switch (ret) {
-       case 0: /* Success. */
-               max_ssid = __MAX_SSID;
-               break;
-       case -ENOMEM:
-               goto out;
-       default:
+       if (ret)
                max_ssid = 0;
-       }
+       else /* Success. */
+               max_ssid = __MAX_SSID;
 
        ret = slow_subchannel_init();
        if (ret)
@@ -1015,10 +1011,25 @@ static int css_settle(struct device_driver *drv, void *unused)
        struct css_driver *cssdrv = to_cssdriver(drv);
 
        if (cssdrv->settle)
-               cssdrv->settle();
+               return cssdrv->settle();
        return 0;
 }
 
+int css_complete_work(void)
+{
+       int ret;
+
+       /* Wait for the evaluation of subchannels to finish. */
+       ret = wait_event_interruptible(css_eval_wq,
+                                      atomic_read(&css_eval_scheduled) == 0);
+       if (ret)
+               return -EINTR;
+       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);
+}
+
+
 /*
  * 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 +1038,46 @@ 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);
 
+void channel_subsystem_reinit(void)
+{
+       chsc_enable_facility(CHSC_SDA_OC_MSS);
+}
+
+#ifdef CONFIG_PROC_FS
+static ssize_t cio_settle_write(struct file *file, const char __user *buf,
+                               size_t count, loff_t *ppos)
+{
+       int ret;
+
+       /* Handle pending CRW's. */
+       crw_wait_for_channel_report();
+       ret = css_complete_work();
+
+       return ret ? ret : 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;