summaryrefslogtreecommitdiff
path: root/sys/dev/sdmmc
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2010-07-02 18:05:29 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2010-07-02 18:05:29 +0000
commitaa26dd9565f8b66549e0daed88ead59b300550b3 (patch)
tree7840220f6e71fc5a5dae2fbcc7ae83ad890d79da /sys/dev/sdmmc
parentc2a5bb9f1ad76a9f75eb56c84bf3ae7fb32dbda2 (diff)
One transition was wrong: Suspending without a card, and then resuming with
was doing an attach, detach, and re-attach. Repair the state transitions.
Diffstat (limited to 'sys/dev/sdmmc')
-rw-r--r--sys/dev/sdmmc/sdhc.c4
-rw-r--r--sys/dev/sdmmc/sdmmc.c8
2 files changed, 9 insertions, 3 deletions
diff --git a/sys/dev/sdmmc/sdhc.c b/sys/dev/sdmmc/sdhc.c
index 8195801caee..774a7247339 100644
--- a/sys/dev/sdmmc/sdhc.c
+++ b/sys/dev/sdmmc/sdhc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sdhc.c,v 1.26 2010/07/02 09:21:58 deraadt Exp $ */
+/* $OpenBSD: sdhc.c,v 1.27 2010/07/02 18:05:28 deraadt Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -272,6 +272,8 @@ sdhc_power(int why, void *arg)
for (i = 0; i < sizeof hp->regs; i++)
hp->regs[i] = HREAD1(hp, i);
}
+ config_activate_children((struct device *)sc,
+ DVACT_SUSPEND);
break;
case PWR_RESUME:
diff --git a/sys/dev/sdmmc/sdmmc.c b/sys/dev/sdmmc/sdmmc.c
index 0aa21a3b21d..4b130f7c870 100644
--- a/sys/dev/sdmmc/sdmmc.c
+++ b/sys/dev/sdmmc/sdmmc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sdmmc.c,v 1.21 2010/07/02 09:21:58 deraadt Exp $ */
+/* $OpenBSD: sdmmc.c,v 1.22 2010/07/02 18:05:28 deraadt Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -150,8 +150,12 @@ sdmmc_activate(struct device *self, int act)
int rv = 0;
switch (act) {
+ case DVACT_SUSPEND:
+ /* If card in slot, cause a detach/re-attach */
+ if (ISSET(sc->sc_flags, SMF_CARD_PRESENT))
+ sc->sc_dying = -1;
+ break;
case DVACT_RESUME:
- sc->sc_dying = -1; /* "bump" the task for a retry */
wakeup(&sc->sc_tskq);
break;
}