diff options
Diffstat (limited to 'sys/dev/sdmmc/sdmmc.c')
-rw-r--r-- | sys/dev/sdmmc/sdmmc.c | 16 |
1 files changed, 9 insertions, 7 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(); + } } /* |