Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Always use pci_intr_alloc(9)/pci_intr_release(9).



details:   https://anonhg.NetBSD.org/src/rev/e4badba87a22
branches:  trunk
changeset: 341441:e4badba87a22
user:      nonaka <nonaka%NetBSD.org@localhost>
date:      Fri Nov 06 14:22:17 2015 +0000

description:
Always use pci_intr_alloc(9)/pci_intr_release(9).

diffstat:

 sys/dev/pci/if_iwm.c     |  16 ++--------------
 sys/dev/pci/if_iwmvar.h  |   4 +---
 sys/dev/pci/if_rtwn.c    |  18 ++----------------
 sys/dev/pci/if_rtwnreg.h |   4 +---
 sys/dev/pci/rtsx_pci.c   |  20 ++------------------
 5 files changed, 8 insertions(+), 54 deletions(-)

diffs (221 lines):

diff -r 42bed41651e3 -r e4badba87a22 sys/dev/pci/if_iwm.c
--- a/sys/dev/pci/if_iwm.c      Fri Nov 06 14:16:11 2015 +0000
+++ b/sys/dev/pci/if_iwm.c      Fri Nov 06 14:22:17 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_iwm.c,v 1.38 2015/10/14 02:16:51 ozaki-r Exp $      */
+/*     $NetBSD: if_iwm.c,v 1.39 2015/11/06 14:22:17 nonaka Exp $       */
 /*     OpenBSD: if_iwm.c,v 1.41 2015/05/22 06:50:54 kettenis Exp       */
 
 /*
@@ -105,7 +105,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.38 2015/10/14 02:16:51 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.39 2015/11/06 14:22:17 nonaka Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -6603,9 +6603,6 @@
        struct pci_attach_args *pa = aux;
        struct ieee80211com *ic = &sc->sc_ic;
        struct ifnet *ifp = &sc->sc_ec.ec_if;
-#ifndef __HAVE_PCI_MSI_MSIX
-       pci_intr_handle_t ih;
-#endif
        pcireg_t reg, memtype;
        char intrbuf[PCI_INTRSTR_LEN];
        const char *intrstr;
@@ -6655,7 +6652,6 @@
        }
 
        /* Install interrupt handler. */
-#ifdef __HAVE_PCI_MSI_MSIX
        error = pci_intr_alloc(pa, &sc->sc_pihp, NULL, 0);
        if (error != 0) {
                aprint_error_dev(self, "can't allocate interrupt\n");
@@ -6665,14 +6661,6 @@
            sizeof(intrbuf));
        sc->sc_ih = pci_intr_establish(sc->sc_pct, sc->sc_pihp[0], IPL_NET,
            iwm_intr, sc);
-#else  /* !__HAVE_PCI_MSI_MSIX */
-       if (pci_intr_map(pa, &ih)) {
-               aprint_error_dev(self, "can't map interrupt\n");
-               return;
-       }
-       intrstr = pci_intr_string(sc->sc_pct, ih, intrbuf, sizeof(intrbuf));
-       sc->sc_ih = pci_intr_establish(sc->sc_pct, ih, IPL_NET, iwm_intr, sc);
-#endif /* __HAVE_PCI_MSI_MSIX */
        if (sc->sc_ih == NULL) {
                aprint_error_dev(self, "can't establish interrupt");
                if (intrstr != NULL)
diff -r 42bed41651e3 -r e4badba87a22 sys/dev/pci/if_iwmvar.h
--- a/sys/dev/pci/if_iwmvar.h   Fri Nov 06 14:16:11 2015 +0000
+++ b/sys/dev/pci/if_iwmvar.h   Fri Nov 06 14:22:17 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_iwmvar.h,v 1.8 2015/07/22 15:18:01 nonaka Exp $     */
+/*     $NetBSD: if_iwmvar.h,v 1.9 2015/11/06 14:22:17 nonaka Exp $     */
 /*     OpenBSD: if_iwmvar.h,v 1.7 2015/03/02 13:51:10 jsg Exp  */
 
 /*
@@ -377,9 +377,7 @@
 
        bus_space_tag_t sc_st;
        bus_space_handle_t sc_sh;
-#ifdef __HAVE_PCI_MSI_MSIX
        pci_intr_handle_t *sc_pihp;
-#endif
 
        bus_size_t sc_sz;
        bus_dma_tag_t sc_dmat;
diff -r 42bed41651e3 -r e4badba87a22 sys/dev/pci/if_rtwn.c
--- a/sys/dev/pci/if_rtwn.c     Fri Nov 06 14:16:11 2015 +0000
+++ b/sys/dev/pci/if_rtwn.c     Fri Nov 06 14:22:17 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_rtwn.c,v 1.1 2015/08/27 14:04:08 nonaka Exp $       */
+/*     $NetBSD: if_rtwn.c,v 1.2 2015/11/06 14:22:17 nonaka Exp $       */
 /*     $OpenBSD: if_rtwn.c,v 1.5 2015/06/14 08:02:47 stsp Exp $        */
 #define        IEEE80211_NO_HT
 /*-
@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_rtwn.c,v 1.1 2015/08/27 14:04:08 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rtwn.c,v 1.2 2015/11/06 14:22:17 nonaka Exp $");
 
 #include <sys/param.h>
 #include <sys/sockio.h>
@@ -213,9 +213,6 @@
        struct ifnet *ifp = GET_IFP(sc);
        int i, error;
        pcireg_t memtype;
-#ifndef __HAVE_PCI_MSI_MSIX
-       pci_intr_handle_t ih;
-#endif
        const char *intrstr;
        char intrbuf[PCI_INTRSTR_LEN];
 
@@ -246,7 +243,6 @@
        }
 
        /* Install interrupt handler. */
-#ifdef __HAVE_PCI_MSI_MSIX
        if (pci_intr_alloc(pa, &sc->sc_pihp, NULL, 0)) {
                aprint_error_dev(self, "can't map interrupt\n");
                return;
@@ -255,14 +251,6 @@
            sizeof(intrbuf));
        sc->sc_ih = pci_intr_establish(sc->sc_pc, sc->sc_pihp[0], IPL_NET,
            rtwn_intr, sc);
-#else  /* !__HAVE_PCI_MSI_MSIX */
-       if (pci_intr_map(pa, &ih)) {
-               aprint_error_dev(self, "can't map interrupt\n");
-               return;
-       }
-       intrstr = pci_intr_string(sc->sc_pc, ih, intrbuf, sizeof(intrbuf));
-       sc->sc_ih = pci_intr_establish(sc->sc_pc, ih, IPL_NET, rtwn_intr, sc);
-#endif /* __HAVE_PCI_MSI_MSIX */
        if (sc->sc_ih == NULL) {
                aprint_error_dev(self, "can't establish interrupt");
                if (intrstr != NULL)
@@ -436,9 +424,7 @@
 
        if (sc->sc_ih != NULL) {
                pci_intr_disestablish(sc->sc_pc, sc->sc_ih);
-#ifdef __HAVE_PCI_MSI_MSIX
                pci_intr_release(sc->sc_pc, sc->sc_pihp, 1);
-#endif
        }
 
        pmf_device_deregister(self);
diff -r 42bed41651e3 -r e4badba87a22 sys/dev/pci/if_rtwnreg.h
--- a/sys/dev/pci/if_rtwnreg.h  Fri Nov 06 14:16:11 2015 +0000
+++ b/sys/dev/pci/if_rtwnreg.h  Fri Nov 06 14:22:17 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_rtwnreg.h,v 1.1 2015/08/27 14:04:08 nonaka Exp $    */
+/*     $NetBSD: if_rtwnreg.h,v 1.2 2015/11/06 14:22:17 nonaka Exp $    */
 /*     $OpenBSD: if_rtwnreg.h,v 1.3 2015/06/14 08:02:47 stsp Exp $     */
 
 /*-
@@ -1280,9 +1280,7 @@
        pci_chipset_tag_t               sc_pc;
        pcitag_t                        sc_tag;
        void                            *sc_ih;
-#ifdef __HAVE_PCI_MSI_MSIX
        pci_intr_handle_t               *sc_pihp;
-#endif
        bus_space_tag_t                 sc_st;
        bus_space_handle_t              sc_sh;
        bus_size_t                      sc_mapsize;
diff -r 42bed41651e3 -r e4badba87a22 sys/dev/pci/rtsx_pci.c
--- a/sys/dev/pci/rtsx_pci.c    Fri Nov 06 14:16:11 2015 +0000
+++ b/sys/dev/pci/rtsx_pci.c    Fri Nov 06 14:22:17 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtsx_pci.c,v 1.4 2015/09/05 04:56:53 nonaka Exp $      */
+/*     $NetBSD: rtsx_pci.c,v 1.5 2015/11/06 14:22:17 nonaka Exp $      */
 /*     $OpenBSD: rtsx_pci.c,v 1.7 2014/08/19 17:55:03 phessler Exp $   */
 
 
@@ -20,7 +20,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsx_pci.c,v 1.4 2015/09/05 04:56:53 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsx_pci.c,v 1.5 2015/11/06 14:22:17 nonaka Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -43,9 +43,7 @@
        pci_chipset_tag_t sc_pc;
        void *sc_ih;
 
-#ifdef __HAVE_PCI_MSI_MSIX
        pci_intr_handle_t *sc_pihp;
-#endif
 };
 
 static int rtsx_pci_match(device_t , cfdata_t, void *);
@@ -96,9 +94,6 @@
        struct pci_attach_args *pa = (struct pci_attach_args *)aux;
        pci_chipset_tag_t pc = pa->pa_pc;
        pcitag_t tag = pa->pa_tag;
-#ifndef __HAVE_PCI_MSI_MSIX
-       pci_intr_handle_t ih;
-#endif
        pcireg_t reg;
        char const *intrstr;
        bus_space_tag_t iot;
@@ -123,7 +118,6 @@
                return;
        }
 
-#ifdef __HAVE_PCI_MSI_MSIX
        if (pci_intr_alloc(pa, &sc->sc_pihp, NULL, 0)) {
                aprint_error_dev(self, "couldn't map interrupt\n");
                return;
@@ -131,14 +125,6 @@
        intrstr = pci_intr_string(pc, sc->sc_pihp[0], intrbuf, sizeof(intrbuf));
        sc->sc_ih = pci_intr_establish(pc, sc->sc_pihp[0], IPL_SDMMC, rtsx_intr,
            &sc->sc);
-#else  /* !__HAVE_PCI_MSI_MSIX */
-       if (pci_intr_map(pa, &ih)) {
-               aprint_error_dev(self, "couldn't map interrupt\n");
-               return;
-       }
-       intrstr = pci_intr_string(pc, ih, intrbuf, sizeof(intrbuf));
-       sc->sc_ih = pci_intr_establish(pc, ih, IPL_SDMMC, rtsx_intr, &sc->sc);
-#endif /* __HAVE_PCI_MSI_MSIX */
        if (sc->sc_ih == NULL) {
                aprint_error_dev(self, "couldn't establish interrupt\n");
                return;
@@ -198,9 +184,7 @@
                return rv;
 
        pci_intr_disestablish(sc->sc_pc, sc->sc_ih);
-#ifdef __HAVE_PCI_MSI_MSIX
        pci_intr_release(sc->sc_pc, sc->sc_pihp, 1);
-#endif /* __HAVE_PCI_MSI_MSIX */
 
        return 0;
 }



Home | Main Index | Thread Index | Old Index