* [PATCH] phylib: fixes for PHY_RESUMING state changes
@ 2009-07-01 23:00 Wade Farnsworth
2009-07-02 0:34 ` Andy Fleming
0 siblings, 1 reply; 3+ messages in thread
From: Wade Farnsworth @ 2009-07-01 23:00 UTC (permalink / raw)
To: davem; +Cc: netdev, afleming
The PHY_HALTED state disables phydev->link, but the link will not be
updated upon entering PHY_RESUMING. Add a call to phy_read_status() to
update the link before entering PHY_RUNNING. If the link is not up at
this point, enter the PHY_NOLINK state instead.
Also, when transitioning from PHY_RESUMING to PHY_RUNNING, calls to
netif_carrier_on() and phydev->adjust_link() are missing. Add the calls
similar to the other transitions to PHY_RUNNING.
Signed-off-by: Wade Farnsworth <wfarnsworth@mvista.com>
---
drivers/net/phy/phy.c | 25 ++++++++++++++++++++++---
1 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 3ff1f42..4c49a21 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -919,13 +919,32 @@ static void phy_state_machine(struct work_struct *work)
* Otherwise, it's 0, and we're
* still waiting for AN */
if (err > 0) {
- phydev->state = PHY_RUNNING;
+ err = phy_read_status(phydev);
+ if (err)
+ break;
+
+ if (phydev->link) {
+ phydev->state = PHY_RUNNING;
+ netif_carrier_on(phydev->attached_dev);
+ } else
+ phydev->state = PHY_NOLINK;
+ phydev->adjust_link(phydev->attached_dev);
} else {
phydev->state = PHY_AN;
phydev->link_timeout = PHY_AN_TIMEOUT;
}
- } else
- phydev->state = PHY_RUNNING;
+ } else {
+ err = phy_read_status(phydev);
+ if (err)
+ break;
+
+ if (phydev->link) {
+ phydev->state = PHY_RUNNING;
+ netif_carrier_on(phydev->attached_dev);
+ } else
+ phydev->state = PHY_NOLINK;
+ phydev->adjust_link(phydev->attached_dev);
+ }
break;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] phylib: fixes for PHY_RESUMING state changes
2009-07-01 23:00 [PATCH] phylib: fixes for PHY_RESUMING state changes Wade Farnsworth
@ 2009-07-02 0:34 ` Andy Fleming
2009-07-02 20:17 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Andy Fleming @ 2009-07-02 0:34 UTC (permalink / raw)
To: Wade Farnsworth; +Cc: davem, netdev
On Jul 1, 2009, at 6:00 PM, Wade Farnsworth wrote:
> The PHY_HALTED state disables phydev->link, but the link will not be
> updated upon entering PHY_RESUMING. Add a call to phy_read_status()
> to
> update the link before entering PHY_RUNNING. If the link is not up at
> this point, enter the PHY_NOLINK state instead.
>
> Also, when transitioning from PHY_RESUMING to PHY_RUNNING, calls to
> netif_carrier_on() and phydev->adjust_link() are missing. Add the
> calls
> similar to the other transitions to PHY_RUNNING.
>
> Signed-off-by: Wade Farnsworth <wfarnsworth@mvista.com>
Acked-by: Andy Fleming <afleming@freescale.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] phylib: fixes for PHY_RESUMING state changes
2009-07-02 0:34 ` Andy Fleming
@ 2009-07-02 20:17 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2009-07-02 20:17 UTC (permalink / raw)
To: afleming; +Cc: wfarnsworth, netdev
From: Andy Fleming <afleming@freescale.com>
Date: Wed, 1 Jul 2009 19:34:24 -0500
>
> On Jul 1, 2009, at 6:00 PM, Wade Farnsworth wrote:
>
>> The PHY_HALTED state disables phydev->link, but the link will not be
>> updated upon entering PHY_RESUMING. Add a call to phy_read_status()
>> to
>> update the link before entering PHY_RUNNING. If the link is not up at
>> this point, enter the PHY_NOLINK state instead.
>>
>> Also, when transitioning from PHY_RESUMING to PHY_RUNNING, calls to
>> netif_carrier_on() and phydev->adjust_link() are missing. Add the
>> calls
>> similar to the other transitions to PHY_RUNNING.
>>
>> Signed-off-by: Wade Farnsworth <wfarnsworth@mvista.com>
>
> Acked-by: Andy Fleming <afleming@freescale.com>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-07-02 20:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-01 23:00 [PATCH] phylib: fixes for PHY_RESUMING state changes Wade Farnsworth
2009-07-02 0:34 ` Andy Fleming
2009-07-02 20:17 ` 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).