Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Jan 2015 12:26:09 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r276885 - head/sys/dev/mii
Message-ID:  <201501091226.t09CQ9EL034046@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



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