diff options
Diffstat (limited to 'sys')
56 files changed, 144 insertions, 152 deletions
diff --git a/sys/dev/pci/adv_pci.c b/sys/dev/pci/adv_pci.c index 3ba0a4a9c77..73a84daf9f9 100644 --- a/sys/dev/pci/adv_pci.c +++ b/sys/dev/pci/adv_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adv_pci.c,v 1.10 2008/06/26 05:42:17 ray Exp $ */ +/* $OpenBSD: adv_pci.c,v 1.11 2011/04/03 15:36:02 jasper Exp $ */ /* $NetBSD: adv_pci.c,v 1.5 1998/09/26 15:52:55 dante Exp $ */ /* @@ -108,7 +108,7 @@ adv_pci_match(parent, match, aux) void *match, *aux; { return (pci_matchbyid((struct pci_attach_args *)aux, adv_pci_devices, - sizeof(adv_pci_devices)/sizeof(adv_pci_devices[0]))); + nitems(adv_pci_devices))); } diff --git a/sys/dev/pci/adw_pci.c b/sys/dev/pci/adw_pci.c index b35b22d821b..02e14bb0983 100644 --- a/sys/dev/pci/adw_pci.c +++ b/sys/dev/pci/adw_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adw_pci.c,v 1.15 2008/06/26 05:42:17 ray Exp $ */ +/* $OpenBSD: adw_pci.c,v 1.16 2011/04/03 15:36:02 jasper Exp $ */ /* $NetBSD: adw_pci.c,v 1.7 2000/05/26 15:13:46 dante Exp $ */ /* @@ -97,7 +97,7 @@ adw_pci_match(parent, match, aux) void *aux; { return (pci_matchbyid((struct pci_attach_args *)aux, adw_pci_devices, - sizeof(adw_pci_devices)/sizeof(adw_pci_devices[0]))); + nitems(adw_pci_devices))); } diff --git a/sys/dev/pci/auacer.c b/sys/dev/pci/auacer.c index 6888b10b60d..29de17a7bdc 100644 --- a/sys/dev/pci/auacer.c +++ b/sys/dev/pci/auacer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auacer.c,v 1.10 2010/09/21 02:12:20 jakemsr Exp $ */ +/* $OpenBSD: auacer.c,v 1.11 2011/04/03 15:36:02 jasper Exp $ */ /* $NetBSD: auacer.c,v 1.3 2004/11/10 04:20:26 kent Exp $ */ /*- @@ -227,7 +227,7 @@ int auacer_match(struct device *parent, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, auacer_pci_devices, - sizeof(auacer_pci_devices)/sizeof(auacer_pci_devices[0]))); + nitems(auacer_pci_devices))); } void @@ -541,7 +541,7 @@ auacer_fixup_rate(int rate) 8000, 11025, 12000, 16000, 22050, 32000, 44100, 48000 }; - for (i = 0; i < sizeof(rates)/sizeof(rates[0]) - 1; i++) + for (i = 0; i < nitems(rates) - 1; i++) if (rate <= (rates[i] + rates[i+1]) / 2) return (rates[i]); return (rates[i]); @@ -983,7 +983,7 @@ auacer_allocmem(struct auacer_softc *sc, size_t size, size_t align, p->size = size; error = bus_dmamem_alloc(sc->dmat, p->size, align, 0, p->segs, - sizeof(p->segs)/sizeof(p->segs[0]), &p->nsegs, BUS_DMA_NOWAIT); + nitems(p->segs), &p->nsegs, BUS_DMA_NOWAIT); if (error) return (error); diff --git a/sys/dev/pci/auich.c b/sys/dev/pci/auich.c index 6d66b6ec0e5..920bd4e50b7 100644 --- a/sys/dev/pci/auich.c +++ b/sys/dev/pci/auich.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auich.c,v 1.93 2010/09/12 03:17:34 jakemsr Exp $ */ +/* $OpenBSD: auich.c,v 1.94 2011/04/03 15:36:02 jasper Exp $ */ /* * Copyright (c) 2000,2001 Michael Shalayeff @@ -372,7 +372,7 @@ auich_match(parent, match, aux) struct pci_attach_args *pa = aux; int i; - for (i = sizeof(auich_devices)/sizeof(auich_devices[0]); i--;) + for (i = nitems(auich_devices); i--;) if (PCI_VENDOR(pa->pa_id) == auich_devices[i].vendor && PCI_PRODUCT(pa->pa_id) == auich_devices[i].product) return 1; @@ -463,7 +463,7 @@ auich_attach(parent, self, aux) return; } - for (i = sizeof(auich_devices)/sizeof(auich_devices[0]); i--;) + for (i = nitems(auich_devices); i--;) if (PCI_PRODUCT(pa->pa_id) == auich_devices[i].product) break; diff --git a/sys/dev/pci/autri.c b/sys/dev/pci/autri.c index 860bf8aeab5..03027077a57 100644 --- a/sys/dev/pci/autri.c +++ b/sys/dev/pci/autri.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autri.c,v 1.28 2010/09/21 02:53:14 jakemsr Exp $ */ +/* $OpenBSD: autri.c,v 1.29 2011/04/03 15:36:02 jasper Exp $ */ /* * Copyright (c) 2001 SOMEYA Yoshihiko and KUROSAWA Takahiro. @@ -499,7 +499,7 @@ autri_match(parent, match, aux) } return (pci_matchbyid((struct pci_attach_args *)aux, autri_devices, - sizeof(autri_devices)/sizeof(autri_devices[0]))); + nitems(autri_devices))); } void @@ -882,8 +882,7 @@ autri_allocmem(sc, size, align, p) p->size = size; error = bus_dmamem_alloc(sc->sc_dmatag, p->size, align, 0, - p->segs, sizeof(p->segs)/sizeof(p->segs[0]), - &p->nsegs, BUS_DMA_NOWAIT); + p->segs, nitems(p->segs), &p->nsegs, BUS_DMA_NOWAIT); if (error) return (error); diff --git a/sys/dev/pci/auvia.c b/sys/dev/pci/auvia.c index adde9086c00..8bc1af6bfb9 100644 --- a/sys/dev/pci/auvia.c +++ b/sys/dev/pci/auvia.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auvia.c,v 1.47 2010/09/12 03:17:34 jakemsr Exp $ */ +/* $OpenBSD: auvia.c,v 1.48 2011/04/03 15:36:02 jasper Exp $ */ /* $NetBSD: auvia.c,v 1.28 2002/11/04 16:38:49 kent Exp $ */ /*- @@ -233,7 +233,7 @@ int auvia_match(struct device *parent, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, auvia_devices, - sizeof(auvia_devices)/sizeof(auvia_devices[0]))); + nitems(auvia_devices))); } int diff --git a/sys/dev/pci/bha_pci.c b/sys/dev/pci/bha_pci.c index 8937311212f..152567ee7ec 100644 --- a/sys/dev/pci/bha_pci.c +++ b/sys/dev/pci/bha_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bha_pci.c,v 1.10 2009/03/29 21:53:52 sthen Exp $ */ +/* $OpenBSD: bha_pci.c,v 1.11 2011/04/03 15:36:02 jasper Exp $ */ /* $NetBSD: bha_pci.c,v 1.16 1998/08/15 10:10:53 mycroft Exp $ */ /*- @@ -77,8 +77,7 @@ bha_pci_match(parent, match, aux) bus_size_t iosize; int rv; - if (pci_matchbyid(pa, bha_pci_devices, - sizeof(bha_pci_devices)/sizeof(bha_pci_devices[0])) == 0) + if (pci_matchbyid(pa, bha_pci_devices, nitems(bha_pci_devices)) == 0) return (0); if (pci_mapreg_map(pa, PCI_CBIO, PCI_MAPREG_TYPE_IO, 0, &iot, &ioh, diff --git a/sys/dev/pci/cmpci.c b/sys/dev/pci/cmpci.c index 06f619ef60c..76d94c794d6 100644 --- a/sys/dev/pci/cmpci.c +++ b/sys/dev/pci/cmpci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmpci.c,v 1.30 2010/10/09 09:11:13 jakemsr Exp $ */ +/* $OpenBSD: cmpci.c,v 1.31 2011/04/03 15:36:02 jasper Exp $ */ /* $NetBSD: cmpci.c,v 1.25 2004/10/26 06:32:20 xtraeme Exp $ */ /* @@ -350,7 +350,7 @@ int cmpci_match(struct device *parent, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, cmpci_devices, - sizeof(cmpci_devices)/sizeof(cmpci_devices[0]))); + nitems(cmpci_devices))); } void @@ -1339,7 +1339,7 @@ cmpci_alloc_dmamem(struct cmpci_softc *sc, size_t size, int type, int flags, n->cd_size = size; error = bus_dmamem_alloc(n->cd_tag, n->cd_size, CMPCI_DMABUF_ALIGN, CMPCI_DMABUF_BOUNDARY, n->cd_segs, - sizeof(n->cd_segs)/sizeof(n->cd_segs[0]), &n->cd_nsegs, w); + nitems(n->cd_segs), &n->cd_nsegs, w); if (error) goto mfree; error = bus_dmamem_map(n->cd_tag, n->cd_segs, n->cd_nsegs, n->cd_size, @@ -1366,7 +1366,7 @@ cmpci_alloc_dmamem(struct cmpci_softc *sc, size_t size, int type, int flags, bus_dmamem_unmap(n->cd_tag, n->cd_addr, n->cd_size); dmafree: bus_dmamem_free(n->cd_tag, - n->cd_segs, sizeof(n->cd_segs)/sizeof(n->cd_segs[0])); + n->cd_segs, nitems(n->cd_segs)); mfree: free(n, type); quit: @@ -1385,7 +1385,7 @@ cmpci_free_dmamem(struct cmpci_softc *sc, caddr_t addr, int type) bus_dmamap_destroy(n->cd_tag, n->cd_map); bus_dmamem_unmap(n->cd_tag, n->cd_addr, n->cd_size); bus_dmamem_free(n->cd_tag, n->cd_segs, - sizeof(n->cd_segs)/sizeof(n->cd_segs[0])); + nitems(n->cd_segs)); free(n, type); return 0; } @@ -1980,8 +1980,7 @@ cmpci_mappage(void *handle, void *addr, off_t offset, int prot) return -1; return bus_dmamem_mmap(p->cd_tag, p->cd_segs, - sizeof(p->cd_segs)/sizeof(p->cd_segs[0]), - offset, prot, BUS_DMA_WAITOK); + nitems(p->cd_segs), offset, prot, BUS_DMA_WAITOK); } /* ARGSUSED */ diff --git a/sys/dev/pci/cs4280.c b/sys/dev/pci/cs4280.c index fad800d5496..433a441351c 100644 --- a/sys/dev/pci/cs4280.c +++ b/sys/dev/pci/cs4280.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cs4280.c,v 1.38 2010/09/12 03:17:34 jakemsr Exp $ */ +/* $OpenBSD: cs4280.c,v 1.39 2011/04/03 15:36:02 jasper Exp $ */ /* $NetBSD: cs4280.c,v 1.5 2000/06/26 04:56:23 simonb Exp $ */ /* @@ -304,7 +304,7 @@ cs4280_match(parent, ma, aux) void *aux; { return (pci_matchbyid((struct pci_attach_args *)aux, cs4280_devices, - sizeof(cs4280_devices)/sizeof(cs4280_devices[0]))); + nitems(cs4280_devices))); } int diff --git a/sys/dev/pci/cs4281.c b/sys/dev/pci/cs4281.c index 707a7219204..6c3fe26f45b 100644 --- a/sys/dev/pci/cs4281.c +++ b/sys/dev/pci/cs4281.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cs4281.c,v 1.26 2010/09/22 22:22:47 jakemsr Exp $ */ +/* $OpenBSD: cs4281.c,v 1.27 2011/04/03 15:36:02 jasper Exp $ */ /* $Tera: cs4281.c,v 1.18 2000/12/27 14:24:45 tacha Exp $ */ /* @@ -1505,7 +1505,7 @@ cs4281_allocmem(struct cs4281_softc *sc, size_t size, int pool, int flags, if (!p->dum) return (1); error = bus_dmamem_alloc(sc->sc_dmatag, p->size, align, 0, - p->segs, sizeof(p->segs)/sizeof(p->segs[0]), + p->segs, nitems(p->segs), &p->nsegs, BUS_DMA_NOWAIT); if (error) { printf("%s: unable to allocate dma. error=%d\n", diff --git a/sys/dev/pci/cy_pci.c b/sys/dev/pci/cy_pci.c index cfd502ec4ff..1fbf5e8ea8b 100644 --- a/sys/dev/pci/cy_pci.c +++ b/sys/dev/pci/cy_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cy_pci.c,v 1.13 2004/06/13 17:30:27 pvalchev Exp $ */ +/* $OpenBSD: cy_pci.c,v 1.14 2011/04/03 15:36:02 jasper Exp $ */ /* * Copyright (c) 1996 Timo Rossi. * All rights reserved. @@ -85,7 +85,7 @@ cy_pci_match(parent, match, aux) void *match, *aux; { return (pci_matchbyid((struct pci_attach_args *)aux, cy_pci_devices, - sizeof(cy_pci_devices)/sizeof(cy_pci_devices[0]))); + nitems(cy_pci_devices))); } void diff --git a/sys/dev/pci/eap.c b/sys/dev/pci/eap.c index a528d4d2d01..2d4cb514683 100644 --- a/sys/dev/pci/eap.c +++ b/sys/dev/pci/eap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eap.c,v 1.41 2010/09/22 21:59:59 jakemsr Exp $ */ +/* $OpenBSD: eap.c,v 1.42 2011/04/03 15:36:02 jasper Exp $ */ /* $NetBSD: eap.c,v 1.46 2001/09/03 15:07:37 reinoud Exp $ */ /* @@ -288,7 +288,7 @@ int eap_match(struct device *parent, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, eap_devices, - sizeof(eap_devices)/sizeof(eap_devices[0]))); + nitems(eap_devices))); } int @@ -799,7 +799,7 @@ eap_allocmem(struct eap_softc *sc, size_t size, size_t align, struct eap_dma *p) p->size = size; error = bus_dmamem_alloc(sc->sc_dmatag, p->size, align, 0, - p->segs, sizeof(p->segs)/sizeof(p->segs[0]), + p->segs, nitems(p->segs), &p->nsegs, BUS_DMA_NOWAIT); if (error) return (error); diff --git a/sys/dev/pci/emuxki.c b/sys/dev/pci/emuxki.c index 4ce878bbd8d..24dcfbe3b2a 100644 --- a/sys/dev/pci/emuxki.c +++ b/sys/dev/pci/emuxki.c @@ -1,4 +1,4 @@ -/* $OpenBSD: emuxki.c,v 1.37 2010/09/12 03:17:34 jakemsr Exp $ */ +/* $OpenBSD: emuxki.c,v 1.38 2011/04/03 15:36:02 jasper Exp $ */ /* $NetBSD: emuxki.c,v 1.1 2001/10/17 18:39:41 jdolecek Exp $ */ /*- @@ -427,7 +427,7 @@ int emuxki_match(struct device *parent, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, emuxki_devices, - sizeof(emuxki_devices)/sizeof(emuxki_devices[0]))); + nitems(emuxki_devices))); } void diff --git a/sys/dev/pci/esa.c b/sys/dev/pci/esa.c index 156a8bee9da..dff77f9bf3f 100644 --- a/sys/dev/pci/esa.c +++ b/sys/dev/pci/esa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: esa.c,v 1.22 2010/09/07 16:21:44 deraadt Exp $ */ +/* $OpenBSD: esa.c,v 1.23 2011/04/03 15:36:02 jasper Exp $ */ /* $NetBSD: esa.c,v 1.12 2002/03/24 14:17:35 jmcneill Exp $ */ /* @@ -1015,7 +1015,7 @@ int esa_match(struct device *dev, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, esa_devices, - sizeof(esa_devices)/sizeof(esa_devices[0]))); + nitems(esa_devices))); } void diff --git a/sys/dev/pci/gcu.c b/sys/dev/pci/gcu.c index 92e1f86b15d..847edd020c1 100644 --- a/sys/dev/pci/gcu.c +++ b/sys/dev/pci/gcu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gcu.c,v 1.2 2009/12/03 11:07:46 dms Exp $ */ +/* $OpenBSD: gcu.c,v 1.3 2011/04/03 15:36:02 jasper Exp $ */ /* * Copyright (c) 2009 Dariusz Swiderski <sfires@sfires.net> @@ -50,7 +50,7 @@ int gcu_probe(struct device *parent, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, gcu_devices, - sizeof(gcu_devices)/sizeof(gcu_devices[0]))); + nitems(gcu_devices))); } void diff --git a/sys/dev/pci/hifn7751.c b/sys/dev/pci/hifn7751.c index 3b669a251de..aa64a03f767 100644 --- a/sys/dev/pci/hifn7751.c +++ b/sys/dev/pci/hifn7751.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hifn7751.c,v 1.164 2011/01/12 20:55:22 deraadt Exp $ */ +/* $OpenBSD: hifn7751.c,v 1.165 2011/04/03 15:36:02 jasper Exp $ */ /* * Invertex AEON / Hifn 7751 driver @@ -135,7 +135,7 @@ int hifn_probe(struct device *parent, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, hifn_devices, - sizeof(hifn_devices)/sizeof(hifn_devices[0]))); + nitems(hifn_devices))); } void @@ -610,7 +610,7 @@ hifn_enable_crypto(struct hifn_softc *sc, pcireg_t pciid) u_int32_t dmacfg, ramcfg, encl, addr, i; char *offtbl = NULL; - for (i = 0; i < sizeof(pci2id)/sizeof(pci2id[0]); i++) { + for (i = 0; i < nitems(pci2id); i++) { if (pci2id[i].pci_vendor == PCI_VENDOR(pciid) && pci2id[i].pci_prod == PCI_PRODUCT(pciid)) { offtbl = pci2id[i].card_id; diff --git a/sys/dev/pci/if_an_pci.c b/sys/dev/pci/if_an_pci.c index abb6b755a8f..4d4389f45c3 100644 --- a/sys/dev/pci/if_an_pci.c +++ b/sys/dev/pci/if_an_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_an_pci.c,v 1.17 2009/03/29 21:53:52 sthen Exp $ */ +/* $OpenBSD: if_an_pci.c,v 1.18 2011/04/03 15:36:02 jasper Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -102,7 +102,7 @@ int an_pci_match(struct device *parent, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, an_pci_devices, - sizeof(an_pci_devices)/sizeof(an_pci_devices[0]))); + nitems(an_pci_devices))); } void diff --git a/sys/dev/pci/if_atw_pci.c b/sys/dev/pci/if_atw_pci.c index b1056206c6c..2b44e73b3c0 100644 --- a/sys/dev/pci/if_atw_pci.c +++ b/sys/dev/pci/if_atw_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_atw_pci.c,v 1.13 2010/08/29 16:47:00 deraadt Exp $ */ +/* $OpenBSD: if_atw_pci.c,v 1.14 2011/04/03 15:36:02 jasper Exp $ */ /* $NetBSD: if_atw_pci.c,v 1.7 2004/07/23 07:07:55 dyoung Exp $ */ /*- @@ -106,7 +106,7 @@ int atw_pci_match(struct device *parent, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, atw_pci_devices, - sizeof(atw_pci_devices)/sizeof(atw_pci_devices[0]))); + nitems(atw_pci_devices))); } static int diff --git a/sys/dev/pci/if_bce.c b/sys/dev/pci/if_bce.c index 03249811853..295d3759d7b 100644 --- a/sys/dev/pci/if_bce.c +++ b/sys/dev/pci/if_bce.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bce.c,v 1.34 2011/04/03 14:29:08 claudio Exp $ */ +/* $OpenBSD: if_bce.c,v 1.35 2011/04/03 15:36:02 jasper Exp $ */ /* $NetBSD: if_bce.c,v 1.3 2003/09/29 01:53:02 mrg Exp $ */ /* @@ -187,7 +187,7 @@ int bce_probe(struct device *parent, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, bce_devices, - sizeof(bce_devices)/sizeof(bce_devices[0]))); + nitems(bce_devices))); } void diff --git a/sys/dev/pci/if_bnx.c b/sys/dev/pci/if_bnx.c index d4f45dc620b..03c57877f96 100644 --- a/sys/dev/pci/if_bnx.c +++ b/sys/dev/pci/if_bnx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bnx.c,v 1.90 2010/09/20 07:40:38 deraadt Exp $ */ +/* $OpenBSD: if_bnx.c,v 1.91 2011/04/03 15:36:02 jasper Exp $ */ /*- * Copyright (c) 2006 Broadcom Corporation @@ -420,7 +420,7 @@ int bnx_probe(struct device *parent, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, bnx_devices, - sizeof(bnx_devices)/sizeof(bnx_devices[0]))); + nitems(bnx_devices))); } void diff --git a/sys/dev/pci/if_cas.c b/sys/dev/pci/if_cas.c index 79d55ef8d3e..cd62796915d 100644 --- a/sys/dev/pci/if_cas.c +++ b/sys/dev/pci/if_cas.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cas.c,v 1.31 2010/09/20 07:40:38 deraadt Exp $ */ +/* $OpenBSD: if_cas.c,v 1.32 2011/04/03 15:36:02 jasper Exp $ */ /* * @@ -159,7 +159,7 @@ int cas_match(struct device *parent, void *cf, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, cas_pci_devices, - sizeof(cas_pci_devices)/sizeof(cas_pci_devices[0]))); + nitems(cas_pci_devices))); } #define PROMHDR_PTR_DATA 0x18 diff --git a/sys/dev/pci/if_che.c b/sys/dev/pci/if_che.c index 51e8bb49498..2801caebdd4 100644 --- a/sys/dev/pci/if_che.c +++ b/sys/dev/pci/if_che.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_che.c,v 1.9 2010/08/07 03:50:02 krw Exp $ */ +/* $OpenBSD: if_che.c,v 1.10 2011/04/03 15:36:02 jasper Exp $ */ /* * Copyright (c) 2007 Claudio Jeker <claudio@openbsd.org> @@ -323,7 +323,7 @@ cheg_lookup(struct pci_attach_args *pa) int i; const struct cheg_device *cd; - for (i = 0; i < sizeof(che_devices)/sizeof(che_devices[0]); i++) { + for (i = 0; i < nitems(che_devices); i++) { cd = &che_devices[i]; if (cd->cd_vendor == PCI_VENDOR(pa->pa_id) && cd->cd_product == PCI_PRODUCT(pa->pa_id)) diff --git a/sys/dev/pci/if_de.c b/sys/dev/pci/if_de.c index df29a17a5ab..961cfcacdb8 100644 --- a/sys/dev/pci/if_de.c +++ b/sys/dev/pci/if_de.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_de.c,v 1.106 2010/09/20 07:40:38 deraadt Exp $ */ +/* $OpenBSD: if_de.c,v 1.107 2011/04/03 15:36:02 jasper Exp $ */ /* $NetBSD: if_de.c,v 1.58 1998/01/12 09:39:58 thorpej Exp $ */ /*- @@ -3607,7 +3607,7 @@ tulip_print_abnormal_interrupt(tulip_softc_t * const sc, u_int32_t csr) u_int32_t mask; const char thrsh[] = "72|128\0\0\0" "96|256\0\0\0" "128|512\0\0" "160|1024\0"; - csr &= (1 << (sizeof(tulip_status_bits)/sizeof(tulip_status_bits[0]))) - 1; + csr &= (1 << (nitems(tulip_status_bits))) - 1; printf(TULIP_PRINTF_FMT ": abnormal interrupt:", TULIP_PRINTF_ARGS); for (sep = " ", mask = 1; mask <= csr; mask <<= 1, msgp++) { if ((csr & mask) && *msgp != NULL) { diff --git a/sys/dev/pci/if_devar.h b/sys/dev/pci/if_devar.h index d19362f797f..b0b2fd0f7a7 100644 --- a/sys/dev/pci/if_devar.h +++ b/sys/dev/pci/if_devar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_devar.h,v 1.31 2010/05/02 22:19:27 miod Exp $ */ +/* $OpenBSD: if_devar.h,v 1.32 2011/04/03 15:36:02 jasper Exp $ */ /* $NetBSD: if_devar.h,v 1.13 1997/06/08 18:46:36 thorpej Exp $ */ /*- @@ -728,8 +728,7 @@ static const struct { TULIP_SROM_ATTR_AUTOSENSE|TULIP_SROM_ATTR_NWAY }, { TULIP_SROM_CONNTYPE_NOT_USED, TULIP_MEDIA_UNKNOWN } }; -#define TULIP_SROM_LASTCONNIDX \ - (sizeof(tulip_srom_conninfo)/sizeof(tulip_srom_conninfo[0]) - 1) +#define TULIP_SROM_LASTCONNIDX (nitems(tulip_srom_conninfo) - 1) static const struct { tulip_media_t sm_type; diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c index 2a2cdab9946..26ef0703739 100644 --- a/sys/dev/pci/if_em.c +++ b/sys/dev/pci/if_em.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -/* $OpenBSD: if_em.c,v 1.250 2011/03/09 12:24:15 mpf Exp $ */ +/* $OpenBSD: if_em.c,v 1.251 2011/04/03 15:36:02 jasper Exp $ */ /* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */ #include <dev/pci/if_em.h> @@ -255,7 +255,7 @@ em_probe(struct device *parent, void *match, void *aux) INIT_DEBUGOUT("em_probe: begin"); return (pci_matchbyid((struct pci_attach_args *)aux, em_devices, - sizeof(em_devices)/sizeof(em_devices[0]))); + nitems(em_devices))); } void diff --git a/sys/dev/pci/if_ep_pci.c b/sys/dev/pci/if_ep_pci.c index d85a523748b..49ff8555ab3 100644 --- a/sys/dev/pci/if_ep_pci.c +++ b/sys/dev/pci/if_ep_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ep_pci.c,v 1.27 2006/06/17 18:00:43 brad Exp $ */ +/* $OpenBSD: if_ep_pci.c,v 1.28 2011/04/03 15:36:02 jasper Exp $ */ /* $NetBSD: if_ep_pci.c,v 1.13 1996/10/21 22:56:38 thorpej Exp $ */ /* @@ -102,7 +102,7 @@ ep_pci_match(parent, match, aux) void *match, *aux; { return (pci_matchbyid((struct pci_attach_args *)aux, ep_pci_devices, - sizeof(ep_pci_devices)/sizeof(ep_pci_devices[0]))); + nitems(ep_pci_devices))); } void diff --git a/sys/dev/pci/if_epic_pci.c b/sys/dev/pci/if_epic_pci.c index 7684d1f943f..4b4b54518f4 100644 --- a/sys/dev/pci/if_epic_pci.c +++ b/sys/dev/pci/if_epic_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_epic_pci.c,v 1.9 2008/06/26 05:42:17 ray Exp $ */ +/* $OpenBSD: if_epic_pci.c,v 1.10 2011/04/03 15:36:02 jasper Exp $ */ /* $NetBSD: if_epic_pci.c,v 1.28 2005/02/27 00:27:32 perry Exp $ */ /*- @@ -131,7 +131,7 @@ int epic_pci_match(struct device *parent, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, epic_pci_devices, - sizeof(epic_pci_devices)/sizeof(epic_pci_devices[0]))); + nitems(epic_pci_devices))); } void diff --git a/sys/dev/pci/if_fxp_pci.c b/sys/dev/pci/if_fxp_pci.c index 048d357087c..c4882b9d9e9 100644 --- a/sys/dev/pci/if_fxp_pci.c +++ b/sys/dev/pci/if_fxp_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_fxp_pci.c,v 1.56 2010/08/27 18:25:47 deraadt Exp $ */ +/* $OpenBSD: if_fxp_pci.c,v 1.57 2011/04/03 15:36:02 jasper Exp $ */ /* * Copyright (c) 1995, David Greenman @@ -148,7 +148,7 @@ int fxp_pci_match(struct device *parent, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, fxp_pci_devices, - sizeof(fxp_pci_devices)/sizeof(fxp_pci_devices[0]))); + nitems(fxp_pci_devices))); } void diff --git a/sys/dev/pci/if_gem_pci.c b/sys/dev/pci/if_gem_pci.c index b4d0d16c143..e164b6f3bed 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.31 2009/10/15 17:54:56 deraadt Exp $ */ +/* $OpenBSD: if_gem_pci.c,v 1.32 2011/04/03 15:36:02 jasper Exp $ */ /* $NetBSD: if_gem_pci.c,v 1.1 2001/09/16 00:11:42 eeh Exp $ */ /* @@ -113,7 +113,7 @@ int gem_match_pci(struct device *parent, void *cf, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, gem_pci_devices, - sizeof(gem_pci_devices)/sizeof(gem_pci_devices[0]))); + nitems(gem_pci_devices))); } #define PROMHDR_PTR_DATA 0x18 diff --git a/sys/dev/pci/if_ix.c b/sys/dev/pci/if_ix.c index 13ba32acfb8..14222811d40 100644 --- a/sys/dev/pci/if_ix.c +++ b/sys/dev/pci/if_ix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ix.c,v 1.46 2010/11/10 15:23:25 claudio Exp $ */ +/* $OpenBSD: if_ix.c,v 1.47 2011/04/03 15:36:02 jasper Exp $ */ /****************************************************************************** @@ -166,7 +166,7 @@ ixgbe_probe(struct device *parent, void *match, void *aux) INIT_DEBUGOUT("ixgbe_probe: begin"); return (pci_matchbyid((struct pci_attach_args *)aux, ixgbe_devices, - sizeof(ixgbe_devices)/sizeof(ixgbe_devices[0]))); + nitems(ixgbe_devices))); } /********************************************************************* diff --git a/sys/dev/pci/if_ixgb.c b/sys/dev/pci/if_ixgb.c index 04b84752aa8..96a2a0b2c8a 100644 --- a/sys/dev/pci/if_ixgb.c +++ b/sys/dev/pci/if_ixgb.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -/* $OpenBSD: if_ixgb.c,v 1.57 2010/09/20 07:50:19 deraadt Exp $ */ +/* $OpenBSD: if_ixgb.c,v 1.58 2011/04/03 15:36:02 jasper Exp $ */ #include <dev/pci/if_ixgb.h> @@ -150,7 +150,7 @@ ixgb_probe(struct device *parent, void *match, void *aux) INIT_DEBUGOUT("ixgb_probe: begin"); return (pci_matchbyid((struct pci_attach_args *)aux, ixgb_devices, - sizeof(ixgb_devices)/sizeof(ixgb_devices[0]))); + nitems(ixgb_devices))); } /********************************************************************* diff --git a/sys/dev/pci/if_lge.c b/sys/dev/pci/if_lge.c index c8a55c9b28e..dc2f3e80dd3 100644 --- a/sys/dev/pci/if_lge.c +++ b/sys/dev/pci/if_lge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_lge.c,v 1.53 2010/05/19 15:27:35 oga Exp $ */ +/* $OpenBSD: if_lge.c,v 1.54 2011/04/03 15:36:02 jasper Exp $ */ /* * Copyright (c) 2001 Wind River Systems * Copyright (c) 1997, 1998, 1999, 2000, 2001 @@ -384,7 +384,7 @@ int lge_probe(struct device *parent, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, lge_devices, - sizeof(lge_devices)/sizeof(lge_devices[0]))); + nitems(lge_devices))); } /* diff --git a/sys/dev/pci/if_lmc_obsd.c b/sys/dev/pci/if_lmc_obsd.c index 157de5657b2..7687fc76d3c 100644 --- a/sys/dev/pci/if_lmc_obsd.c +++ b/sys/dev/pci/if_lmc_obsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_lmc_obsd.c,v 1.22 2010/09/20 07:40:38 deraadt Exp $ */ +/* $OpenBSD: if_lmc_obsd.c,v 1.23 2011/04/03 15:36:02 jasper Exp $ */ /* $NetBSD: if_lmc_nbsd.c,v 1.1 1999/03/25 03:32:43 explorer Exp $ */ /*- @@ -321,8 +321,7 @@ lmc_busdma_allocmem( bus_dma_segment_t segs[1]; int nsegs, error; error = bus_dmamem_alloc(sc->lmc_dmatag, size, 1, NBPG, - segs, sizeof(segs)/sizeof(segs[0]), - &nsegs, BUS_DMA_NOWAIT); + segs, nitems(segs), &nsegs, BUS_DMA_NOWAIT); if (error == 0) { void *desc; error = bus_dmamem_map(sc->lmc_dmatag, segs, nsegs, size, diff --git a/sys/dev/pci/if_msk.c b/sys/dev/pci/if_msk.c index 90d691a5b08..d938ad27321 100644 --- a/sys/dev/pci/if_msk.c +++ b/sys/dev/pci/if_msk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_msk.c,v 1.91 2010/11/17 10:43:23 kevlo Exp $ */ +/* $OpenBSD: if_msk.c,v 1.92 2011/04/03 15:36:02 jasper Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -666,7 +666,7 @@ int mskc_probe(struct device *parent, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, mskc_devices, - sizeof(mskc_devices)/sizeof(mskc_devices[0]))); + nitems(mskc_devices))); } /* diff --git a/sys/dev/pci/if_ne_pci.c b/sys/dev/pci/if_ne_pci.c index a5908f96fa3..1d55a93e83f 100644 --- a/sys/dev/pci/if_ne_pci.c +++ b/sys/dev/pci/if_ne_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ne_pci.c,v 1.17 2008/06/26 05:42:17 ray Exp $ */ +/* $OpenBSD: if_ne_pci.c,v 1.18 2011/04/03 15:36:02 jasper Exp $ */ /* $NetBSD: if_ne_pci.c,v 1.8 1998/07/05 00:51:24 jonathan Exp $ */ /*- @@ -139,7 +139,7 @@ ne_pci_lookup(struct pci_attach_args *pa) const struct ne_pci_product *npp; for (npp = ne_pci_prod; - npp < &ne_pci_prod[sizeof(ne_pci_prod)/sizeof(ne_pci_prod[0])]; + npp < &ne_pci_prod[nitems(ne_pci_prod)]; npp++) { if (PCI_VENDOR(pa->pa_id) == npp->npp_vendor && PCI_PRODUCT(pa->pa_id) == npp->npp_product) diff --git a/sys/dev/pci/if_pcn.c b/sys/dev/pci/if_pcn.c index 3ba43d46949..222fa28bbe0 100644 --- a/sys/dev/pci/if_pcn.c +++ b/sys/dev/pci/if_pcn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pcn.c,v 1.23 2010/09/20 07:40:38 deraadt Exp $ */ +/* $OpenBSD: if_pcn.c,v 1.24 2011/04/03 15:36:02 jasper Exp $ */ /* $NetBSD: if_pcn.c,v 1.26 2005/05/07 09:15:44 is Exp $ */ /* @@ -559,7 +559,7 @@ pcn_match(struct device *parent, void *match, void *aux) return(1); return (pci_matchbyid((struct pci_attach_args *)aux, pcn_devices, - sizeof(pcn_devices)/sizeof(pcn_devices[0]))); + nitems(pcn_devices))); } void diff --git a/sys/dev/pci/if_re_pci.c b/sys/dev/pci/if_re_pci.c index 230c462d517..817da7803d7 100644 --- a/sys/dev/pci/if_re_pci.c +++ b/sys/dev/pci/if_re_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_re_pci.c,v 1.31 2011/03/13 15:35:20 stsp Exp $ */ +/* $OpenBSD: if_re_pci.c,v 1.32 2011/04/03 15:36:02 jasper Exp $ */ /* * Copyright (c) 2005 Peter Valchev <pvalchev@openbsd.org> @@ -119,7 +119,7 @@ re_pci_probe(struct device *parent, void *match, void *aux) return (1); return (pci_matchbyid((struct pci_attach_args *)aux, re_pci_devices, - sizeof(re_pci_devices)/sizeof(re_pci_devices[0]))); + nitems(re_pci_devices))); } /* diff --git a/sys/dev/pci/if_rl_pci.c b/sys/dev/pci/if_rl_pci.c index de0366b34ac..a5145f883d9 100644 --- a/sys/dev/pci/if_rl_pci.c +++ b/sys/dev/pci/if_rl_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rl_pci.c,v 1.20 2010/08/27 20:21:43 deraadt Exp $ */ +/* $OpenBSD: if_rl_pci.c,v 1.21 2011/04/03 15:36:02 jasper Exp $ */ /* * Copyright (c) 1997, 1998 @@ -125,7 +125,7 @@ rl_pci_match(struct device *parent, void *match, void *aux) return (1); return (pci_matchbyid((struct pci_attach_args *)aux, rl_pci_devices, - sizeof(rl_pci_devices)/sizeof(rl_pci_devices[0]))); + nitems(rl_pci_devices))); } void diff --git a/sys/dev/pci/if_rtw_pci.c b/sys/dev/pci/if_rtw_pci.c index 2b316d6c829..fe6a7bb17ed 100644 --- a/sys/dev/pci/if_rtw_pci.c +++ b/sys/dev/pci/if_rtw_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rtw_pci.c,v 1.14 2010/08/29 16:47:00 deraadt Exp $ */ +/* $OpenBSD: if_rtw_pci.c,v 1.15 2011/04/03 15:36:02 jasper Exp $ */ /* $NetBSD: if_rtw_pci.c,v 1.1 2004/09/26 02:33:36 dyoung Exp $ */ /*- @@ -118,7 +118,7 @@ int rtw_pci_match(struct device *parent, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, rtw_pci_products, - sizeof(rtw_pci_products)/sizeof(rtw_pci_products[0]))); + nitems(rtw_pci_products))); } int diff --git a/sys/dev/pci/if_sf_pci.c b/sys/dev/pci/if_sf_pci.c index fe00364b1bd..a6df377b8ca 100644 --- a/sys/dev/pci/if_sf_pci.c +++ b/sys/dev/pci/if_sf_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sf_pci.c,v 1.7 2008/06/26 05:42:17 ray Exp $ */ +/* $OpenBSD: if_sf_pci.c,v 1.8 2011/04/03 15:36:02 jasper Exp $ */ /* $NetBSD: if_sf_pci.c,v 1.10 2006/06/17 23:34:27 christos Exp $ */ /*- @@ -92,7 +92,7 @@ int sf_pci_match(struct device *parent, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, sf_pci_products, - sizeof(sf_pci_products)/sizeof(sf_pci_products[0]))); + nitems(sf_pci_products))); } void diff --git a/sys/dev/pci/if_sis.c b/sys/dev/pci/if_sis.c index ecf1e986417..44def3b6165 100644 --- a/sys/dev/pci/if_sis.c +++ b/sys/dev/pci/if_sis.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sis.c,v 1.102 2011/02/15 19:10:19 kettenis Exp $ */ +/* $OpenBSD: if_sis.c,v 1.103 2011/04/03 15:36:02 jasper Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. @@ -861,7 +861,7 @@ int sis_probe(struct device *parent, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, sis_devices, - sizeof(sis_devices)/sizeof(sis_devices[0]))); + nitems(sis_devices))); } /* diff --git a/sys/dev/pci/if_sk.c b/sys/dev/pci/if_sk.c index 6ed6e3dd1ec..8a4878f527a 100644 --- a/sys/dev/pci/if_sk.c +++ b/sys/dev/pci/if_sk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sk.c,v 1.158 2010/09/20 07:40:38 deraadt Exp $ */ +/* $OpenBSD: if_sk.c,v 1.159 2011/04/03 15:36:02 jasper Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -935,7 +935,7 @@ skc_probe(struct device *parent, void *match, void *aux) return (1); return (pci_matchbyid((struct pci_attach_args *)aux, skc_devices, - sizeof(skc_devices)/sizeof(skc_devices[0]))); + nitems(skc_devices))); } /* diff --git a/sys/dev/pci/if_ste.c b/sys/dev/pci/if_ste.c index bd4165eb212..d54c651486c 100644 --- a/sys/dev/pci/if_ste.c +++ b/sys/dev/pci/if_ste.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ste.c,v 1.45 2009/08/13 14:24:47 jasper Exp $ */ +/* $OpenBSD: if_ste.c,v 1.46 2011/04/03 15:36:03 jasper Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. @@ -834,7 +834,7 @@ int ste_probe(struct device *parent, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, ste_devices, - sizeof(ste_devices)/sizeof(ste_devices[0]))); + nitems(ste_devices))); } /* diff --git a/sys/dev/pci/if_txp.c b/sys/dev/pci/if_txp.c index a5eb2afbd7c..84277de5eb4 100644 --- a/sys/dev/pci/if_txp.c +++ b/sys/dev/pci/if_txp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_txp.c,v 1.102 2010/09/20 07:40:38 deraadt Exp $ */ +/* $OpenBSD: if_txp.c,v 1.103 2011/04/03 15:36:03 jasper Exp $ */ /* * Copyright (c) 2001 @@ -151,7 +151,7 @@ int txp_probe(struct device *parent, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, txp_devices, - sizeof(txp_devices)/sizeof(txp_devices[0]))); + nitems(txp_devices))); } void diff --git a/sys/dev/pci/if_vge.c b/sys/dev/pci/if_vge.c index 21af7e90866..953a811de9f 100644 --- a/sys/dev/pci/if_vge.c +++ b/sys/dev/pci/if_vge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vge.c,v 1.48 2010/08/27 17:08:00 jsg Exp $ */ +/* $OpenBSD: if_vge.c,v 1.49 2011/04/03 15:36:03 jasper Exp $ */ /* $FreeBSD: if_vge.c,v 1.3 2004/09/11 22:13:25 wpaul Exp $ */ /* * Copyright (c) 2004 @@ -572,7 +572,7 @@ int vge_probe(struct device *dev, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, vge_devices, - sizeof(vge_devices)/sizeof(vge_devices[0]))); + nitems(vge_devices))); } /* diff --git a/sys/dev/pci/if_wb.c b/sys/dev/pci/if_wb.c index 38e61009294..a8607b90111 100644 --- a/sys/dev/pci/if_wb.c +++ b/sys/dev/pci/if_wb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wb.c,v 1.46 2010/05/19 15:27:35 oga Exp $ */ +/* $OpenBSD: if_wb.c,v 1.47 2011/04/03 15:36:03 jasper Exp $ */ /* * Copyright (c) 1997, 1998 @@ -694,7 +694,7 @@ wb_probe(parent, match, aux) void *match, *aux; { return (pci_matchbyid((struct pci_attach_args *)aux, wb_devices, - sizeof(wb_devices)/sizeof(wb_devices[0]))); + nitems(wb_devices))); } /* diff --git a/sys/dev/pci/if_xge.c b/sys/dev/pci/if_xge.c index 38251245f0d..369528cf2eb 100644 --- a/sys/dev/pci/if_xge.c +++ b/sys/dev/pci/if_xge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_xge.c,v 1.52 2010/04/08 00:23:53 tedu Exp $ */ +/* $OpenBSD: if_xge.c,v 1.53 2011/04/03 15:36:03 jasper Exp $ */ /* $NetBSD: if_xge.c,v 1.1 2005/09/09 10:30:27 ragge Exp $ */ /* @@ -329,7 +329,7 @@ int xge_match(struct device *parent, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, xge_devices, - sizeof(xge_devices)/sizeof(xge_devices[0]))); + nitems(xge_devices))); } void @@ -399,7 +399,7 @@ xge_attach(struct device *parent, struct device *self, void *aux) * Resolve it by writing some magics to GPIO_CONTROL and * force a chip reset to read in the serial eeprom again. */ - for (i = 0; i < sizeof(fix_mac)/sizeof(fix_mac[0]); i++) { + for (i = 0; i < nitems(fix_mac); i++) { PIF_WCSR(GPIO_CONTROL, fix_mac[i]); PIF_RCSR(GPIO_CONTROL); } diff --git a/sys/dev/pci/if_xl_pci.c b/sys/dev/pci/if_xl_pci.c index 8819699031f..2916e413db7 100644 --- a/sys/dev/pci/if_xl_pci.c +++ b/sys/dev/pci/if_xl_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_xl_pci.c,v 1.34 2010/09/19 09:22:58 deraadt Exp $ */ +/* $OpenBSD: if_xl_pci.c,v 1.35 2011/04/03 15:36:03 jasper Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -140,7 +140,7 @@ int xl_pci_match(struct device *parent, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, xl_pci_devices, - sizeof(xl_pci_devices)/sizeof(xl_pci_devices[0]))); + nitems(xl_pci_devices))); } void diff --git a/sys/dev/pci/isp_pci.c b/sys/dev/pci/isp_pci.c index 208c6800820..608ef8f88b6 100644 --- a/sys/dev/pci/isp_pci.c +++ b/sys/dev/pci/isp_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isp_pci.c,v 1.53 2009/11/07 14:49:02 miod Exp $ */ +/* $OpenBSD: isp_pci.c,v 1.54 2011/04/03 15:36:03 jasper Exp $ */ /* $FreeBSD: src/sys/dev/isp/isp_pci.c,v 1.148 2007/06/26 23:08:57 mjacob Exp $*/ /*- * Copyright (c) 1997-2006 by Matthew Jacob @@ -438,7 +438,7 @@ isp_pci_probe(struct device *parent, void *match, void *aux) } } #endif - return (pci_matchbyid(pa, ispdev, sizeof(ispdev)/sizeof(ispdev[0]))); + return (pci_matchbyid(pa, ispdev, nitems(ispdev))); } diff --git a/sys/dev/pci/musycc_obsd.c b/sys/dev/pci/musycc_obsd.c index b7df54ad8d1..25a58d88602 100644 --- a/sys/dev/pci/musycc_obsd.c +++ b/sys/dev/pci/musycc_obsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: musycc_obsd.c,v 1.9 2006/01/25 11:02:54 claudio Exp $ */ +/* $OpenBSD: musycc_obsd.c,v 1.10 2011/04/03 15:36:03 jasper Exp $ */ /* * Copyright (c) 2004,2005 Internet Business Solutions AG, Zurich, Switzerland @@ -67,7 +67,7 @@ int musycc_match(struct device *parent, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, musycc_pci_devices, - sizeof(musycc_pci_devices)/sizeof(musycc_pci_devices[0]))); + nitems(musycc_pci_devices))); } void diff --git a/sys/dev/pci/pciide.c b/sys/dev/pci/pciide.c index 27034649db5..df984f4b6df 100644 --- a/sys/dev/pci/pciide.c +++ b/sys/dev/pci/pciide.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pciide.c,v 1.323 2010/11/18 18:12:52 kettenis Exp $ */ +/* $OpenBSD: pciide.c,v 1.324 2011/04/03 15:36:03 jasper Exp $ */ /* $NetBSD: pciide.c,v 1.127 2001/08/03 01:31:08 tsutsui Exp $ */ /* @@ -1231,43 +1231,43 @@ struct pciide_vendor_desc { const struct pciide_vendor_desc pciide_vendors[] = { { PCI_VENDOR_INTEL, pciide_intel_products, - sizeof(pciide_intel_products)/sizeof(pciide_intel_products[0]) }, + nitems(pciide_intel_products) }, { PCI_VENDOR_AMD, pciide_amd_products, - sizeof(pciide_amd_products)/sizeof(pciide_amd_products[0]) }, + nitems(pciide_amd_products) }, #ifdef notyet { PCI_VENDOR_OPTI, pciide_opti_products, - sizeof(pciide_opti_products)/sizeof(pciide_opti_products[0]) }, + nitems(pciide_opti_products) }, #endif { PCI_VENDOR_CMDTECH, pciide_cmd_products, - sizeof(pciide_cmd_products)/sizeof(pciide_cmd_products[0]) }, + nitems(pciide_cmd_products) }, { PCI_VENDOR_VIATECH, pciide_via_products, - sizeof(pciide_via_products)/sizeof(pciide_via_products[0]) }, + nitems(pciide_via_products) }, { PCI_VENDOR_CONTAQ, pciide_cypress_products, - sizeof(pciide_cypress_products)/sizeof(pciide_cypress_products[0]) }, + nitems(pciide_cypress_products) }, { PCI_VENDOR_SIS, pciide_sis_products, - sizeof(pciide_sis_products)/sizeof(pciide_sis_products[0]) }, + nitems(pciide_sis_products) }, { PCI_VENDOR_NS, pciide_natsemi_products, - sizeof(pciide_natsemi_products)/sizeof(pciide_natsemi_products[0]) }, + nitems(pciide_natsemi_products) }, { PCI_VENDOR_ALI, pciide_acer_products, - sizeof(pciide_acer_products)/sizeof(pciide_acer_products[0]) }, + nitems(pciide_acer_products) }, { PCI_VENDOR_TRIONES, pciide_triones_products, - sizeof(pciide_triones_products)/sizeof(pciide_triones_products[0]) }, + nitems(pciide_triones_products) }, { PCI_VENDOR_ACARD, pciide_acard_products, - sizeof(pciide_acard_products)/sizeof(pciide_acard_products[0]) }, + nitems(pciide_acard_products) }, { PCI_VENDOR_RCC, pciide_serverworks_products, - sizeof(pciide_serverworks_products)/sizeof(pciide_serverworks_products[0]) }, + nitems(pciide_serverworks_products) }, { PCI_VENDOR_PROMISE, pciide_promise_products, - sizeof(pciide_promise_products)/sizeof(pciide_promise_products[0]) }, + nitems(pciide_promise_products) }, { PCI_VENDOR_NVIDIA, pciide_nvidia_products, - sizeof(pciide_nvidia_products)/sizeof(pciide_nvidia_products[0]) }, + nitems(pciide_nvidia_products) }, { PCI_VENDOR_ITEXPRESS, pciide_ite_products, - sizeof(pciide_ite_products)/sizeof(pciide_ite_products[0]) }, + nitems(pciide_ite_products) }, { PCI_VENDOR_ATI, pciide_ati_products, - sizeof(pciide_ati_products)/sizeof(pciide_ati_products[0]) }, + nitems(pciide_ati_products) }, { PCI_VENDOR_JMICRON, pciide_jmicron_products, - sizeof(pciide_jmicron_products)/sizeof(pciide_jmicron_products[0]) }, + nitems(pciide_jmicron_products) }, { PCI_VENDOR_PHISON, pciide_phison_products, - sizeof(pciide_phison_products)/sizeof(pciide_phison_products[0]) } + nitems(pciide_phison_products) } }; /* options passed via the 'flags' config keyword */ @@ -1301,13 +1301,11 @@ pciide_lookup_product(u_int32_t id) const struct pciide_vendor_desc *vp; int i; - for (i = 0, vp = pciide_vendors; - i < sizeof(pciide_vendors)/sizeof(pciide_vendors[0]); - vp++, i++) + for (i = 0, vp = pciide_vendors; i < nitems(pciide_vendors); vp++, i++) if (PCI_VENDOR(id) == vp->ide_vendor) break; - if (i == sizeof(pciide_vendors)/sizeof(pciide_vendors[0])) + if (i == nitems(pciide_vendors)) return (NULL); for (pp = vp->ide_products, i = 0; i < vp->ide_nproducts; pp++, i++) diff --git a/sys/dev/pci/safe.c b/sys/dev/pci/safe.c index a578dda28bf..511d1a72a0d 100644 --- a/sys/dev/pci/safe.c +++ b/sys/dev/pci/safe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: safe.c,v 1.31 2011/01/12 17:16:39 deraadt Exp $ */ +/* $OpenBSD: safe.c,v 1.32 2011/04/03 15:36:03 jasper Exp $ */ /*- * Copyright (c) 2003 Sam Leffler, Errno Consulting @@ -512,7 +512,7 @@ safe_process(struct cryptop *crp) cmd0 |= SAFE_SA_CMD0_PAD_ZERO; /* XXX assert key bufs have the same size */ - for (i = 0; i < sizeof(sa->sa_key)/sizeof(sa->sa_key[0]); i++) + for (i = 0; i < nitems(sa->sa_key); i++) sa->sa_key[i] = ses->ses_key[i]; } @@ -533,7 +533,7 @@ safe_process(struct cryptop *crp) */ /* XXX assert digest bufs have the same size */ for (i = 0; - i < sizeof(sa->sa_outdigest)/sizeof(sa->sa_outdigest[i]); + i < nitems(sa->sa_outdigest); i++) { sa->sa_indigest[i] = ses->ses_hminner[i]; sa->sa_outdigest[i] = ses->ses_hmouter[i]; @@ -1365,8 +1365,7 @@ safe_newsession(u_int32_t *sidp, struct cryptoini *cri) ses->ses_klen = encini->cri_klen; bcopy(encini->cri_key, ses->ses_key, ses->ses_klen / 8); - for (i = 0; - i < sizeof(ses->ses_key)/sizeof(ses->ses_key[0]); i++) + for (i = 0; i < nitems(ses->ses_key); i++) ses->ses_key[i] = htole32(ses->ses_key[i]); } diff --git a/sys/dev/pci/twe_pci.c b/sys/dev/pci/twe_pci.c index 4f3dc310c5a..02e86eff61a 100644 --- a/sys/dev/pci/twe_pci.c +++ b/sys/dev/pci/twe_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: twe_pci.c,v 1.12 2006/08/25 04:35:03 brad Exp $ */ +/* $OpenBSD: twe_pci.c,v 1.13 2011/04/03 15:36:03 jasper Exp $ */ /* * Copyright (c) 2000 Michael Shalayeff @@ -65,7 +65,7 @@ twe_pci_match(parent, match, aux) void *aux; { return (pci_matchbyid((struct pci_attach_args *)aux, twe_pci_devices, - sizeof(twe_pci_devices)/sizeof(twe_pci_devices[0]))); + nitems(twe_pci_devices))); } void diff --git a/sys/dev/pci/ubsec.c b/sys/dev/pci/ubsec.c index 89151d9cfba..a1958fa2b77 100644 --- a/sys/dev/pci/ubsec.c +++ b/sys/dev/pci/ubsec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ubsec.c,v 1.150 2011/01/12 20:55:22 deraadt Exp $ */ +/* $OpenBSD: ubsec.c,v 1.151 2011/04/03 15:36:03 jasper Exp $ */ /* * Copyright (c) 2000 Jason L. Wright (jason@thought.net) @@ -146,7 +146,7 @@ int ubsec_probe(struct device *parent, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, ubsec_devices, - sizeof(ubsec_devices)/sizeof(ubsec_devices[0]))); + nitems(ubsec_devices))); } void diff --git a/sys/dev/pci/wdt.c b/sys/dev/pci/wdt.c index e6b557c5fc5..b19cdab91e0 100644 --- a/sys/dev/pci/wdt.c +++ b/sys/dev/pci/wdt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wdt.c,v 1.19 2010/04/08 00:23:54 tedu Exp $ */ +/* $OpenBSD: wdt.c,v 1.20 2011/04/03 15:36:03 jasper Exp $ */ /*- * Copyright (c) 1998,1999 Alex Nash @@ -102,7 +102,7 @@ int wdt_probe(struct device *parent, void *match, void *aux) { return (pci_matchbyid((struct pci_attach_args *)aux, wdt_devices, - sizeof(wdt_devices)/sizeof(wdt_devices[0]))); + nitems(wdt_devices))); } void diff --git a/sys/dev/pci/yds.c b/sys/dev/pci/yds.c index 31f0e6d2e0f..fdac640aefb 100644 --- a/sys/dev/pci/yds.c +++ b/sys/dev/pci/yds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: yds.c,v 1.38 2010/09/17 07:55:52 jakemsr Exp $ */ +/* $OpenBSD: yds.c,v 1.39 2011/04/03 15:36:03 jasper Exp $ */ /* $NetBSD: yds.c,v 1.5 2001/05/21 23:55:04 minoura Exp $ */ /* @@ -1053,7 +1053,7 @@ yds_allocmem(sc, size, align, p) p->size = size; error = bus_dmamem_alloc(sc->sc_dmatag, p->size, align, 0, - p->segs, sizeof(p->segs)/sizeof(p->segs[0]), + p->segs, nitems(p->segs), &p->nsegs, BUS_DMA_NOWAIT); if (error) return (error); |