netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: dsa: Remove redundant phy_attach()
@ 2015-02-09  1:29 Andrew Lunn
  2015-02-09 19:21 ` Florian Fainelli
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2015-02-09  1:29 UTC (permalink / raw)
  To: davem, f.fainelli; +Cc: netdev, Andrew Lunn

dsa_slave_phy_setup() finds the phy for the port via device tree and
using of_phy_connect(), or it uses the fall back of taking a phy from
the switch internal mdio bus and calling phy_connect_direct(). Either
way, if a phy is found, phy_attach_direct() is called to attach the
phy to the slave device.

In dsa_slave_create(), a second call to phy_attach() is made. This
results in the warning "PHY already attached". Remove this second,
redundant attaching of the phy.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 net/dsa/slave.c | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 589aafd01fc5..d104ae15836f 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -676,18 +676,5 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,
 
 	netif_carrier_off(slave_dev);
 
-	if (p->phy != NULL) {
-		if (ds->drv->get_phy_flags)
-			p->phy->dev_flags |= ds->drv->get_phy_flags(ds, port);
-
-		phy_attach(slave_dev, dev_name(&p->phy->dev),
-			   PHY_INTERFACE_MODE_GMII);
-
-		p->phy->autoneg = AUTONEG_ENABLE;
-		p->phy->speed = 0;
-		p->phy->duplex = 0;
-		p->phy->advertising = p->phy->supported | ADVERTISED_Autoneg;
-	}
-
 	return slave_dev;
 }
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: dsa: Remove redundant phy_attach()
  2015-02-09  1:29 [PATCH] net: dsa: Remove redundant phy_attach() Andrew Lunn
@ 2015-02-09 19:21 ` Florian Fainelli
  2015-02-09 22:06   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2015-02-09 19:21 UTC (permalink / raw)
  To: Andrew Lunn, davem; +Cc: netdev

On 08/02/15 17:29, Andrew Lunn wrote:
> dsa_slave_phy_setup() finds the phy for the port via device tree and
> using of_phy_connect(), or it uses the fall back of taking a phy from
> the switch internal mdio bus and calling phy_connect_direct(). Either
> way, if a phy is found, phy_attach_direct() is called to attach the
> phy to the slave device.
> 
> In dsa_slave_create(), a second call to phy_attach() is made. This
> results in the warning "PHY already attached". Remove this second,
> redundant attaching of the phy.
> 
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>

> ---
>  net/dsa/slave.c | 13 -------------
>  1 file changed, 13 deletions(-)
> 
> diff --git a/net/dsa/slave.c b/net/dsa/slave.c
> index 589aafd01fc5..d104ae15836f 100644
> --- a/net/dsa/slave.c
> +++ b/net/dsa/slave.c
> @@ -676,18 +676,5 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,
>  
>  	netif_carrier_off(slave_dev);
>  
> -	if (p->phy != NULL) {
> -		if (ds->drv->get_phy_flags)
> -			p->phy->dev_flags |= ds->drv->get_phy_flags(ds, port);
> -
> -		phy_attach(slave_dev, dev_name(&p->phy->dev),
> -			   PHY_INTERFACE_MODE_GMII);
> -
> -		p->phy->autoneg = AUTONEG_ENABLE;
> -		p->phy->speed = 0;
> -		p->phy->duplex = 0;
> -		p->phy->advertising = p->phy->supported | ADVERTISED_Autoneg;
> -	}
> -
>  	return slave_dev;
>  }
> 


-- 
Florian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: dsa: Remove redundant phy_attach()
  2015-02-09 19:21 ` Florian Fainelli
@ 2015-02-09 22:06   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2015-02-09 22:06 UTC (permalink / raw)
  To: f.fainelli; +Cc: andrew, netdev

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Mon, 09 Feb 2015 11:21:26 -0800

> On 08/02/15 17:29, Andrew Lunn wrote:
>> dsa_slave_phy_setup() finds the phy for the port via device tree and
>> using of_phy_connect(), or it uses the fall back of taking a phy from
>> the switch internal mdio bus and calling phy_connect_direct(). Either
>> way, if a phy is found, phy_attach_direct() is called to attach the
>> phy to the slave device.
>> 
>> In dsa_slave_create(), a second call to phy_attach() is made. This
>> results in the warning "PHY already attached". Remove this second,
>> redundant attaching of the phy.
>> 
>> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> 
> Acked-by: Florian Fainelli <f.fainelli@gmail.com>
> Tested-by: Florian Fainelli <f.fainelli@gmail.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-02-09 22:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-09  1:29 [PATCH] net: dsa: Remove redundant phy_attach() Andrew Lunn
2015-02-09 19:21 ` Florian Fainelli
2015-02-09 22: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).