diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/sdmmc/sdmmc.c | 16 | ||||
-rw-r--r-- | sys/dev/sdmmc/sdmmcvar.h | 3 |
2 files changed, 11 insertions, 8 deletions
diff --git a/sys/dev/sdmmc/sdmmc.c b/sys/dev/sdmmc/sdmmc.c index a8801c2bc48..11ec05243fb 100644 --- a/sys/dev/sdmmc/sdmmc.c +++ b/sys/dev/sdmmc/sdmmc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sdmmc.c,v 1.24 2010/08/24 14:52:23 blambert Exp $ */ +/* $OpenBSD: sdmmc.c,v 1.25 2011/11/10 14:24:29 uwe Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -121,11 +121,11 @@ sdmmc_attach(struct device *parent, struct device *self, void *aux) /* * Create the event thread that will attach and detach cards - * and perform other lengthy operations. + * and perform other lengthy operations. Enter config_pending + * state until the discovery task has run for the first time. */ -#ifdef DO_CONFIG_PENDING + SET(sc->sc_flags, SMF_CONFIG_PENDING); config_pending_incr(); -#endif kthread_create_deferred(sdmmc_create_thread, sc); } @@ -170,9 +170,6 @@ sdmmc_create_thread(void *arg) "%s", DEVNAME(sc)) != 0) printf("%s: can't create task thread\n", DEVNAME(sc)); -#ifdef DO_CONFIG_PENDING - config_pending_decr(); -#endif } void @@ -274,6 +271,11 @@ sdmmc_discover_task(void *arg) rw_exit(&sc->sc_lock); } } + + if (ISSET(sc->sc_flags, SMF_CONFIG_PENDING)) { + CLR(sc->sc_flags, SMF_CONFIG_PENDING); + config_pending_decr(); + } } /* diff --git a/sys/dev/sdmmc/sdmmcvar.h b/sys/dev/sdmmc/sdmmcvar.h index 2c1542dd84b..8da8cc6851d 100644 --- a/sys/dev/sdmmc/sdmmcvar.h +++ b/sys/dev/sdmmc/sdmmcvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sdmmcvar.h,v 1.20 2011/07/17 22:46:48 matthew Exp $ */ +/* $OpenBSD: sdmmcvar.h,v 1.21 2011/11/10 14:24:29 uwe Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -163,6 +163,7 @@ struct sdmmc_softc { #define SMF_CARD_PRESENT 0x0010 /* card presence noticed */ #define SMF_CARD_ATTACHED 0x0020 /* card driver(s) attached */ #define SMF_STOP_AFTER_MULTIPLE 0x0040 /* send a stop after a multiple cmd */ +#define SMF_CONFIG_PENDING 0x0080 /* config_pending_incr() called */ int sc_function_count; /* number of I/O functions (SDIO) */ struct sdmmc_function *sc_card; /* selected card */ struct sdmmc_function *sc_fn0; /* function 0, the card itself */ |