Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Use pci_intr_alloc().



details:   https://anonhg.NetBSD.org/src/rev/7cfc75ab7928
branches:  trunk
changeset: 339486:7cfc75ab7928
user:      nonaka <nonaka%NetBSD.org@localhost>
date:      Fri Jul 24 15:43:38 2015 +0000

description:
Use pci_intr_alloc().

diffstat:

 sys/dev/pci/if_iwm.c |  26 +++++++++-----------------
 1 files changed, 9 insertions(+), 17 deletions(-)

diffs (62 lines):

diff -r bee6f1296785 -r 7cfc75ab7928 sys/dev/pci/if_iwm.c
--- a/sys/dev/pci/if_iwm.c      Fri Jul 24 15:20:37 2015 +0000
+++ b/sys/dev/pci/if_iwm.c      Fri Jul 24 15:43:38 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_iwm.c,v 1.36 2015/07/22 15:18:01 nonaka Exp $       */
+/*     $NetBSD: if_iwm.c,v 1.37 2015/07/24 15:43:38 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.36 2015/07/22 15:18:01 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.37 2015/07/24 15:43:38 nonaka Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -6607,6 +6607,7 @@
        pci_intr_handle_t ih;
 #endif
        pcireg_t reg, memtype;
+       char intrbuf[PCI_INTRSTR_LEN];
        const char *intrstr;
        int error;
        int txq_i;
@@ -6655,29 +6656,20 @@
 
        /* Install interrupt handler. */
 #ifdef __HAVE_PCI_MSI_MSIX
-       error = ENODEV;
-       if (pci_msi_count(pa) > 0)
-               error = pci_msi_alloc_exact(pa, &sc->sc_pihp, 1);
+       error = pci_intr_alloc(pa, &sc->sc_pihp, NULL, 0);
        if (error != 0) {
-               if (pci_intx_alloc(pa, &sc->sc_pihp)) {
-                       aprint_error_dev(self, "can't map interrupt\n");
-                       return;
-               }
-       }
-#else  /* !__HAVE_PCI_MSI_MSIX */
-       if (pci_intr_map(pa, &ih)) {
-               aprint_error_dev(self, "can't map interrupt\n");
+               aprint_error_dev(self, "can't allocate interrupt\n");
                return;
        }
-#endif /* __HAVE_PCI_MSI_MSIX */
-
-       char intrbuf[PCI_INTRSTR_LEN];
-#ifdef __HAVE_PCI_MSI_MSIX
        intrstr = pci_intr_string(sc->sc_pct, sc->sc_pihp[0], intrbuf,
            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 */



Home | Main Index | Thread Index | Old Index