Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Only match supported boards.



details:   https://anonhg.NetBSD.org/src/rev/73e114226ae4
branches:  trunk
changeset: 772785:73e114226ae4
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Mon Jan 16 15:33:50 2012 +0000

description:
Only match supported boards.

diffstat:

 sys/dev/pci/cxdtv.c |  22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)

diffs (59 lines):

diff -r 9c753253acaa -r 73e114226ae4 sys/dev/pci/cxdtv.c
--- a/sys/dev/pci/cxdtv.c       Mon Jan 16 14:57:45 2012 +0000
+++ b/sys/dev/pci/cxdtv.c       Mon Jan 16 15:33:50 2012 +0000
@@ -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 @@
 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 @@
        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));



Home | Main Index | Thread Index | Old Index