Source-Changes archive

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

Re: CVS commit: src/sys/dev



On Sun, 30 Mar 2008 11:26:06 +0200
Quentin Garnier <cube%cubidou.net@localhost> wrote:

> No.  An internal API of the mpu driver shouldn't have to assume of the
> contents of the softc.

Please review this patch. Is it ok now?

Index: isa/mpu_isa.c
===================================================================
RCS file: /cvsroot/src/sys/dev/isa/mpu_isa.c,v
retrieving revision 1.18
diff -b -u -p -b -u -r1.18 mpu_isa.c
--- isa/mpu_isa.c       27 Mar 2008 10:22:01 -0000      1.18
+++ isa/mpu_isa.c       30 Mar 2008 13:11:52 -0000
@@ -121,7 +121,7 @@ mpu_isa_attach(device_t parent, device_t
        }
 
        sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq,
-           IST_EDGE, IPL_AUDIO, mpu_intr, sc);
+           IST_EDGE, IPL_AUDIO, mpu_intr, &sc->sc_mpu);
 
        sc->sc_mpu.model = "Roland MPU-401 MIDI UART";
        sc->sc_dev = self;
Index: pci/cmpci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/cmpci.c,v
retrieving revision 1.36
diff -b -u -p -b -u -r1.36 cmpci.c
--- pci/cmpci.c 19 Oct 2007 12:00:41 -0000      1.36
+++ pci/cmpci.c 30 Mar 2008 13:11:52 -0000
@@ -524,10 +524,12 @@ cmpci_attach(struct device *parent, stru
 static int
 cmpci_intr(void *handle)
 {
-       struct cmpci_softc *sc;
+       struct cmpci_softc *sc = handle;
+#if NMPU > 0
+       struct mpu_softc *sc_mpu = device_private(sc->sc_mpudev);
+#endif
        uint32_t intrstat;
 
-       sc = handle;
        intrstat = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
            CMPCI_REG_INTR_STATUS);
 
@@ -562,8 +564,8 @@ cmpci_intr(void *handle)
                    CMPCI_REG_CH1_INTR_ENABLE);
 
 #if NMPU > 0
-       if (intrstat & CMPCI_REG_UART_INTR && sc->sc_mpudev != NULL)
-               mpu_intr(sc->sc_mpudev);
+       if (intrstat & CMPCI_REG_UART_INTR && sc_mpu != NULL)
+               mpu_intr(sc_mpu);
 #endif
 
        return 1;
Index: pci/eso.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/eso.c,v
retrieving revision 1.51
diff -b -u -p -b -u -r1.51 eso.c
--- pci/eso.c   19 Oct 2007 12:00:43 -0000      1.51
+++ pci/eso.c   30 Mar 2008 13:11:53 -0000
@@ -566,10 +566,12 @@ eso_read_mixreg(struct eso_softc *sc, ui
 static int
 eso_intr(void *hdl)
 {
-       struct eso_softc *sc;
+       struct eso_softc *sc = hdl;
+#if NMPU > 0
+       struct mpu_softc *sc_mpu = device_private(sc->sc_mpudev);
+#endif
        uint8_t irqctl;
 
-       sc = hdl;
        irqctl = bus_space_read_1(sc->sc_iot, sc->sc_ioh, ESO_IO_IRQCTL);
 
        /* If it wasn't ours, that's all she wrote. */
@@ -615,8 +617,8 @@ eso_intr(void *hdl)
        }
 
 #if NMPU > 0
-       if ((irqctl & ESO_IO_IRQCTL_MPUIRQ) && sc->sc_mpudev != NULL)
-               mpu_intr(sc->sc_mpudev);
+       if ((irqctl & ESO_IO_IRQCTL_MPUIRQ) && sc_mpu != NULL)
+               mpu_intr(sc_mpu);
 #endif
 
        return 1;
Index: pci/fms.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/fms.c,v
retrieving revision 1.30
diff -b -u -p -b -u -r1.30 fms.c
--- pci/fms.c   19 Oct 2007 12:00:43 -0000      1.30
+++ pci/fms.c   30 Mar 2008 13:11:53 -0000
@@ -421,10 +421,12 @@ fms_reset_codec(void *addr)
 static int
 fms_intr(void *arg)
 {
-       struct fms_softc *sc;
+       struct fms_softc *sc = arg;
+#if NMPU > 0
+       struct mpu_softc *sc_mpu = device_private(sc->sc_mpu_dev);
+#endif
        uint16_t istat;
 
-       sc = arg;
        istat = bus_space_read_2(sc->sc_iot, sc->sc_ioh, FM_INTSTATUS);
 
        if (istat & FM_INTSTATUS_PLAY) {
@@ -459,7 +461,7 @@ fms_intr(void *arg)
 
 #if NMPU > 0
        if (istat & FM_INTSTATUS_MPU)
-               mpu_intr(sc->sc_mpu_dev);
+               mpu_intr(sc_mpu);
 #endif
 
        bus_space_write_2(sc->sc_iot, sc->sc_ioh, FM_INTSTATUS,
Index: pci/yds.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/yds.c,v
retrieving revision 1.40
diff -b -u -p -b -u -r1.40 yds.c
--- pci/yds.c   29 Feb 2008 06:13:39 -0000      1.40
+++ pci/yds.c   30 Mar 2008 13:11:53 -0000
@@ -1015,16 +1015,18 @@ yds_reset_codec(void *sc_)
 static int
 yds_intr(void *p)
 {
-       struct yds_softc *sc;
+       struct yds_softc *sc = p;
+#if NMPU > 0
+       struct mpu_softc *sc_mpu = device_private(sc->sc_mpu);
+#endif
        u_int status;
 
-       sc = p;
        status = YREAD4(sc, YDS_STATUS);
        DPRINTFN(1, ("yds_intr: status=%08x\n", status));
        if ((status & (YDS_STAT_INT|YDS_STAT_TINT)) == 0) {
 #if NMPU > 0
-               if (sc->sc_mpu)
-                       return mpu_intr(sc->sc_mpu);
+               if (sc_mpu)
+                       return mpu_intr(sc_mpu);
 #endif
                return 0;
        }

-- 
Juan Romero Pardines - xtraeme at gmail|netbsd dot org
        The NetBSD Project

Make your own NetBSD/x86 Live CD
http://www.netbsd.org/~xtraeme/mklivecd/


Home | Main Index | Thread Index | Old Index