続 attach

attach 時に出てくるエラーは sdmmc のスレッド上から sdmmc に対して読み込みを行おうとしているのが原因だった。そりゃタスクキュー取得処理にたどり着かなきゃ読み込みは処理できねーよな。
どうすればいいのかなぁ。色々処理されてしまう ld_attach() を実行するのを callout を使って callout のタイムアウトのスレッドに移動したらエラーはでなくなったけど、こんなんで良いのかなぁ。

Index: ld_sdmmc.c
===================================================================
RCS file: /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	27 May 2009 04:07:11 -0000
@@ -84,6 +84,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 *);
 
@@ -128,6 +129,19 @@
 	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.
+	 */
+	callout_reset(&sc->sc_task.task_callout, 1, ld_sdmmc_doattach, sc);
+}
+
+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);
 }