Module Name: src
Committed By: jmcneill
Date: Mon Jan 16 15:33:50 UTC 2012
Modified Files:
src/sys/dev/pci: cxdtv.c
Log Message:
Only match supported boards.
To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/cxdtv.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/cxdtv.c
diff -u src/sys/dev/pci/cxdtv.c:1.9 src/sys/dev/pci/cxdtv.c:1.10
--- src/sys/dev/pci/cxdtv.c:1.9 Mon Sep 26 18:07:37 2011
+++ src/sys/dev/pci/cxdtv.c Mon Jan 16 15:33:50 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: cxdtv.c,v 1.9 2011/09/26 18:07:37 jakllsch Exp $ */
+/* $NetBSD: cxdtv.c,v 1.10 2012/01/16 15:33:50 jmcneill Exp $ */
/*
* Copyright (c) 2008, 2011 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cxdtv.c,v 1.9 2011/09/26 18:07:37 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cxdtv.c,v 1.10 2012/01/16 15:33:50 jmcneill Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -161,20 +161,21 @@ static int
cxdtv_match(device_t parent, cfdata_t match, void *aux)
{
const struct pci_attach_args *pa;
+ pcireg_t reg;
pa = aux;
if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_CONEXANT)
return 0;
- switch (PCI_PRODUCT(pa->pa_id)) {
- case PCI_PRODUCT_CONEXANT_CX2388XMPEG:
- return 1;
- }
+ if (PCI_PRODUCT(pa->pa_id) != PCI_PRODUCT_CONEXANT_CX2388XMPEG)
+ return 0;
- /* XXX only match supported boards */
+ reg = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_SUBSYS_ID_REG);
+ if (cxdtv_board_lookup(PCI_VENDOR(reg), PCI_PRODUCT(reg)) == NULL)
+ return 0;
- return 0;
+ return 1;
}
static void
@@ -201,11 +202,8 @@ cxdtv_attach(device_t parent, device_t s
sc->sc_product = PCI_PRODUCT(reg);
sc->sc_board = cxdtv_board_lookup(sc->sc_vendor, sc->sc_product);
+ KASSERT(sc->sc_board != NULL);
- if (sc->sc_board == NULL) {
- aprint_error_dev(self ,"unsupported device 0x%08x\n", reg);
- return;
- }
pci_devinfo(reg, pa->pa_class, 0, devinfo, sizeof(devinfo));
aprint_normal(": %s (rev. 0x%02x)\n", devinfo, PCI_REVISION(pa->pa_class));