summaryrefslogtreecommitdiff
path: root/sys/dev/sdmmc/sdmmc_io.c
diff options
context:
space:
mode:
authorBret Lambert <blambert@cvs.openbsd.org>2008-11-24 07:32:09 +0000
committerBret Lambert <blambert@cvs.openbsd.org>2008-11-24 07:32:09 +0000
commite1239c1407da833448ef06f9f16beb05f840631a (patch)
tree84c5e2156e07fbb89e96cdcc8859452cd56b4a72 /sys/dev/sdmmc/sdmmc_io.c
parent9570617a3aa1ff9a00e1072869eb4decea1b3c74 (diff)
Rework sdmmc locking to remove recursion
Add SDMMC_ASSERT_LOCKED(), replacing many locking calls, and sprinkling the assertion to make sure that future changes don't catch us out "please commit" uwe@
Diffstat (limited to 'sys/dev/sdmmc/sdmmc_io.c')
-rw-r--r--sys/dev/sdmmc/sdmmc_io.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/dev/sdmmc/sdmmc_io.c b/sys/dev/sdmmc/sdmmc_io.c
index 839740ee8be..4fdb9261c42 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.10 2007/09/17 01:33:33 krw Exp $ */
+/* $OpenBSD: sdmmc_io.c,v 1.11 2008/11/24 07:32:08 blambert Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -133,6 +133,8 @@ sdmmc_io_scan(struct sdmmc_softc *sc)
struct sdmmc_function *sf0, *sf;
int i;
+ SDMMC_ASSERT_LOCKED(sc);
+
sf0 = sdmmc_function_alloc(sc);
sf0->number = 0;
if (sdmmc_set_relative_addr(sc, sf0) != 0) {
@@ -534,7 +536,7 @@ sdmmc_io_send_op_cond(struct sdmmc_softc *sc, u_int32_t ocr, u_int32_t *ocrp)
int error;
int i;
- SDMMC_LOCK(sc);
+ SDMMC_ASSERT_LOCKED(sc);
/*
* If we change the OCR value, retry the command until the OCR
@@ -559,7 +561,6 @@ sdmmc_io_send_op_cond(struct sdmmc_softc *sc, u_int32_t ocr, u_int32_t *ocrp)
if (error == 0 && ocrp != NULL)
*ocrp = MMC_R4(cmd.c_resp);
- SDMMC_UNLOCK(sc);
return error;
}