s390/css: introduce cio_register_early_subchannels
authorSebastian Ott <sebott@linux.vnet.ibm.com>
Sat, 13 Apr 2013 11:03:54 +0000 (13:03 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Wed, 17 Apr 2013 12:07:32 +0000 (14:07 +0200)
Use cio_register_early_subchannels to register early subchannels
which are already in use. Call this function before we do the
actual subchannel scanning loop. This helps us to get rid of some
more special cases regarding the console subchannel.

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>
drivers/s390/cio/cio.c
drivers/s390/cio/cio.h
drivers/s390/cio/css.c
drivers/s390/cio/css.h

index ab99500604b701421e6eb073d77196f55e93df3e..3ab99d88388802e3aaf0866f15aae97ccce868fc 100644 (file)
@@ -749,9 +749,16 @@ int cio_is_console(struct subchannel_id schid)
        return schid_equal(&schid, &console_sch->schid);
 }
 
-struct subchannel *cio_get_console_subchannel(void)
+void cio_register_early_subchannels(void)
 {
-       return console_sch;
+       int ret;
+
+       if (!console_sch)
+               return;
+
+       ret = css_register_subchannel(console_sch);
+       if (ret)
+               put_device(&console_sch->dev);
 }
 #endif /* CONFIG_CCW_CONSOLE */
 
index 78975471ef282aa35b55df911452f13a306f13b2..57b41ec2ed40d2b88b4ed0438c9369db4ea83450 100644 (file)
@@ -129,11 +129,11 @@ void do_IRQ(struct pt_regs *);
 #ifdef CONFIG_CCW_CONSOLE
 extern struct subchannel *cio_probe_console(void);
 extern int cio_is_console(struct subchannel_id);
-extern struct subchannel *cio_get_console_subchannel(void);
+extern void cio_register_early_subchannels(void);
 extern void cio_tsch(struct subchannel *sch);
 #else
 #define cio_is_console(schid) 0
-#define cio_get_console_subchannel() NULL
+static inline void cio_register_early_subchannels(void) {}
 #endif
 
 #endif
index fb0e64f1845ab54aae38b928fa5b1ae538668a71..3b2245f58bdeeb4f41e3fd85e38ebe8e50fa3a7a 100644 (file)
@@ -224,16 +224,11 @@ void css_update_ssd_info(struct subchannel *sch)
 {
        int ret;
 
-       if (cio_is_console(sch->schid)) {
-               /* Console is initialized too early for functions requiring
-                * memory allocation. */
+       ret = chsc_get_ssd_info(sch->schid, &sch->ssd_info);
+       if (ret)
                ssd_from_pmcw(&sch->ssd_info, &sch->schib.pmcw);
-       } else {
-               ret = chsc_get_ssd_info(sch->schid, &sch->ssd_info);
-               if (ret)
-                       ssd_from_pmcw(&sch->ssd_info, &sch->schib.pmcw);
-               ssd_register_chpids(&sch->ssd_info);
-       }
+
+       ssd_register_chpids(&sch->ssd_info);
 }
 
 static ssize_t type_show(struct device *dev, struct device_attribute *attr,
@@ -271,7 +266,7 @@ static const struct attribute_group *default_subch_attr_groups[] = {
        NULL,
 };
 
-static int css_register_subchannel(struct subchannel *sch)
+int css_register_subchannel(struct subchannel *sch)
 {
        int ret;
 
@@ -314,13 +309,10 @@ int css_probe_device(struct subchannel_id schid)
        int ret;
        struct subchannel *sch;
 
-       if (cio_is_console(schid))
-               sch = cio_get_console_subchannel();
-       else {
-               sch = css_alloc_subchannel(schid);
-               if (IS_ERR(sch))
-                       return PTR_ERR(sch);
-       }
+       sch = css_alloc_subchannel(schid);
+       if (IS_ERR(sch))
+               return PTR_ERR(sch);
+
        ret = css_register_subchannel(sch);
        if (ret)
                put_device(&sch->dev);
@@ -864,8 +856,7 @@ static struct notifier_block css_power_notifier = {
 
 /*
  * Now that the driver core is running, we can setup our channel subsystem.
- * The struct subchannel's are created during probing (except for the
- * static console subchannel).
+ * The struct subchannel's are created during probing.
  */
 static int __init css_bus_init(void)
 {
@@ -1044,6 +1035,8 @@ int css_complete_work(void)
  */
 static int __init channel_subsystem_init_sync(void)
 {
+       /* Register subchannels which are already in use. */
+       cio_register_early_subchannels();
        /* Start initial subchannel evaluation. */
        css_schedule_eval_all();
        css_complete_work();
index 6ab424d753a93701abec48e29a68f6cf8fe2e1d9..2581b6986569e12648d148ab2eeb5280cfc0f243 100644 (file)
@@ -102,6 +102,7 @@ extern void css_driver_unregister(struct css_driver *);
 
 extern void css_sch_device_unregister(struct subchannel *);
 extern int css_probe_device(struct subchannel_id);
+extern int css_register_subchannel(struct subchannel *);
 extern struct subchannel *css_alloc_subchannel(struct subchannel_id);
 extern struct subchannel *get_subchannel_by_schid(struct subchannel_id);
 extern int css_init_done;
This page took 0.028982 seconds and 5 git commands to generate.