summaryrefslogtreecommitdiff
path: root/sys/dev/sdmmc/sdmmc_io.c
diff options
context:
space:
mode:
authorBret Lambert <blambert@cvs.openbsd.org>2009-04-07 16:35:53 +0000
committerBret Lambert <blambert@cvs.openbsd.org>2009-04-07 16:35:53 +0000
commit46c923d7e1e7be08bd5c46dad9463af9b60e6112 (patch)
tree18e7ebdb635b265a96b017504cab9ef2df7532b8 /sys/dev/sdmmc/sdmmc_io.c
parent25b4f988f32e1078e0e1b91d955f72c093c76b6f (diff)
Remove recursion from the sdmmc locking regime.
In snaps for a while. Originally hacked on phessler@'s couch. Testing by many, input from jsg@ "I'm tired of seeing the Ms" deraadt@
Diffstat (limited to 'sys/dev/sdmmc/sdmmc_io.c')
-rw-r--r--sys/dev/sdmmc/sdmmc_io.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sys/dev/sdmmc/sdmmc_io.c b/sys/dev/sdmmc/sdmmc_io.c
index cf891e27ceb..6b33644b2cc 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.12 2008/12/02 23:49:54 deraadt Exp $ */
+/* $OpenBSD: sdmmc_io.c,v 1.13 2009/04/07 16:35:52 blambert Exp $ */
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
@@ -71,6 +71,8 @@ sdmmc_io_enable(struct sdmmc_softc *sc)
u_int32_t host_ocr;
u_int32_t card_ocr;
+ SDMMC_ASSERT_LOCKED(sc);
+
/* Set host mode to SD "combo" card. */
SET(sc->sc_flags, SMF_SD_MODE|SMF_IO_MODE|SMF_MEM_MODE);
@@ -133,6 +135,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) {
@@ -166,6 +170,8 @@ sdmmc_io_scan(struct sdmmc_softc *sc)
int
sdmmc_io_init(struct sdmmc_softc *sc, struct sdmmc_function *sf)
{
+ SDMMC_ASSERT_LOCKED(sc);
+
if (sf->number == 0) {
sdmmc_io_write_1(sf, SD_IO_CCCR_BUS_WIDTH,
CCCR_BUS_WIDTH_1);
@@ -254,6 +260,8 @@ sdmmc_io_attach(struct sdmmc_softc *sc)
struct sdmmc_function *sf;
struct sdmmc_attach_args saa;
+ SDMMC_ASSERT_LOCKED(sc);
+
SIMPLEQ_FOREACH(sf, &sc->sf_head, sf_list) {
if (sf->number < 1)
continue;
@@ -325,6 +333,8 @@ sdmmc_io_detach(struct sdmmc_softc *sc)
{
struct sdmmc_function *sf;
+ SDMMC_ASSERT_LOCKED(sc);
+
SIMPLEQ_FOREACH(sf, &sc->sf_head, sf_list) {
if (sf->child != NULL) {
config_detach(sf->child, DETACH_FORCE);
@@ -534,7 +544,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 +569,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;
}