Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/sdmmc lock around interrupt registration.
details: https://anonhg.NetBSD.org/src/rev/fbc7b38dfd16
branches: trunk
changeset: 339715:fbc7b38dfd16
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Wed Aug 05 07:34:56 2015 +0000
description:
lock around interrupt registration.
don't release lock around interrupt handlers, the code cannot
handle an unstable handler list.
diffstat:
sys/dev/sdmmc/sdmmc_io.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diffs (56 lines):
diff -r 62f0460b5c5a -r fbc7b38dfd16 sys/dev/sdmmc/sdmmc_io.c
--- a/sys/dev/sdmmc/sdmmc_io.c Wed Aug 05 07:31:52 2015 +0000
+++ b/sys/dev/sdmmc/sdmmc_io.c Wed Aug 05 07:34:56 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sdmmc_io.c,v 1.10 2015/08/03 10:08:51 jmcneill Exp $ */
+/* $NetBSD: sdmmc_io.c,v 1.11 2015/08/05 07:34:56 mlelstv Exp $ */
/* $OpenBSD: sdmmc_io.c,v 1.10 2007/09/17 01:33:33 krw Exp $ */
/*
@@ -20,7 +20,7 @@
/* Routines for SD I/O cards. */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sdmmc_io.c,v 1.10 2015/08/03 10:08:51 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdmmc_io.c,v 1.11 2015/08/05 07:34:56 mlelstv Exp $");
#ifdef _KERNEL_OPT
#include "opt_sdmmc.h"
@@ -597,9 +597,11 @@
uint8_t reg;
SDMMC_LOCK(sc);
+ mutex_enter(&sc->sc_intr_task_mtx);
reg = sdmmc_io_read_1(sf0, SD_IO_CCCR_FN_INTEN);
reg |= 1 << sf->number;
sdmmc_io_write_1(sf0, SD_IO_CCCR_FN_INTEN, reg);
+ mutex_exit(&sc->sc_intr_task_mtx);
SDMMC_UNLOCK(sc);
}
@@ -611,9 +613,11 @@
uint8_t reg;
SDMMC_LOCK(sc);
+ mutex_enter(&sc->sc_intr_task_mtx);
reg = sdmmc_io_read_1(sf0, SD_IO_CCCR_FN_INTEN);
reg &= ~(1 << sf->number);
sdmmc_io_write_1(sf0, SD_IO_CCCR_FN_INTEN, reg);
+ mutex_exit(&sc->sc_intr_task_mtx);
SDMMC_UNLOCK(sc);
}
@@ -709,11 +713,10 @@
mutex_enter(&sc->sc_mtx);
TAILQ_FOREACH(ih, &sc->sc_intrq, entry) {
- mutex_exit(&sc->sc_mtx);
/* XXX examine return value and do evcount stuff*/
(void)(*ih->ih_fun)(ih->ih_arg);
- mutex_enter(&sc->sc_mtx);
}
+ mutex_exit(&sc->sc_mtx);
+
sdmmc_chip_card_intr_ack(sc->sc_sct, sc->sc_sch);
- mutex_exit(&sc->sc_mtx);
}
Home |
Main Index |
Thread Index |
Old Index