From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Lunn Subject: Re: [PATCH net-next v2 2/6] net: phy: mscc: add ethtool statistics counters Date: Thu, 4 Oct 2018 17:22:37 +0200 Message-ID: <20181004152237.GF4730@lunn.ch> References: <20181004124728.9821-1-quentin.schulz@bootlin.com> <20181004124728.9821-3-quentin.schulz@bootlin.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: davem@davemloft.net, f.fainelli@gmail.com, allan.nielsen@microchip.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, thomas.petazzoni@bootlin.com, alexandre.belloni@bootlin.com, Raju Lakkaraju To: Quentin Schulz Return-path: Content-Disposition: inline In-Reply-To: <20181004124728.9821-3-quentin.schulz@bootlin.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On Thu, Oct 04, 2018 at 02:47:24PM +0200, Quentin Schulz wrote: Hi Quentin > +static u64 vsc85xx_get_stat(struct phy_device *phydev, int i) > +{ > + struct vsc8531_private *priv = phydev->priv; > + int val, oldpage; > + u64 ret; > + > + oldpage = phy_select_page(phydev, priv->hw_stats[i].page); > + > + val = __phy_read(phydev, priv->hw_stats[i].reg); > + if (val < 0) { > + ret = U64_MAX; > + goto out; > + } phy_read_paged() should work here as well. > + > + val = val & priv->hw_stats[i].mask; > + priv->stats[i] += val; > + ret = priv->stats[i]; Otherwise this looks good. Reviewed-by: Andrew Lunn Andrew