From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757883AbcAJXxq (ORCPT ); Sun, 10 Jan 2016 18:53:46 -0500 Received: from vps0.lunn.ch ([178.209.37.122]:45091 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757755AbcAJXxo (ORCPT ); Sun, 10 Jan 2016 18:53:44 -0500 Date: Mon, 11 Jan 2016 00:53:42 +0100 From: Andrew Lunn To: Guenter Roeck Cc: "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH -next] net: ethernet: faraday: Use phy_find_first() instead of open coding it Message-ID: <20160110235342.GB25548@lunn.ch> References: <1452456272-1795-1-git-send-email-linux@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1452456272-1795-1-git-send-email-linux@roeck-us.net> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 10, 2016 at 12:04:32PM -0800, Guenter Roeck wrote: > Use phy_find_first() to find the first phy device instead of > open coding it. > > Cc: Andrew Lunn > Signed-off-by: Guenter Roeck Acked-by: Andrew Lunn Thanks Andrew > --- > drivers/net/ethernet/faraday/ftgmac100.c | 15 ++------------- > 1 file changed, 2 insertions(+), 13 deletions(-) > > diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c > index bb116ad646f6..84384e1585a5 100644 > --- a/drivers/net/ethernet/faraday/ftgmac100.c > +++ b/drivers/net/ethernet/faraday/ftgmac100.c > @@ -834,20 +834,9 @@ static void ftgmac100_adjust_link(struct net_device *netdev) > static int ftgmac100_mii_probe(struct ftgmac100 *priv) > { > struct net_device *netdev = priv->netdev; > - struct phy_device *phydev = NULL; > - int i; > - > - /* search for connect PHY device */ > - for (i = 0; i < PHY_MAX_ADDR; i++) { > - struct phy_device *tmp = mdiobus_get_phy(priv->mii_bus, i); > - > - if (tmp) { > - phydev = tmp; > - break; > - } > - } > + struct phy_device *phydev; > > - /* now we are supposed to have a proper phydev, to attach to... */ > + phydev = phy_find_first(priv->mii_bus); > if (!phydev) { > netdev_info(netdev, "%s: no PHY found\n", netdev->name); > return -ENODEV; > -- > 2.1.4 >