From 331ad846998b344080549879f03115881213a729 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Sun, 30 Sep 2012 02:16:18 +0000 Subject: Simplify the gem(4) variant detection code a bit. ok haesbaert@ --- sys/dev/pci/if_gem_pci.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/pci/if_gem_pci.c b/sys/dev/pci/if_gem_pci.c index e164b6f3bed..80c8b8a18d3 100644 --- a/sys/dev/pci/if_gem_pci.c +++ b/sys/dev/pci/if_gem_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_gem_pci.c,v 1.32 2011/04/03 15:36:02 jasper Exp $ */ +/* $OpenBSD: if_gem_pci.c,v 1.33 2012/09/30 02:16:17 brad Exp $ */ /* $NetBSD: if_gem_pci.c,v 1.1 2001/09/16 00:11:42 eeh Exp $ */ /* @@ -227,22 +227,19 @@ gem_attach_pci(struct device *parent, struct device *self, void *aux) sc->sc_pci = 1; /* XXXXX should all be done in bus_dma. */ - if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_SUN_GEMNETWORK) + switch (PCI_PRODUCT(pa->pa_id)) { + case PCI_PRODUCT_SUN_GEMNETWORK: sc->sc_variant = GEM_SUN_GEM; - else if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_SUN_ERINETWORK) + break; + case PCI_PRODUCT_SUN_ERINETWORK: sc->sc_variant = GEM_SUN_ERI; - else if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_APPLE_INTREPID2_GMAC) - sc->sc_variant = GEM_APPLE_GMAC; - else if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_APPLE_PANGEA_GMAC) - sc->sc_variant = GEM_APPLE_GMAC; - else if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_APPLE_SHASTA_GMAC) - sc->sc_variant = GEM_APPLE_GMAC; - else if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_APPLE_UNINORTHGMAC) - sc->sc_variant = GEM_APPLE_GMAC; - else if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_APPLE_UNINORTH2GMAC) - sc->sc_variant = GEM_APPLE_GMAC; - else if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_APPLE_K2_GMAC) + break; + case PCI_PRODUCT_APPLE_K2_GMAC: sc->sc_variant = GEM_APPLE_K2_GMAC; + break; + default: + sc->sc_variant = GEM_APPLE_GMAC; + } #define PCI_GEM_BASEADDR 0x10 if (pci_mapreg_map(pa, PCI_GEM_BASEADDR, type, 0, -- cgit v1.2.3