diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2022-09-03 15:29:45 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2022-09-03 15:29:45 +0000 |
commit | 74c6a5eaf39a70dbf34149e74ac799775f90e9ea (patch) | |
tree | b3831a6317124a1544f76a45c24bcdb39e9fc459 /sys/dev | |
parent | ed94f53cd8751f0185d3473c6fcbb409a1f3a703 (diff) |
Allow suspend with root on sdmmc(4).
ok deraadt@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/sdmmc/sdmmc.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/dev/sdmmc/sdmmc.c b/sys/dev/sdmmc/sdmmc.c index 16225fcde3c..751e9d15021 100644 --- a/sys/dev/sdmmc/sdmmc.c +++ b/sys/dev/sdmmc/sdmmc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sdmmc.c,v 1.59 2022/04/06 18:59:30 naddy Exp $ */ +/* $OpenBSD: sdmmc.c,v 1.60 2022/09/03 15:29:43 kettenis Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -56,6 +56,7 @@ void sdmmc_attach(struct device *, struct device *, void *); int sdmmc_detach(struct device *, int); int sdmmc_activate(struct device *, int); +int sdmmc_holds_root_device(struct sdmmc_softc *); void sdmmc_create_thread(void *); void sdmmc_task_thread(void *); void sdmmc_discover_task(void *); @@ -195,7 +196,8 @@ sdmmc_activate(struct device *self, int act) rv = config_activate_children(self, act); /* If card in slot, cause a detach/re-attach */ if (ISSET(sc->sc_flags, SMF_CARD_PRESENT) && - !ISSET(sc->sc_caps, SMC_CAPS_NONREMOVABLE)) + !ISSET(sc->sc_caps, SMC_CAPS_NONREMOVABLE) && + !sdmmc_holds_root_device(sc)) sc->sc_dying = -1; break; case DVACT_RESUME: @@ -209,6 +211,16 @@ sdmmc_activate(struct device *self, int act) return (rv); } +int +sdmmc_holds_root_device(struct sdmmc_softc *sc) +{ + if (rootdv && rootdv->dv_parent && + rootdv->dv_parent->dv_parent == &sc->sc_dev) + return 1; + + return 0; +} + void sdmmc_create_thread(void *arg) { |