PERFORCE change 140186 for review
Sam Leffler
sam at FreeBSD.org
Thu Apr 17 23:10:50 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=140186
Change 140186 by sam at sam_ebb on 2008/04/17 23:09:58
cleanup
Affected files ...
.. //depot/projects/vap/sys/dev/mwl/if_mwl_pci.c#2 edit
Differences ...
==== //depot/projects/vap/sys/dev/mwl/if_mwl_pci.c#2 (text+ko) ====
@@ -78,17 +78,43 @@
#define BS_BAR0 0x10
#define BS_BAR1 0x14
+struct mwl_pci_ident {
+ uint16_t vendor;
+ uint16_t device;
+ const char *name;
+};
+
+static const struct mwl_pci_ident mwl_pci_ids[] = {
+ { 0x11ab, 0x2a02, "Marvell 88W8363" },
+ { 0x11ab, 0x2a03, "Marvell 88W8363" },
+ { 0x11ab, 0x2a0a, "Marvell 88W8363" },
+ { 0x11ab, 0x2a0b, "Marvell 88W8363" },
+ { 0x11ab, 0x2a0c, "Marvell 88W8363" },
+ { 0x11ab, 0x2a21, "Marvell 88W8363" },
+ { 0x11ab, 0x2a24, "Marvell 88W8363" },
+
+ { 0, 0, NULL }
+};
+
+const static struct mwl_pci_ident *
+mwl_pci_lookup(int vendor, int device)
+{
+ const struct mwl_pci_ident *ident;
+
+ for (ident = mwl_pci_ids; ident->name != NULL; ident++)
+ if (vendor == ident->vendor && device == ident->device)
+ return ident;
+ return NULL;
+}
+
static int
mwl_pci_probe(device_t dev)
{
- if (pci_get_vendor(dev) == 0x11ab &&
- (pci_get_device(dev) == 0x2a02
- || pci_get_device(dev) == 0x2a03
- || pci_get_device(dev) == 0x2a0b
- || pci_get_device(dev) == 0x2a0c
- || pci_get_device(dev) == 0x2a21
- || pci_get_device(dev) == 0x2a24)) {
- device_set_desc(dev, "Marvell 88W8363");
+ const struct mwl_pci_ident *ident;
+
+ ident = mwl_pci_lookup(pci_get_vendor(dev), pci_get_device(dev));
+ if (ident != NULL) {
+ device_set_desc(dev, ident->name);
return BUS_PROBE_DEFAULT;
}
return ENXIO;
More information about the p4-projects
mailing list