svn commit: r276885 - head/sys/dev/mii

Gleb Smirnoff glebius at FreeBSD.org
Fri Jan 9 12:26:09 UTC 2015


Author: glebius
Date: Fri Jan  9 12:26:08 2015
New Revision: 276885
URL: https://svnweb.freebsd.org/changeset/base/276885

Log:
  Use nitems().

Modified:
  head/sys/dev/mii/truephy.c

Modified: head/sys/dev/mii/truephy.c
==============================================================================
--- head/sys/dev/mii/truephy.c	Fri Jan  9 12:08:51 2015	(r276884)
+++ head/sys/dev/mii/truephy.c	Fri Jan  9 12:26:08 2015	(r276885)
@@ -244,9 +244,7 @@ truephy_reset(struct mii_softc *sc)
 	PHY_WRITE(sc, TRUEPHY_CTRL,
 		  TRUEPHY_CTRL_DIAG | TRUEPHY_CTRL_RSV1 | TRUEPHY_CTRL_RSV0);
 
-#define N(arr)	(int)(sizeof(arr) / sizeof(arr[0]))
-
-	for (i = 0; i < N(truephy_dspcode); ++i) {
+	for (i = 0; i < nitems(truephy_dspcode); ++i) {
 		const struct truephy_dsp *dsp = &truephy_dspcode[i];
 
 		PHY_WRITE(sc, TRUEPHY_INDEX, dsp->index);
@@ -256,8 +254,6 @@ truephy_reset(struct mii_softc *sc)
 		PHY_READ(sc, TRUEPHY_DATA);
 	}
 
-#undef N
-
 	PHY_READ(sc, MII_BMCR);
 	PHY_READ(sc, TRUEPHY_CTRL);
 	PHY_WRITE(sc, MII_BMCR, BMCR_AUTOEN |  BMCR_S1000);


More information about the svn-src-all mailing list