summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2017-10-12 11:54:37 +0000
committerpatrick <patrick@openbsd.org>2017-10-12 11:54:37 +0000
commit29206d636cd2bb5fbdb54de2a037e37aff019f2a (patch)
tree964cd6010d0f06d967dfc2c99063847718aa839f
parentShow exit status and time in the remain-on-exit pane text, mostly from (diff)
downloadwireguard-openbsd-29206d636cd2bb5fbdb54de2a037e37aff019f2a.tar.xz
wireguard-openbsd-29206d636cd2bb5fbdb54de2a037e37aff019f2a.zip
Apparently one of the main concepts in the SDMMC I/O subsystem is that
the driver attached to an SDIO card always holds the lock and only releases it once it detaches. Now with that in mind, some time ago sdmmc_io_function_disable() and sdmmc_io_function_ready() were changed to only assert the write lock and not take it, but not all of the tree was converted. Change sdmmc_io_function_enable() as well, and remove the enter/exit dance in the interrupt code. Apparently there is no SDIO driver yet/anymore which would trigger those issues. ok kettenis@
-rw-r--r--sys/dev/sdmmc/sdmmc_io.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/dev/sdmmc/sdmmc_io.c b/sys/dev/sdmmc/sdmmc_io.c
index f84a759efab..cd457cb5c58 100644
--- a/sys/dev/sdmmc/sdmmc_io.c
+++ b/sys/dev/sdmmc/sdmmc_io.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sdmmc_io.c,v 1.29 2017/08/28 23:45:10 jsg Exp $ */
+/* $OpenBSD: sdmmc_io.c,v 1.30 2017/10/12 11:54:37 patrick Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -220,14 +220,14 @@ sdmmc_io_function_enable(struct sdmmc_function *sf)
u_int8_t rv;
int retry = 5;
+ rw_assert_wrlock(&sc->sc_lock);
+
if (sf->number == 0)
return 0; /* FN0 is always enabled */
- rw_enter_write(&sc->sc_lock);
rv = sdmmc_io_read_1(sf0, SD_IO_CCCR_FN_ENABLE);
rv |= (1<<sf->number);
sdmmc_io_write_1(sf0, SD_IO_CCCR_FN_ENABLE, rv);
- rw_exit(&sc->sc_lock);
while (!sdmmc_io_function_ready(sf) && retry-- > 0)
tsleep(&lbolt, PPAUSE, "pause", 0);
@@ -605,11 +605,11 @@ sdmmc_intr_enable(struct sdmmc_function *sf)
struct sdmmc_function *sf0 = sc->sc_fn0;
u_int8_t imask;
- rw_enter_write(&sc->sc_lock);
+ rw_assert_wrlock(&sc->sc_lock);
+
imask = sdmmc_io_read_1(sf0, SD_IO_CCCR_INT_ENABLE);
imask |= 1 << sf->number;
sdmmc_io_write_1(sf0, SD_IO_CCCR_INT_ENABLE, imask);
- rw_exit(&sc->sc_lock);
}
void
@@ -619,11 +619,11 @@ sdmmc_intr_disable(struct sdmmc_function *sf)
struct sdmmc_function *sf0 = sc->sc_fn0;
u_int8_t imask;
- rw_enter_write(&sc->sc_lock);
+ rw_assert_wrlock(&sc->sc_lock);
+
imask = sdmmc_io_read_1(sf0, SD_IO_CCCR_INT_ENABLE);
imask &= ~(1 << sf->number);
sdmmc_io_write_1(sf0, SD_IO_CCCR_INT_ENABLE, imask);
- rw_exit(&sc->sc_lock);
}
/*