Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci fix autoconf output (don't print from the match ...



details:   https://anonhg.NetBSD.org/src/rev/817d2d73501d
branches:  trunk
changeset: 782419:817d2d73501d
user:      chs <chs%NetBSD.org@localhost>
date:      Fri Nov 02 14:59:11 2012 +0000

description:
fix autoconf output (don't print from the match routine).

diffstat:

 sys/dev/pci/twa.c |  50 ++++++++++++++++++++++++++++----------------------
 1 files changed, 28 insertions(+), 22 deletions(-)

diffs (109 lines):

diff -r f0acd276c06b -r 817d2d73501d sys/dev/pci/twa.c
--- a/sys/dev/pci/twa.c Fri Nov 02 14:53:03 2012 +0000
+++ b/sys/dev/pci/twa.c Fri Nov 02 14:59:11 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: twa.c,v 1.42 2012/07/28 00:42:47 matt Exp $ */
+/*     $NetBSD: twa.c,v 1.43 2012/11/02 14:59:11 chs Exp $ */
 /*     $wasabi: twa.c,v 1.27 2006/07/28 18:17:21 wrstuden Exp $        */
 
 /*-
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: twa.c,v 1.42 2012/07/28 00:42:47 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: twa.c,v 1.43 2012/11/02 14:59:11 chs Exp $");
 
 //#define TWA_DEBUG
 
@@ -86,9 +86,6 @@
 #include <sys/disk.h>
 #include <sys/sysctl.h>
 #include <sys/syslog.h>
-#if 1
-#include <sys/ktrace.h>
-#endif
 
 #include <sys/bus.h>
 
@@ -388,7 +385,7 @@
        const char      *name;
 };
 
-static const struct twa_pci_identity pci_twa_products[] = {
+static const struct twa_pci_identity twa_pci_products[] = {
        { PCI_VENDOR_3WARE,
          PCI_PRODUCT_3WARE_9000,
          "3ware 9000 series",
@@ -436,23 +433,31 @@
        wakeup(tr);
 }
 
+static const struct twa_pci_identity *
+twa_lookup(pcireg_t id)
+{
+       const struct twa_pci_identity *entry;
+       int i;
+
+       for (i = 0; i < __arraycount(twa_pci_products); i++) {
+               entry = &twa_pci_products[i];
+               if (entry->vendor_id == PCI_VENDOR(id) &&
+                   entry->product_id == PCI_PRODUCT(id)) {
+                       return entry;
+               }
+       }
+       return NULL;
+}
+
 static int
-twa_match(device_t parent, cfdata_t cfdata,
-    void *aux)
+twa_match(device_t parent, cfdata_t cfdata, void *aux)
 {
-       int i;
        struct pci_attach_args *pa = aux;
-       const struct twa_pci_identity *entry = 0;
-
-       if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_3WARE) {
-               for (i = 0; (pci_twa_products[i].product_id); i++) {
-                       entry = &pci_twa_products[i];
-                       if (entry->product_id == PCI_PRODUCT(pa->pa_id)) {
-                               aprint_normal("%s: (rev. 0x%02x)\n",
-                                   entry->name, PCI_REVISION(pa->pa_class));
-                               return (1);
-                       }
-               }
+       const struct twa_pci_identity *entry;
+
+       entry = twa_lookup(pa->pa_id);
+       if (entry != NULL) {
+               return 1;
        }
        return (0);
 }
@@ -715,7 +720,6 @@
                SID_QUAL_LU_NOTPRESENT;
 
        error = twa_immediate_request(tr, TWA_REQUEST_TIMEOUT_PERIOD);
-
        if (error != 0)
                return (error);
 
@@ -1497,6 +1501,7 @@
        pci_intr_handle_t ih;
        const char *intrstr;
        const struct sysctlnode *node; 
+       const struct twa_pci_identity *entry;
        int i;
        bool use_64bit;
 
@@ -1509,7 +1514,8 @@
        sc->pc = pa->pa_pc;
        sc->tag = pa->pa_tag;
 
-       pci_aprint_devinfo_fancy(pa, "RAID controller", "3ware Apache", 0);
+       entry = twa_lookup(pa->pa_id);
+       pci_aprint_devinfo_fancy(pa, "RAID controller", entry->name, 1);
 
        sc->sc_quirks = 0;
                



Home | Main Index | Thread Index | Old Index