]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
[S390] cio: introduce css_settle
authorSebastian Ott <sebott@linux.vnet.ibm.com>
Tue, 22 Sep 2009 20:58:35 +0000 (22:58 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 22 Sep 2009 20:58:41 +0000 (22:58 +0200)
Introduce the css_driver callback settle which can be implemented
by a subchannel driver to wait for the subchannel type specific
asynchronous work to finish.
In channel_subsystem_init_sync we call that for each subchannel
driver.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
drivers/s390/cio/css.c
drivers/s390/cio/css.h
drivers/s390/cio/device.c

index 59c4b94cdb4b4314d0636a636283764fb5465ee0..f018835afdf49fbff654f8bb337deec89c948770 100644 (file)
@@ -1013,6 +1013,15 @@ static int __init channel_subsystem_init(void)
 }
 subsys_initcall(channel_subsystem_init);
 
+static int css_settle(struct device_driver *drv, void *unused)
+{
+       struct css_driver *cssdrv = to_cssdriver(drv);
+
+       if (cssdrv->settle)
+               cssdrv->settle();
+       return 0;
+}
+
 /*
  * 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.
@@ -1024,12 +1033,8 @@ static int __init channel_subsystem_init_sync(void)
        /* Wait for the evaluation of subchannels to finish. */
        wait_event(css_eval_wq, atomic_read(&css_eval_scheduled) == 0);
 
-       /* Wait for the initialization of ccw devices to finish. */
-       wait_event(ccw_device_init_wq,
-                  atomic_read(&ccw_device_init_count) == 0);
-       flush_workqueue(ccw_device_work);
-
-       return 0;
+       /* Wait for the subchannel type specific initialization to finish */
+       return bus_for_each_drv(&css_bus_type, NULL, NULL, css_settle);
 }
 subsys_initcall_sync(channel_subsystem_init_sync);
 
index 9763eeec74587d3a106dc5eae49eacd40505f899..54acdaade86ebc83ad6e0983002c80264ea23f86 100644 (file)
@@ -75,6 +75,7 @@ struct chp_link;
  * @freeze: callback for freezing during hibernation snapshotting
  * @thaw: undo work done in @freeze
  * @restore: callback for restoring after hibernation
+ * @settle: wait for asynchronous work to finish
  * @name: name of the device driver
  */
 struct css_driver {
@@ -92,6 +93,7 @@ struct css_driver {
        int (*freeze)(struct subchannel *);
        int (*thaw) (struct subchannel *);
        int (*restore)(struct subchannel *);
+       void (*settle)(void);
        const char *name;
 };
 
index 4093adc12f2cfd999045a66bfbd217e7d371dc03..f780bdd3a04ea6093f4b3a6a41ba61425c1da164 100644 (file)
@@ -131,6 +131,10 @@ static void io_subchannel_shutdown(struct subchannel *);
 static int io_subchannel_sch_event(struct subchannel *, int);
 static int io_subchannel_chp_event(struct subchannel *, struct chp_link *,
                                   int);
+static void recovery_func(unsigned long data);
+struct workqueue_struct *ccw_device_work;
+wait_queue_head_t ccw_device_init_wq;
+atomic_t ccw_device_init_count;
 
 static struct css_device_id io_subchannel_ids[] = {
        { .match_flags = 0x1, .type = SUBCHANNEL_TYPE_IO, },
@@ -151,6 +155,13 @@ static int io_subchannel_prepare(struct subchannel *sch)
        return 0;
 }
 
+static void io_subchannel_settle(void)
+{
+       wait_event(ccw_device_init_wq,
+                  atomic_read(&ccw_device_init_count) == 0);
+       flush_workqueue(ccw_device_work);
+}
+
 static struct css_driver io_subchannel_driver = {
        .owner = THIS_MODULE,
        .subchannel_type = io_subchannel_ids,
@@ -162,14 +173,9 @@ static struct css_driver io_subchannel_driver = {
        .remove = io_subchannel_remove,
        .shutdown = io_subchannel_shutdown,
        .prepare = io_subchannel_prepare,
+       .settle = io_subchannel_settle,
 };
 
-struct workqueue_struct *ccw_device_work;
-wait_queue_head_t ccw_device_init_wq;
-atomic_t ccw_device_init_count;
-
-static void recovery_func(unsigned long data);
-
 int __init io_subchannel_init(void)
 {
        int ret;