This diff uses nitems in various places in sys/dev/pci. 
If this is wanted I'll do more sometime. No md5 changes.

Ok?

Index: adv_pci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/adv_pci.c,v
retrieving revision 1.10
diff -u -p -r1.10 adv_pci.c
--- adv_pci.c   26 Jun 2008 05:42:17 -0000      1.10
+++ adv_pci.c   17 Jan 2010 12:39:09 -0000
@@ -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)));
 }
 
 
Index: adw_pci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/adw_pci.c,v
retrieving revision 1.15
diff -u -p -r1.15 adw_pci.c
--- adw_pci.c   26 Jun 2008 05:42:17 -0000      1.15
+++ adw_pci.c   17 Jan 2010 12:39:09 -0000
@@ -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)));
 }
 
 
Index: ahci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/ahci.c,v
retrieving revision 1.157
diff -u -p -r1.157 ahci.c
--- ahci.c      10 Jan 2010 13:19:02 -0000      1.157
+++ ahci.c      17 Jan 2010 12:39:09 -0000
@@ -566,7 +566,7 @@ ahci_lookup_device(struct pci_attach_arg
        int                             i;
        const struct ahci_device        *ad;
 
-       for (i = 0; i < (sizeof(ahci_devices) / sizeof(ahci_devices[0])); i++) {
+       for (i = 0; i < (nitems(ahci_devices)); i++) {
                ad = &ahci_devices[i];
                if (ad->ad_vendor == PCI_VENDOR(pa->pa_id) &&
                    ad->ad_product == PCI_PRODUCT(pa->pa_id))
Index: amdiic.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/amdiic.c,v
retrieving revision 1.7
diff -u -p -r1.7 amdiic.c
--- amdiic.c    29 Mar 2009 21:53:52 -0000      1.7
+++ amdiic.c    17 Jan 2010 12:39:09 -0000
@@ -128,8 +128,7 @@ const struct pci_matchid amdiic_ids[] = 
 int
 amdiic_match(struct device *parent, void *match, void *aux)
 {
-       return (pci_matchbyid(aux, amdiic_ids,
-           sizeof(amdiic_ids) / sizeof(amdiic_ids[0])));
+       return (pci_matchbyid(aux, amdiic_ids, nitems(amdiic_ids)));
 }
 
 void
Index: amdpcib.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/amdpcib.c,v
retrieving revision 1.1
diff -u -p -r1.1 amdpcib.c
--- amdpcib.c   7 Oct 2007 18:41:06 -0000       1.1
+++ amdpcib.c   17 Jan 2010 12:39:09 -0000
@@ -101,7 +101,7 @@ int
 amdpcib_match(struct device *parent, void *match, void *aux)
 { 
        if (pci_matchbyid((struct pci_attach_args *)aux, amdpcib_devices,
-           sizeof(amdpcib_devices) / sizeof(amdpcib_devices[0])))
+           nitems(amdpcib_devices)))
                return 2;
 
        return 0;
Index: amdpm.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/amdpm.c,v
retrieving revision 1.23
diff -u -p -r1.23 amdpm.c
--- amdpm.c     26 Jun 2008 05:42:17 -0000      1.23
+++ amdpm.c     17 Jan 2010 12:39:09 -0000
@@ -207,8 +207,7 @@ int
 amdpm_match(struct device *parent, void *match, void *aux)
 {
-       return (pci_matchbyid(aux, amdpm_ids,
-           sizeof(amdpm_ids) / sizeof(amdpm_ids[0])));
+       return (pci_matchbyid(aux, amdpm_ids, nitems(amdpm_ids)));
 }
 
 void
Index: arc.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/arc.c,v
retrieving revision 1.80
diff -u -p -r1.80 arc.c
--- arc.c       9 Jan 2010 23:15:06 -0000       1.80
+++ arc.c       17 Jan 2010 12:39:09 -0000
@@ -547,7 +547,7 @@ arc_match_board(struct pci_attach_args *
        const struct arc_board          *ab;
        int                             i;
 
-       for (i = 0; i < sizeof(arc_devices) / sizeof(arc_devices[0]); i++) {
+       for (i = 0; i < nitems(arc_devices); i++) {
                ab = &arc_devices[i];
 
                if (PCI_VENDOR(pa->pa_id) == ab->ab_vendor &&
Index: auacer.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/auacer.c,v
retrieving revision 1.4
diff -u -p -r1.4 auacer.c
--- auacer.c    25 Oct 2008 22:30:43 -0000      1.4
+++ auacer.c    17 Jan 2010 12:39:09 -0000
@@ -231,7 +231,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
@@ -545,7 +545,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]);
@@ -985,7 +985,7 @@ auacer_allocmem(struct auacer_softc *sc,
 
        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);
 
Index: auich.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/auich.c,v
retrieving revision 1.80
diff -u -p -r1.80 auich.c
--- auich.c     14 Jan 2010 18:15:27 -0000      1.80
+++ auich.c     17 Jan 2010 12:39:09 -0000
@@ -362,7 +362,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;
@@ -451,7 +451,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;
 
Index: auixp.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/auixp.c,v
retrieving revision 1.24
diff -u -p -r1.24 auixp.c
--- auixp.c     12 Oct 2009 19:43:52 -0000      1.24
+++ auixp.c     17 Jan 2010 12:39:10 -0000
@@ -1142,8 +1142,7 @@ auixp_allocmem(struct auixp_softc *sc, s
 
        /* allocate DMA safe memory but in just one segment for now :( */
        error = bus_dmamem_alloc(sc->sc_dmat, dma->size, align, 0,
-           dma->segs, sizeof(dma->segs) / sizeof(dma->segs[0]), &dma->nsegs,
-           BUS_DMA_NOWAIT);
+           dma->segs, nitems(dma->segs), &dma->nsegs, BUS_DMA_NOWAIT);
        if (error)
                return error;
 
@@ -1231,7 +1230,7 @@ int
 auixp_match(struct device *dev, void *match, void *aux)
 {
        return (pci_matchbyid((struct pci_attach_args *)aux, auixp_pci_devices,
-           sizeof(auixp_pci_devices)/sizeof(auixp_pci_devices[0])));
+           nitems(auixp_pci_devices)));
 }
 
 void
Index: autri.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/autri.c,v
retrieving revision 1.23
diff -u -p -r1.23 autri.c
--- autri.c     29 Mar 2009 21:53:52 -0000      1.23
+++ autri.c     17 Jan 2010 12:39:10 -0000
@@ -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
@@ -874,8 +874,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);
 
Index: auvia.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/auvia.c,v
retrieving revision 1.44
diff -u -p -r1.44 auvia.c
--- auvia.c     25 Oct 2008 22:30:43 -0000      1.44
+++ auvia.c     17 Jan 2010 12:39:10 -0000
@@ -228,7 +228,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)));
 }
 
 
Index: berkwdt.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/berkwdt.c,v
retrieving revision 1.5
diff -u -p -r1.5 berkwdt.c
--- berkwdt.c   25 Apr 2009 07:11:55 -0000      1.5
+++ berkwdt.c   17 Jan 2010 12:39:10 -0000
@@ -172,7 +172,7 @@ int
 berkwdt_match(struct device *parent, void *match, void *aux)
 {
        return (pci_matchbyid((struct pci_attach_args *)aux, berkwdt_devices,
-           sizeof(berkwdt_devices) / sizeof(berkwdt_devices[0])));
+           nitems(berkwdt_devices)));
 }
 
 void
Index: bha_pci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/bha_pci.c,v
retrieving revision 1.10
diff -u -p -r1.10 bha_pci.c
--- bha_pci.c   29 Mar 2009 21:53:52 -0000      1.10
+++ bha_pci.c   17 Jan 2010 12:39:10 -0000
@@ -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,
Index: cac_pci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/cac_pci.c,v
retrieving revision 1.13
diff -u -p -r1.13 cac_pci.c
--- cac_pci.c   6 Apr 2009 15:18:45 -0000       1.13
+++ cac_pci.c   17 Jan 2010 12:39:10 -0000
@@ -117,26 +117,26 @@ cac_pci_findtype(pa)
 
        cp = cac_pci_product;
        i = 0;
-       while (i < sizeof(cac_pci_product) / sizeof(cac_pci_product[0])) {
+       while (i < nitems(cac_pci_product)) {
                if (PCI_VENDOR(pa->pa_id) == cp->cp_vendor &&
                    PCI_PRODUCT(pa->pa_id) == cp->cp_product)
                        break;
                cp++;
                i++;
        }
-       if (i == sizeof(cac_pci_product) / sizeof(cac_pci_product[0]))
+       if (i == nitems(cac_pci_product))
                return (NULL);
 
        subsysid = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_SUBSYS_ID_REG);
        ct = cac_pci_type;
        i = 0;
-       while (i < sizeof(cac_pci_type) / sizeof(cac_pci_type[0])) {
+       while (i < nitems(cac_pci_type)) {
                if (subsysid == ct->ct_subsysid)
                        break;
                ct++;
                i++;
        }
-       if (i == sizeof(cac_pci_type) / sizeof(cac_pci_type[0]))
+       if (i == nitems(cac_pci_type))
                return (NULL);
 
        return (ct);
Index: cmpci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/cmpci.c,v
retrieving revision 1.24
diff -u -p -r1.24 cmpci.c
--- cmpci.c     6 May 2009 23:13:29 -0000       1.24
+++ cmpci.c     17 Jan 2010 12:39:10 -0000
@@ -347,7 +347,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
@@ -1261,7 +1261,7 @@ cmpci_alloc_dmamem(struct cmpci_softc *s
        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,
@@ -1288,7 +1288,7 @@ cmpci_alloc_dmamem(struct cmpci_softc *s
        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:
@@ -1307,7 +1307,7 @@ cmpci_free_dmamem(struct cmpci_softc *sc
                        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;
                }
@@ -1902,8 +1902,7 @@ cmpci_mappage(void *handle, void *addr, 
                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 */
Index: cs4280.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/cs4280.c,v
retrieving revision 1.33
diff -u -p -r1.33 cs4280.c
--- cs4280.c    20 Jan 2009 20:00:06 -0000      1.33
+++ cs4280.c    17 Jan 2010 12:39:10 -0000
@@ -306,7 +306,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
@@ -1377,8 +1377,8 @@ cs4280_allocmem(sc, size, align, p)
        /* XXX */
        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) {
                printf("%s: unable to allocate dma, error=%d\n",
                       sc->sc_dev.dv_xname, error);
Index: cy_pci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/cy_pci.c,v
retrieving revision 1.13
diff -u -p -r1.13 cy_pci.c
--- cy_pci.c    13 Jun 2004 17:30:27 -0000      1.13
+++ cy_pci.c    17 Jan 2010 12:39:10 -0000
@@ -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
Index: eap.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/eap.c,v
retrieving revision 1.37
diff -u -p -r1.37 eap.c
--- eap.c       15 Feb 2009 00:11:59 -0000      1.37
+++ eap.c       17 Jan 2010 12:39:10 -0000
@@ -289,7 +289,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)));
 }
 
 void
Index: emuxki.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/emuxki.c,v
retrieving revision 1.33
diff -u -p -r1.33 emuxki.c
--- emuxki.c    29 Mar 2009 21:53:52 -0000      1.33
+++ emuxki.c    17 Jan 2010 12:39:11 -0000
@@ -424,7 +424,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
Index: esa.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/esa.c,v
retrieving revision 1.18
diff -u -p -r1.18 esa.c
--- esa.c       13 Nov 2009 02:22:19 -0000      1.18
+++ esa.c       17 Jan 2010 12:39:11 -0000
@@ -955,8 +955,8 @@ esa_allocmem(struct esa_softc *sc, size_
 
        p->size = size;
        error = bus_dmamem_alloc(sc->sc_dmat, 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);
 
@@ -1012,7 +1012,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
Index: eso.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/eso.c,v
retrieving revision 1.28
diff -u -p -r1.28 eso.c
--- eso.c       29 Mar 2009 21:53:52 -0000      1.28
+++ eso.c       17 Jan 2010 12:39:11 -0000
@@ -219,8 +219,7 @@ eso_attach(struct device *parent, struct
 
        sc->sc_revision = PCI_REVISION(pa->pa_class);
 
-       if (sc->sc_revision <
-           sizeof (eso_rev2model) / sizeof (eso_rev2model[0]))
+       if (sc->sc_revision < nitems (eso_rev2model))
                printf(": %s", eso_rev2model[sc->sc_revision]);
        else
                printf(": (unknown rev. 0x%02x)", sc->sc_revision);
@@ -866,8 +865,7 @@ eso_getdev(void *hdl, struct audio_devic
        strlcpy(retp->name, "ESS Solo-1", sizeof retp->name);
        snprintf(retp->version, sizeof retp->version, "0x%02x",
            sc->sc_revision);
-       if (sc->sc_revision <
-           sizeof (eso_rev2model) / sizeof (eso_rev2model[0]))
+       if (sc->sc_revision < nitems(eso_rev2model))
                strlcpy(retp->config, eso_rev2model[sc->sc_revision],
                    sizeof retp->config);
        else
@@ -1494,8 +1492,7 @@ eso_allocmem(struct eso_softc *sc, size_
        ed->ed_size = size;
 
        error = bus_dmamem_alloc(ed->ed_dmat, ed->ed_size, align, boundary,
-           ed->ed_segs, sizeof (ed->ed_segs) / sizeof (ed->ed_segs[0]),
-           &ed->ed_nsegs, wait);
+           ed->ed_segs, nitems(ed->ed_segs), &ed->ed_nsegs, wait);
        if (error)
                goto out;
 
Index: gcu.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/gcu.c,v
retrieving revision 1.2
diff -u -p -r1.2 gcu.c
--- gcu.c       3 Dec 2009 11:07:46 -0000       1.2
+++ gcu.c       17 Jan 2010 12:39:11 -0000
@@ -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
Index: hifn7751.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/hifn7751.c,v
retrieving revision 1.158
diff -u -p -r1.158 hifn7751.c
--- hifn7751.c  13 Sep 2009 14:42:52 -0000      1.158
+++ hifn7751.c  17 Jan 2010 12:39:11 -0000
@@ -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
        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;
Index: ichiic.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/ichiic.c,v
retrieving revision 1.23
diff -u -p -r1.23 ichiic.c
--- ichiic.c    27 Oct 2009 23:18:32 -0000      1.23
+++ ichiic.c    17 Jan 2010 12:39:11 -0000
@@ -107,8 +107,7 @@ const struct pci_matchid ichiic_ids[] = 
 int
 ichiic_match(struct device *parent, void *match, void *aux)
 {
-       return (pci_matchbyid(aux, ichiic_ids,
-           sizeof(ichiic_ids) / sizeof(ichiic_ids[0])));
+       return (pci_matchbyid(aux, ichiic_ids, nitems(ichiic_ids)));
 }
 
 void
Index: ichwdt.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/ichwdt.c,v
retrieving revision 1.3
diff -u -p -r1.3 ichwdt.c
--- ichwdt.c    29 Mar 2009 21:53:52 -0000      1.3
+++ ichwdt.c    17 Jan 2010 12:39:11 -0000
@@ -85,7 +85,7 @@ int
 ichwdt_match(struct device *parent, void *match, void *aux)
 {
        return (pci_matchbyid((struct pci_attach_args *)aux, ichwdt_devices,
-           sizeof(ichwdt_devices) / sizeof(ichwdt_devices[0])));
+           nitems(ichwdt_devices)));
 }
 
 void
Index: if_acx_pci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_acx_pci.c,v
retrieving revision 1.7
diff -u -p -r1.7 if_acx_pci.c
--- if_acx_pci.c        29 Mar 2009 21:53:52 -0000      1.7
+++ if_acx_pci.c        17 Jan 2010 12:39:11 -0000
@@ -96,7 +96,7 @@ int
 acx_pci_match(struct device *parent, void *match, void *aux)
 {
        return (pci_matchbyid((struct pci_attach_args *)aux, acx_pci_devices,
-           sizeof (acx_pci_devices) / sizeof (acx_pci_devices[0])));
+           nitems(acx_pci_devices)));
 }
 
 void
Index: if_age.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_age.c,v
retrieving revision 1.8
diff -u -p -r1.8 if_age.c
--- if_age.c    7 Jan 2010 12:26:06 -0000       1.8
+++ if_age.c    17 Jan 2010 12:39:11 -0000
@@ -139,7 +139,7 @@ int
 age_match(struct device *dev, void *match, void *aux)
 {
         return pci_matchbyid((struct pci_attach_args *)aux, age_devices,
-            sizeof (age_devices) / sizeof (age_devices[0]));
+            nitems(age_devices));
 }
 
 void
Index: if_ale.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_ale.c,v
retrieving revision 1.10
diff -u -p -r1.10 if_ale.c
--- if_ale.c    7 Jan 2010 12:26:06 -0000       1.10
+++ if_ale.c    17 Jan 2010 12:39:11 -0000
@@ -278,7 +278,7 @@ int
 ale_match(struct device *dev, void *match, void *aux)
 {
        return pci_matchbyid((struct pci_attach_args *)aux, ale_devices,
-           sizeof (ale_devices) / sizeof (ale_devices[0]));
+           nitems(ale_devices));
 }
 
 void
Index: if_an_pci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_an_pci.c,v
retrieving revision 1.17
diff -u -p -r1.17 if_an_pci.c
--- if_an_pci.c 29 Mar 2009 21:53:52 -0000      1.17
+++ if_an_pci.c 17 Jan 2010 12:39:11 -0000
@@ -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
Index: if_atw_pci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_atw_pci.c,v
retrieving revision 1.12
diff -u -p -r1.12 if_atw_pci.c
--- if_atw_pci.c        2 Jun 2009 15:13:58 -0000       1.12
+++ if_atw_pci.c        17 Jan 2010 12:39:11 -0000
@@ -105,7 +105,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
Index: if_bce.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_bce.c,v
retrieving revision 1.28
diff -u -p -r1.28 if_bce.c
--- if_bce.c    13 Aug 2009 14:24:47 -0000      1.28
+++ if_bce.c    17 Jan 2010 12:39:11 -0000
@@ -218,7 +218,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
Index: if_bnx.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_bnx.c,v
retrieving revision 1.86
diff -u -p -r1.86 if_bnx.c
--- if_bnx.c    23 Nov 2009 10:54:43 -0000      1.86
+++ if_bnx.c    17 Jan 2010 12:39:11 -0000
@@ -419,7 +419,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
Index: if_bwi_pci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_bwi_pci.c,v
retrieving revision 1.10
diff -u -p -r1.10 if_bwi_pci.c
--- if_bwi_pci.c        29 Mar 2009 21:53:52 -0000      1.10
+++ if_bwi_pci.c        17 Jan 2010 12:39:11 -0000
@@ -105,7 +105,7 @@ bwi_pci_match(struct device *parent, voi
                return (0);
 
        return (pci_matchbyid((struct pci_attach_args *)aux, bwi_pci_devices,
-           sizeof(bwi_pci_devices) / sizeof(bwi_pci_devices[0])));
+           nitems(bwi_pci_devices)));
 }
 
 void
Index: if_cas.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_cas.c,v
retrieving revision 1.29
diff -u -p -r1.29 if_cas.c
--- if_cas.c    29 Nov 2009 16:19:38 -0000      1.29
+++ if_cas.c    17 Jan 2010 12:39:11 -0000
@@ -160,7 +160,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
Index: if_che.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_che.c,v
retrieving revision 1.8
diff -u -p -r1.8 if_che.c
--- if_che.c    30 May 2007 05:11:53 -0000      1.8
+++ if_che.c    17 Jan 2010 12:39:11 -0000
@@ -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))
Index: if_de.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_de.c,v
retrieving revision 1.104
diff -u -p -r1.104 if_de.c
--- if_de.c     2 Oct 2009 23:11:56 -0000       1.104
+++ if_de.c     17 Jan 2010 12:39:12 -0000
@@ -3609,7 +3609,7 @@ tulip_print_abnormal_interrupt(tulip_sof
     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) {
@@ -4374,8 +4374,7 @@ tulip_busdma_allocmem(tulip_softc_t * co
     bus_dma_segment_t segs[1];
     int nsegs, error;
     error = bus_dmamem_alloc(sc->tulip_dmatag, size, 1, PAGE_SIZE,
-                            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->tulip_dmatag, segs, nsegs, size,
Index: if_devar.h
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_devar.h,v
retrieving revision 1.30
diff -u -p -r1.30 if_devar.h
--- if_devar.h  19 Jun 2009 14:13:41 -0000      1.30
+++ if_devar.h  17 Jan 2010 12:39:12 -0000
@@ -729,7 +729,7 @@ static const struct {
     { TULIP_SROM_CONNTYPE_NOT_USED,            TULIP_MEDIA_UNKNOWN }
 };
 #define        TULIP_SROM_LASTCONNIDX  \
-               (sizeof(tulip_srom_conninfo)/sizeof(tulip_srom_conninfo[0]) - 1)
+               (nitems(tulip_srom_conninfo) - 1)
 
 static const struct {
     tulip_media_t sm_type;
Index: if_em.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_em.c,v
retrieving revision 1.234
diff -u -p -r1.234 if_em.c
--- if_em.c     2 Dec 2009 23:30:00 -0000       1.234
+++ if_em.c     17 Jan 2010 12:39:12 -0000
@@ -252,7 +252,7 @@ em_probe(struct device *parent, void *ma
        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
Index: if_ep_pci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_ep_pci.c,v
retrieving revision 1.27
diff -u -p -r1.27 if_ep_pci.c
--- if_ep_pci.c 17 Jun 2006 18:00:43 -0000      1.27
+++ if_ep_pci.c 17 Jan 2010 12:39:12 -0000
@@ -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
Index: if_epic_pci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_epic_pci.c,v
retrieving revision 1.9
diff -u -p -r1.9 if_epic_pci.c
--- if_epic_pci.c       26 Jun 2008 05:42:17 -0000      1.9
+++ if_epic_pci.c       17 Jan 2010 12:39:12 -0000
@@ -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
Index: if_et.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_et.c,v
retrieving revision 1.19
diff -u -p -r1.19 if_et.c
--- if_et.c     13 Sep 2009 14:42:52 -0000      1.19
+++ if_et.c     17 Jan 2010 12:39:12 -0000
@@ -179,7 +179,7 @@ int
 et_match(struct device *dev, void *match, void *aux)
 {
        return pci_matchbyid((struct pci_attach_args *)aux, et_devices,
-           sizeof (et_devices) / sizeof (et_devices[0]));
+           nitems(et_devices));
 }
 
 void
Index: pciide.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/pciide.c,v
retrieving revision 1.306
diff -u -p -r1.306 pciide.c
--- pciide.c    21 Nov 2009 14:34:20 -0000      1.306
+++ pciide.c    17 Jan 2010 12:39:12 -0000
@@ -1220,43 +1220,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 */
@@ -1288,12 +1288,12 @@ pciide_lookup_product(u_int32_t id)
        int i;
 
        for (i = 0, vp = pciide_vendors;
-           i < sizeof(pciide_vendors)/sizeof(pciide_vendors[0]);
+           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++)
@@ -4842,7 +4842,7 @@ sis_hostbr_match(struct pci_attach_args 
                return (0);
        sis_hostbr_type_match = NULL;
        for (i = 0;
-           i < sizeof(sis_hostbr_type) / sizeof(sis_hostbr_type[0]);
+           i < nitems(sis_hostbr_type);
            i++) {
                if (PCI_PRODUCT(pa->pa_id) == sis_hostbr_type[i].id &&
                    PCI_REVISION(pa->pa_class) >= sis_hostbr_type[i].rev)
Index: sv.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/sv.c,v
retrieving revision 1.26
diff -u -p -r1.26 sv.c
--- sv.c        23 Jun 2009 06:39:48 -0000      1.26
+++ sv.c        17 Jan 2010 12:39:12 -0000
@@ -132,8 +132,6 @@ struct audio_device sv_device = {
        "sv"
 };
 
-#define ARRAY_SIZE(foo)  ((sizeof(foo)) / sizeof(foo[0]))
-
 int    sv_allocmem(struct sv_softc *, size_t, size_t, struct sv_dma *);
 int    sv_freemem(struct sv_softc *, struct sv_dma *);
 
@@ -460,7 +458,7 @@ sv_allocmem(sc, size, align, p)
 
        p->size = size;
        error = bus_dmamem_alloc(sc->sc_dmatag, p->size, align, 0,
-                                p->segs, ARRAY_SIZE(p->segs),
+                                p->segs, nitems(p->segs),
                                 &p->nsegs, BUS_DMA_NOWAIT);
        if (error)
                return (error);
@@ -1018,7 +1016,7 @@ static const struct {
 
 #define SV_DEVICES_PER_PORT 2
 #define SV_FIRST_MIXER (SV_LAST_CLASS + 1)
-#define SV_LAST_MIXER (SV_DEVICES_PER_PORT * (ARRAY_SIZE(ports)) + 
SV_LAST_CLASS)
+#define SV_LAST_MIXER (SV_DEVICES_PER_PORT * (nitems(ports)) + SV_LAST_CLASS)
 #define SV_RECORD_SOURCE (SV_LAST_MIXER + 1)
 #define SV_MIC_BOOST (SV_LAST_MIXER + 2)
 #define SV_RECORD_GAIN (SV_LAST_MIXER + 3)
@@ -1091,11 +1089,11 @@ sv_query_devinfo(addr, dip)
     strlcpy(dip->label.name, AudioNsource, sizeof dip->label.name);
     dip->type = AUDIO_MIXER_ENUM;
 
-    dip->un.e.num_mem = ARRAY_SIZE(record_sources);
+    dip->un.e.num_mem = nitems(record_sources);
 
     {
       int idx;
-      for (idx = 0; idx < ARRAY_SIZE(record_sources); idx++) {
+      for (idx = 0; idx < nitems(record_sources); idx++) {
        strlcpy(dip->un.e.member[idx].label.name, record_sources[idx].name,
            sizeof dip->un.e.member[idx].label.name);
        dip->un.e.member[idx].ord = record_sources[idx].idx;
@@ -1227,7 +1225,7 @@ sv_mixer_set_port(addr, cp)
     if (cp->type != AUDIO_MIXER_ENUM)
       return (EINVAL);
 
-    for (idx = 0; idx < ARRAY_SIZE(record_sources); idx++) {
+    for (idx = 0; idx < nitems(record_sources); idx++) {
       if (record_sources[idx].idx == cp->un.ord)
        goto found;
     }
@@ -1420,7 +1418,7 @@ sv_init_mixer(sc)
 
   sv_mixer_set_port(sc, &cp);
 
-  for (idx = 0; idx < ARRAY_SIZE(ports); idx++) {
+  for (idx = 0; idx < nitems(ports); idx++) {
     if (strcmp(ports[idx].audio, AudioNdac) == 0) {
       cp.type = AUDIO_MIXER_ENUM;
       cp.dev = SV_FIRST_MIXER + idx * SV_DEVICES_PER_PORT + 1;

Reply via email to