Module Name:    src
Committed By:   pgoyette
Date:           Tue May 25 08:35:45 UTC 2010

Modified Files:
        src/sys/dev/pci: pci_subr.c pci_verbose.c pcivar.h

Log Message:
Rework the pciverbose module dispatch vectors to avoid renaming the
externally-visible entrypoint name.  Also this avoids a potential
need to bump kernel version.

Requested by dyoung@ and mrg@


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/pci_verbose.c
cvs rdiff -u -r1.87 -r1.88 src/sys/dev/pci/pcivar.h

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/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.80 src/sys/dev/pci/pci_subr.c:1.81
--- src/sys/dev/pci/pci_subr.c:1.80	Mon May 24 20:29:41 2010
+++ src/sys/dev/pci/pci_subr.c	Tue May 25 08:35:45 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.80 2010/05/24 20:29:41 pgoyette Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.81 2010/05/25 08:35:45 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.80 2010/05/24 20:29:41 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.81 2010/05/25 08:35:45 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -300,15 +300,15 @@
  * In kernel, these routines are provided and linked via the
  * pciverbose module.
  */
-const char *(*pci_findvendor_vec)(pcireg_t id_reg) = pci_null;
-const char *(*pci_findproduct_vec)(pcireg_t id_reg) = pci_null;
+const char *(*pci_findvendor)(pcireg_t id_reg) = pci_null;
+const char *(*pci_findproduct)(pcireg_t id_reg) = pci_null;
 const char *pci_unmatched = "";
 #else
 /*
  * For userland we just set the vectors here.
  */
-const char *(*pci_findvendor_vec)(pcireg_t id_reg) = pci_findvendor;
-const char *(*pci_findproduct_vec)(pcireg_t id_reg) = pci_findproduct;
+const char *(*pci_findvendor)(pcireg_t id_reg) = pci_findvendor_real;
+const char *(*pci_findproduct)(pcireg_t id_reg) = pci_findproduct_real;
 const char *pci_unmatched = "unmatched ";
 #endif
 
@@ -362,8 +362,8 @@
 	interface = PCI_INTERFACE(class_reg);
 	revision = PCI_REVISION(class_reg);
 
-	vendor_namep = pci_findvendor_vec(id_reg);
-	product_namep = pci_findproduct_vec(id_reg);
+	vendor_namep = pci_findvendor(id_reg);
+	product_namep = pci_findproduct(id_reg);
 
 	classp = pci_class;
 	while (classp->name != NULL) {
@@ -439,13 +439,13 @@
 	pcireg_t rval;
 
 	rval = regs[o2i(PCI_ID_REG)];
-	name = pci_findvendor_vec(rval);
+	name = pci_findvendor(rval);
 	if (name)
 		printf("    Vendor Name: %s (0x%04x)\n", name,
 		    PCI_VENDOR(rval));
 	else
 		printf("    Vendor ID: 0x%04x\n", PCI_VENDOR(rval));
-	name = pci_findproduct_vec(rval);
+	name = pci_findproduct(rval);
 	if (name)
 		printf("    Device Name: %s (0x%04x)\n", name,
 		    PCI_PRODUCT(rval));

Index: src/sys/dev/pci/pci_verbose.c
diff -u src/sys/dev/pci/pci_verbose.c:1.1 src/sys/dev/pci/pci_verbose.c:1.2
--- src/sys/dev/pci/pci_verbose.c:1.1	Mon May 24 20:29:40 2010
+++ src/sys/dev/pci/pci_verbose.c	Tue May 25 08:35:45 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_verbose.c,v 1.1 2010/05/24 20:29:40 pgoyette Exp $	*/
+/*	$NetBSD: pci_verbose.c,v 1.2 2010/05/25 08:35:45 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_verbose.c,v 1.1 2010/05/24 20:29:40 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_verbose.c,v 1.2 2010/05/25 08:35:45 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -82,13 +82,13 @@
 	aprint_normal("%s: cmd %d\n", __func__, cmd);	/* XXX */
 	switch (cmd) {
 	case MODULE_CMD_INIT:
-		pci_findvendor_vec = pci_findvendor;
-		pci_findproduct_vec = pci_findproduct;
+		pci_findvendor = pci_findvendor_real;
+		pci_findproduct = pci_findproduct_real;
 		pci_unmatched = "unmatched ";
 		return 0;
 	case MODULE_CMD_FINI:
-		pci_findvendor_vec = pci_null;
-		pci_findproduct_vec = pci_null;
+		pci_findvendor = pci_null;
+		pci_findproduct = pci_null;
 		pci_unmatched = "";
 		return 0;
 	default:
@@ -113,7 +113,7 @@
 }
 
 const char *
-pci_findvendor(pcireg_t id_reg)
+pci_findvendor_real(pcireg_t id_reg)
 {
 	static char buf[256];
 	pci_vendor_id_t vendor = PCI_VENDOR(id_reg);
@@ -133,7 +133,7 @@
 }
 
 const char *
-pci_findproduct(pcireg_t id_reg)
+pci_findproduct_real(pcireg_t id_reg)
 {
 	static char buf[256];
 	pci_vendor_id_t vendor = PCI_VENDOR(id_reg);

Index: src/sys/dev/pci/pcivar.h
diff -u src/sys/dev/pci/pcivar.h:1.87 src/sys/dev/pci/pcivar.h:1.88
--- src/sys/dev/pci/pcivar.h:1.87	Mon May 24 20:29:41 2010
+++ src/sys/dev/pci/pcivar.h	Tue May 25 08:35:45 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcivar.h,v 1.87 2010/05/24 20:29:41 pgoyette Exp $	*/
+/*	$NetBSD: pcivar.h,v 1.88 2010/05/25 08:35:45 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -279,13 +279,13 @@
 /*
  * Misc.
  */
-const char *pci_findvendor(pcireg_t);
-const char *pci_findproduct(pcireg_t);
+const char *pci_findvendor_real(pcireg_t);
+const char *pci_findproduct_real(pcireg_t);
 const char *pci_null(pcireg_t);
 void pci_verbose_ctl(bool);
 
-extern const char *(*pci_findvendor_vec)(pcireg_t);
-extern const char *(*pci_findproduct_vec)(pcireg_t);
+extern const char *(*pci_findvendor)(pcireg_t);
+extern const char *(*pci_findproduct)(pcireg_t);
 extern const char *pci_unmatched;
 
 int	pci_find_device(struct pci_attach_args *pa,

Reply via email to