Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pcic kthread creation timing



Hi! all,


I saw neither wdc nor NIC at pcmcia (at pcic) attached on hpcmips.  And,
if the neither is attached on hpcmips, root device cannot be found. X-<

I saw pcic_event_thread() called earlier than pcic_attach_socket_finish().
Perhaps, pcic_attach_socket_finish() should call
kthread_create(pcic_event_thread()) in it if config_interrupts() is slower
than kthread_create().

Thanks,
--
kiyohara


Index: i82365.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/i82365.c,v
retrieving revision 1.102
diff -u -r1.102 i82365.c
--- i82365.c    8 Apr 2008 12:07:26 -0000       1.102
+++ i82365.c    15 Jul 2008 03:07:45 -0000
@@ -397,7 +397,6 @@
        struct pcmciabus_attach_args paa;
        struct pcic_softc *sc = (struct pcic_softc *)h->ph_parent;
        int locs[PCMCIABUSCF_NLOCS];
-       char cs[4];
 
        /* initialize the rest of the handle */
 
@@ -424,21 +423,7 @@
                return;
        }
 
-       /*
-        * queue creation of a kernel thread to handle insert/removal events.
-        */
-#ifdef DIAGNOSTIC
-       if (h->event_thread != NULL)
-               panic("pcic_attach_socket: event thread");
-#endif
        config_pending_incr();
-       snprintf(cs, sizeof(cs), "%d,%d", h->chip, h->socket);
-
-       if (kthread_create(PRI_NONE, 0, NULL, pcic_event_thread, h,
-           &h->event_thread, "%s,%s", device_xname(h->ph_parent), cs)) {
-               aprint_error_dev(h->ph_parent, "unable to create event thread 
for sock 0x%02x\n", h->sock);
-               panic("pcic_attach_socket");
-       }
 }
 
 /*
@@ -466,6 +451,7 @@
 {
        struct pcic_softc *sc = (struct pcic_softc *)h->ph_parent;
        int reg;
+       char cs[4];
 
        DPRINTF(("%s: attach finish socket %ld\n", device_xname(h->ph_parent),
            (long) (h - &sc->handle[0])));
@@ -520,6 +506,21 @@
        } else {
                h->laststate = PCIC_LASTSTATE_EMPTY;
        }
+
+       /*
+        * queue creation of a kernel thread to handle insert/removal events.
+        */
+#ifdef DIAGNOSTIC
+       if (h->event_thread != NULL)
+               panic("pcic_attach_socket_finish: event thread");
+#endif
+       snprintf(cs, sizeof(cs), "%d,%d", h->chip, h->socket);
+       if (kthread_create(PRI_NONE, 0, NULL, pcic_event_thread, h,
+           &h->event_thread, "%s,%s", device_xname(h->ph_parent), cs)) {
+               aprint_error_dev(h->ph_parent,
+                   "unable to create event thread for sock 0x%02x\n", h->sock);
+               panic("pcic_attach_socket_finish");
+       }
 }
 
 void


Home | Main Index | Thread Index | Old Index