Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Jun 2012 19:41:28 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r236488 - in head/sys/dev: bge sym
Message-ID:  <201206021941.q52JfSR4010088@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Sat Jun  2 19:41:28 2012
New Revision: 236488
URL: http://svn.freebsd.org/changeset/base/236488

Log:
  Take advantage of nitems().
  
  MFC after:	3 days

Modified:
  head/sys/dev/bge/if_bge.c
  head/sys/dev/sym/sym_hipd.c

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Sat Jun  2 19:39:12 2012	(r236487)
+++ head/sys/dev/bge/if_bge.c	Sat Jun  2 19:41:28 2012	(r236488)
@@ -2766,9 +2766,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;
@@ -2778,7 +2777,7 @@ bge_mbox_reorder(struct bge_softc *sc)
 		bus = device_get_parent(dev);
 		if (device_get_devclass(dev) != pcib)
 			break;
-		for (i = 0; i < count; i++) {
+		for (i = 0; i < nitems(mbox_reorder_lists); i++) {
 			if (pci_get_vendor(dev) ==
 			    mbox_reorder_lists[i].vendor &&
 			    pci_get_device(dev) ==

Modified: head/sys/dev/sym/sym_hipd.c
==============================================================================
--- head/sys/dev/sym/sym_hipd.c	Sat Jun  2 19:39:12 2012	(r236487)
+++ head/sys/dev/sym/sym_hipd.c	Sat Jun  2 19:41:28 2012	(r236488)
@@ -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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206021941.q52JfSR4010088>