Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1305668 > unrolled thread

[PATCH -next] net: ethernet: faraday: Use phy_find_first() instead of open coding it

Started byGuenter Roeck <linux@roeck-us.net>
First post2016-01-10 21:10 +0100
Last post2016-01-11 04:10 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH -next] net: ethernet: faraday: Use phy_find_first() instead of open coding it Guenter Roeck <linux@roeck-us.net> - 2016-01-10 21:10 +0100
    Re: [PATCH -next] net: ethernet: faraday: Use phy_find_first()  instead of open coding it Andrew Lunn <andrew@lunn.ch> - 2016-01-11 01:00 +0100
    Re: [PATCH -next] net: ethernet: faraday: Use phy_find_first()  instead of open coding it David Miller <davem@davemloft.net> - 2016-01-11 04:10 +0100

#1305668 — [PATCH -next] net: ethernet: faraday: Use phy_find_first() instead of open coding it

FromGuenter Roeck <linux@roeck-us.net>
Date2016-01-10 21:10 +0100
Subject[PATCH -next] net: ethernet: faraday: Use phy_find_first() instead of open coding it
Message-ID<qPutk-s4-5@gated-at.bofh.it>
Use phy_find_first() to find the first phy device instead of
open coding it.

Cc: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 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

[toc] | [next] | [standalone]


#1305745 — Re: [PATCH -next] net: ethernet: faraday: Use phy_find_first() instead of open coding it

FromAndrew Lunn <andrew@lunn.ch>
Date2016-01-11 01:00 +0100
SubjectRe: [PATCH -next] net: ethernet: faraday: Use phy_find_first() instead of open coding it
Message-ID<qPy3U-2Gd-1@gated-at.bofh.it>
In reply to#1305668
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 <andrew@lunn.ch>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Acked-by: Andrew Lunn <andrew@lunn.ch>

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
> 

[toc] | [prev] | [next] | [standalone]


#1305796 — Re: [PATCH -next] net: ethernet: faraday: Use phy_find_first() instead of open coding it

FromDavid Miller <davem@davemloft.net>
Date2016-01-11 04:10 +0100
SubjectRe: [PATCH -next] net: ethernet: faraday: Use phy_find_first() instead of open coding it
Message-ID<qPB1M-4Rm-17@gated-at.bofh.it>
In reply to#1305668
From: Guenter Roeck <linux@roeck-us.net>
Date: Sun, 10 Jan 2016 12:04:32 -0800

> Use phy_find_first() to find the first phy device instead of
> open coding it.
> 
> Cc: Andrew Lunn <andrew@lunn.ch>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Applied.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web