* [PATCH -next] net: ethernet: faraday: Use phy_find_first() instead of open coding it
@ 2016-01-10 20:04 Guenter Roeck
2016-01-10 23:53 ` Andrew Lunn
2016-01-11 3:06 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Guenter Roeck @ 2016-01-10 20:04 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, linux-kernel, Guenter Roeck, Andrew Lunn
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH -next] net: ethernet: faraday: Use phy_find_first() instead of open coding it
2016-01-10 20:04 [PATCH -next] net: ethernet: faraday: Use phy_find_first() instead of open coding it Guenter Roeck
@ 2016-01-10 23:53 ` Andrew Lunn
2016-01-11 3:06 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2016-01-10 23:53 UTC (permalink / raw)
To: Guenter Roeck; +Cc: David S. Miller, netdev, linux-kernel
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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next] net: ethernet: faraday: Use phy_find_first() instead of open coding it
2016-01-10 20:04 [PATCH -next] net: ethernet: faraday: Use phy_find_first() instead of open coding it Guenter Roeck
2016-01-10 23:53 ` Andrew Lunn
@ 2016-01-11 3:06 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-01-11 3:06 UTC (permalink / raw)
To: linux; +Cc: netdev, linux-kernel, andrew
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-01-11 3:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-10 20:04 [PATCH -next] net: ethernet: faraday: Use phy_find_first() instead of open coding it Guenter Roeck
2016-01-10 23:53 ` Andrew Lunn
2016-01-11 3:06 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).