svn commit: r236641 - in stable/9/sys/dev: bge sym

Marius Strobl marius at FreeBSD.org
Tue Jun 5 20:49:19 UTC 2012


Author: marius
Date: Tue Jun  5 20:49:18 2012
New Revision: 236641
URL: http://svn.freebsd.org/changeset/base/236641

Log:
  MFC: r236488
  
  Take advantage of nitems().

Modified:
  stable/9/sys/dev/bge/if_bge.c
  stable/9/sys/dev/sym/sym_hipd.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/dev/bge/if_bge.c
==============================================================================
--- stable/9/sys/dev/bge/if_bge.c	Tue Jun  5 20:48:13 2012	(r236640)
+++ stable/9/sys/dev/bge/if_bge.c	Tue Jun  5 20:49:18 2012	(r236641)
@@ -2791,9 +2791,8 @@ bge_mbox_reorder(struct bge_softc *sc)
 	};
 	devclass_t pci, pcib;
 	device_t bus, dev;
-	int count, i;
+	int i;
 
-	count = sizeof(mbox_reorder_lists) / sizeof(mbox_reorder_lists[0]);
 	pci = devclass_find("pci");
 	pcib = devclass_find("pcib");
 	dev = sc->bge_dev;
@@ -2806,7 +2805,7 @@ bge_mbox_reorder(struct bge_softc *sc)
 		    device_get_name(bus), device_get_unit(bus));
 		if (device_get_devclass(dev) != pcib)
 			break;
-		for (i = 0; i < count; i++) {
+		for (i = 0; i < nitems(mbox_reorder_lists); i++) {
 			device_printf(sc->bge_dev,
 			    "probing dev : %s%d, vendor : 0x%04x "
 			    "device : 0x%04x\n",

Modified: stable/9/sys/dev/sym/sym_hipd.c
==============================================================================
--- stable/9/sys/dev/sym/sym_hipd.c	Tue Jun  5 20:48:13 2012	(r236640)
+++ stable/9/sys/dev/sym/sym_hipd.c	Tue Jun  5 20:49:18 2012	(r236641)
@@ -8411,9 +8411,6 @@ static const struct sym_pci_chip sym_pci
  FE_RAM|FE_IO256|FE_LEDC}
 };
 
-#define sym_pci_num_devs \
-	(sizeof(sym_pci_dev_table) / sizeof(sym_pci_dev_table[0]))
-
 /*
  *  Look up the chip table.
  *
@@ -8434,7 +8431,7 @@ sym_find_pci_chip(device_t dev)
 	device_id = pci_get_device(dev);
 	revision  = pci_get_revid(dev);
 
-	for (i = 0; i < sym_pci_num_devs; i++) {
+	for (i = 0; i < nitems(sym_pci_dev_table); i++) {
 		chip = &sym_pci_dev_table[i];
 		if (device_id != chip->device_id)
 			continue;


More information about the svn-src-stable-9 mailing list