Module Name:    src
Committed By:   riz
Date:           Thu Nov 22 17:28:47 UTC 2012

Modified Files:
        src/sys/dev/pci [netbsd-6]: twa.c

Log Message:
Pull up following revision(s) (requested by chs in ticket #688):
        sys/dev/pci/twa.c: revision 1.43
fix autoconf output (don't print from the match routine).


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.40.2.1 src/sys/dev/pci/twa.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/twa.c
diff -u src/sys/dev/pci/twa.c:1.40 src/sys/dev/pci/twa.c:1.40.2.1
--- src/sys/dev/pci/twa.c:1.40	Mon Jan 30 19:41:23 2012
+++ src/sys/dev/pci/twa.c	Thu Nov 22 17:28:46 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: twa.c,v 1.40 2012/01/30 19:41:23 drochner Exp $ */
+/*	$NetBSD: twa.c,v 1.40.2.1 2012/11/22 17:28:46 riz 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.40 2012/01/30 19:41:23 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: twa.c,v 1.40.2.1 2012/11/22 17:28:46 riz Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -84,9 +84,6 @@ __KERNEL_RCSID(0, "$NetBSD: twa.c,v 1.40
 #include <sys/disk.h>
 #include <sys/sysctl.h>
 #include <sys/syslog.h>
-#if 1
-#include <sys/ktrace.h>
-#endif
 
 #include <sys/bus.h>
 
@@ -386,7 +383,7 @@ struct twa_pci_identity {
 	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",
@@ -434,24 +431,32 @@ twa_request_wait_handler(struct twa_requ
 	wakeup(tr);
 }
 
-static int
-twa_match(device_t parent, cfdata_t cfdata,
-    void *aux)
+static const struct twa_pci_identity *
+twa_lookup(pcireg_t id)
 {
+	const struct twa_pci_identity *entry;
 	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);
-			}
+	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)
+{
+	struct pci_attach_args *pa = aux;
+	const struct twa_pci_identity *entry;
+
+	entry = twa_lookup(pa->pa_id);
+	if (entry != NULL) {
+		return 1;
+	}
 	return (0);
 }
 
@@ -713,7 +718,6 @@ twa_inquiry(struct twa_request *tr, int 
 		SID_QUAL_LU_NOTPRESENT;
 
 	error = twa_immediate_request(tr, TWA_REQUEST_TIMEOUT_PERIOD);
-
 	if (error != 0)
 		return (error);
 
@@ -1495,6 +1499,7 @@ twa_attach(device_t parent, device_t sel
 	pci_intr_handle_t ih;
 	const char *intrstr;
 	const struct sysctlnode *node; 
+	const struct twa_pci_identity *entry;
 	int i;
 	bool use_64bit;
 
@@ -1505,7 +1510,8 @@ twa_attach(device_t parent, device_t sel
 	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;
 		

Reply via email to