Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/jmcneill-audiomp3]: src/sys/dev/sbus convert spl*() to use the sc_intr_l...



details:   https://anonhg.NetBSD.org/src/rev/5a3cf0420f20
branches:  jmcneill-audiomp3
changeset: 771343:5a3cf0420f20
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Nov 20 12:07:13 2011 +0000

description:
convert spl*() to use the sc_intr_lock mutex, and hold it in a couple
of other places we should as well.

diffstat:

 sys/dev/sbus/dbri.c |  30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)

diffs (131 lines):

diff -r 3abb4d253b0d -r 5a3cf0420f20 sys/dev/sbus/dbri.c
--- a/sys/dev/sbus/dbri.c       Sun Nov 20 12:04:42 2011 +0000
+++ b/sys/dev/sbus/dbri.c       Sun Nov 20 12:07:13 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dbri.c,v 1.33.6.1 2011/11/20 10:48:54 mrg Exp $        */
+/*     $NetBSD: dbri.c,v 1.33.6.2 2011/11/20 12:07:13 mrg Exp $        */
 
 /*
  * Copyright (C) 1997 Rudolf Koenig (rfkoenig%immd4.informatik.uni-erlangen.de@localhost)
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.33.6.1 2011/11/20 10:48:54 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.33.6.2 2011/11/20 12:07:13 mrg Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -472,6 +472,8 @@
        bus_space_handle_t ioh = sc->sc_ioh;
        int x;
 
+       mutex_spin_enter(&sc->sc_intr_lock);
+
        /* clear interrupt */
        x = bus_space_read_4(iot, ioh, DBRI_REG1);
        if (x & (DBRI_MRR | DBRI_MLE | DBRI_LBG | DBRI_MBE)) {
@@ -506,6 +508,8 @@
 
        dbri_process_interrupt_buffer(sc);
 
+       mutex_spin_exit(&sc->sc_intr_lock);
+
        return (1);
 }
 
@@ -598,9 +602,8 @@
        bus_space_handle_t ioh = sc->sc_ioh;
        bus_space_tag_t iot = sc->sc_iot;
        int maxloops = 1000000;
-       int x;
 
-       x = splsched();
+       mutex_spin_enter(&sc->sc_intr_lock);
 
        sc->sc_locked--;
 
@@ -638,7 +641,7 @@
                }
        }
 
-       splx(x);
+       mutex_spin_exit(&sc->sc_intr_lock);
 
        return;
 }
@@ -1266,7 +1269,7 @@
                void (*callback)(void *), void *callback_args)
 {
        volatile uint32_t *cmd;
-       int x, i;
+       int i;
        int td;
        int td_first, td_last;
        bus_addr_t dmabuf, dmabase;
@@ -1316,7 +1319,7 @@
        dd->callback = callback;
        dd->callback_args = callback_args;
 
-       x = splsched();
+       mutex_spin_enter(&sc->sc_intr_lock);
 
        /* the pipe shouldn't be active */
        if (pipe_active(sc, pipe)) {
@@ -1352,7 +1355,7 @@
                DPRINTF("%s: starting DMA\n", __func__);
        }
 
-       splx(x);
+       mutex_spin_exit(&sc->sc_intr_lock);
 
        return;
 }
@@ -1362,7 +1365,7 @@
                void (*callback)(void *), void *callback_args)
 {
        volatile uint32_t *cmd;
-       int x, i;
+       int i;
        int td_first, td_last;
        bus_addr_t dmabuf, dmabase;
        struct dbri_desc *dd = &sc->sc_desc[which];
@@ -1407,7 +1410,7 @@
        dd->callback = callback;
        dd->callback_args = callback_args;
 
-       x = splsched();
+       mutex_spin_enter(&sc->sc_intr_lock);
 
        /* the pipe shouldn't be active */
        if (pipe_active(sc, pipe)) {
@@ -1443,7 +1446,7 @@
                DPRINTF("%s: starting DMA\n", __func__);
        }
 
-       splx(x);
+       mutex_spin_exit(&sc->sc_intr_lock);
 
        return;
 }
@@ -2211,10 +2214,9 @@
        aprint_verbose("resume: %d\n", sc->sc_refcount);
        if (sc->sc_playing) {
                volatile uint32_t *cmd;
-               int s;
 
                dbri_bring_up(sc);
-               s = splsched();
+               mutex_spin_enter(&sc->sc_intr_lock);
                cmd = dbri_command_lock(sc);
                *(cmd++) = DBRI_CMD(DBRI_COMMAND_SDP,
                    0, sc->sc_pipe[4].sdp |
@@ -2223,7 +2225,7 @@
                *(cmd++) = sc->sc_dmabase +
                    dbri_dma_off(xmit, 0);
                dbri_command_send(sc, cmd);
-               splx(s);
+               mutex_spin_exit(&sc->sc_intr_lock);
        }
        return true;
 }



Home | Main Index | Thread Index | Old Index