続々々 attach

まあ、こんなもんかな。

Index: ld_sdmmc.c
===================================================================
RCS file: /cvs/cvsroot/src/sys/dev/sdmmc/ld_sdmmc.c,v
retrieving revision 1.2
diff -u -r1.2 ld_sdmmc.c
--- ld_sdmmc.c	6 May 2009 08:20:49 -0000	1.2
+++ ld_sdmmc.c	28 May 2009 03:42:58 -0000
@@ -43,6 +43,7 @@
 #include <sys/endian.h>
 #include <sys/dkio.h>
 #include <sys/disk.h>
+#include <sys/kthread.h>
 #if NRND > 0
 #include <sys/rnd.h>
 #endif
@@ -84,6 +85,7 @@
 static int ld_sdmmc_dump(struct ld_softc *, void *, int, int);
 static int ld_sdmmc_start(struct ld_softc *, struct buf *);
 
+static void ld_sdmmc_doattach(void *);
 static void ld_sdmmc_dobio(void *);
 static void ld_sdmmc_timeout(void *);
 
@@ -109,6 +111,7 @@
 	struct ld_sdmmc_softc *sc = device_private(self);
 	struct sdmmc_attach_args *sa = aux;
 	struct ld_softc *ld = &sc->sc_ld;
+	struct lwp *lwp;
 
 	ld->sc_dv = self;
 
@@ -128,7 +131,25 @@
 	ld->sc_dump = ld_sdmmc_dump;
 	ld->sc_start = ld_sdmmc_start;
 
+	/*
+	 * It is avoided that the error occurs when the card attaches it, 
+	 * when wedge is supported.
+	 */
+	if (kthread_create(PRI_NONE, KTHREAD_MPSAFE, NULL,
+	    ld_sdmmc_doattach, sc, &lwp, "%sattach", device_xname(self))) {
+		aprint_error_dev(self, "couldn't create thread\n");
+	}
+}
+
+/*ARGSUSED*/
+static void
+ld_sdmmc_doattach(void *arg)
+{
+	struct ld_sdmmc_softc *sc = (struct ld_sdmmc_softc *)arg;
+	struct ld_softc *ld = &sc->sc_ld;
+
 	ldattach(ld);
+	kthread_exit(0);
 }
 
 static int
広告を非表示にする