All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: phylib: fix interrupts re-enablement in phy_start
@ 2016-05-10  9:42 shh.xie
  2016-05-10 18:25 ` Florian Fainelli
  2016-05-10 20:01 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: shh.xie @ 2016-05-10  9:42 UTC (permalink / raw)
  To: netdev, davem, f.fainelli; +Cc: Shaohui Xie

From: Shaohui Xie <Shaohui.Xie@nxp.com>

If phy was suspended and is starting, current driver always enable
phy's interrupts, if phy works in polling, phy can raise unexpected
interrupt which will not be handled, the interrupt will block system
enter suspend again. So interrupts should only be re-enabled if phy
works in interrupt.

Signed-off-by: Shaohui Xie <Shaohui.Xie@nxp.com>
---
 drivers/net/phy/phy.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 6f221c8..baa5ecb 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -871,9 +871,11 @@ void phy_start(struct phy_device *phydev)
 		break;
 	case PHY_HALTED:
 		/* make sure interrupts are re-enabled for the PHY */
-		err = phy_enable_interrupts(phydev);
-		if (err < 0)
-			break;
+		if (phydev->irq != PHY_POLL) {
+			err = phy_enable_interrupts(phydev);
+			if (err < 0)
+				break;
+		}
 
 		phydev->state = PHY_RESUMING;
 		do_resume = true;
-- 
2.1.0.27.g96db324

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

* Re: [PATCH] net: phylib: fix interrupts re-enablement in phy_start
  2016-05-10  9:42 [PATCH] net: phylib: fix interrupts re-enablement in phy_start shh.xie
@ 2016-05-10 18:25 ` Florian Fainelli
  2016-05-11  2:15   ` Shaohui Xie
  2016-05-10 20:01 ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Florian Fainelli @ 2016-05-10 18:25 UTC (permalink / raw)
  To: shh.xie, netdev, davem; +Cc: Shaohui Xie, Andrew Lunn

On 05/10/2016 02:42 AM, shh.xie@gmail.com wrote:
> From: Shaohui Xie <Shaohui.Xie@nxp.com>
> 
> If phy was suspended and is starting, current driver always enable
> phy's interrupts, if phy works in polling, phy can raise unexpected
> interrupt which will not be handled, the interrupt will block system
> enter suspend again. So interrupts should only be re-enabled if phy
> works in interrupt.

Your explanation makes sense. The commit message could you use some
improvements like s/phy/PHY/ and "works in interrupt mode", but that is
not a huge thing.

> 
> Signed-off-by: Shaohui Xie <Shaohui.Xie@nxp.com>

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

> ---
>  drivers/net/phy/phy.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index 6f221c8..baa5ecb 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -871,9 +871,11 @@ void phy_start(struct phy_device *phydev)
>  		break;
>  	case PHY_HALTED:
>  		/* make sure interrupts are re-enabled for the PHY */
> -		err = phy_enable_interrupts(phydev);
> -		if (err < 0)
> -			break;
> +		if (phydev->irq != PHY_POLL) {
> +			err = phy_enable_interrupts(phydev);
> +			if (err < 0)
> +				break;
> +		}
>  
>  		phydev->state = PHY_RESUMING;
>  		do_resume = true;
> 


-- 
Florian

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

* Re: [PATCH] net: phylib: fix interrupts re-enablement in phy_start
  2016-05-10  9:42 [PATCH] net: phylib: fix interrupts re-enablement in phy_start shh.xie
  2016-05-10 18:25 ` Florian Fainelli
@ 2016-05-10 20:01 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2016-05-10 20:01 UTC (permalink / raw)
  To: shh.xie; +Cc: netdev, f.fainelli, Shaohui.Xie

From: <shh.xie@gmail.com>
Date: Tue, 10 May 2016 17:42:26 +0800

> From: Shaohui Xie <Shaohui.Xie@nxp.com>
> 
> If phy was suspended and is starting, current driver always enable
> phy's interrupts, if phy works in polling, phy can raise unexpected
> interrupt which will not be handled, the interrupt will block system
> enter suspend again. So interrupts should only be re-enabled if phy
> works in interrupt.
> 
> Signed-off-by: Shaohui Xie <Shaohui.Xie@nxp.com>

Applied.

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

* RE: [PATCH] net: phylib: fix interrupts re-enablement in phy_start
  2016-05-10 18:25 ` Florian Fainelli
@ 2016-05-11  2:15   ` Shaohui Xie
  0 siblings, 0 replies; 4+ messages in thread
From: Shaohui Xie @ 2016-05-11  2:15 UTC (permalink / raw)
  To: Florian Fainelli, netdev, davem; +Cc: Andrew Lunn

> -----Original Message-----
> From: Florian Fainelli [mailto:f.fainelli@gmail.com]
> Sent: Wednesday, May 11, 2016 2:25 AM
> To: shh.xie@gmail.com; netdev@vger.kernel.org; davem@davemloft.net
> Cc: Shaohui Xie <shaohui.xie@nxp.com>; Andrew Lunn <andrew@lunn.ch>
> Subject: Re: [PATCH] net: phylib: fix interrupts re-enablement in phy_start
> 
> On 05/10/2016 02:42 AM, shh.xie@gmail.com wrote:
> > From: Shaohui Xie <Shaohui.Xie@nxp.com>
> >
> > If phy was suspended and is starting, current driver always enable
> > phy's interrupts, if phy works in polling, phy can raise unexpected
> > interrupt which will not be handled, the interrupt will block system
> > enter suspend again. So interrupts should only be re-enabled if phy
> > works in interrupt.
> 
> Your explanation makes sense. The commit message could you use some
> improvements like s/phy/PHY/ and "works in interrupt mode", but that is not a
> huge thing.
[S.H] Thank you for the comment.

I should make the commit message more precise and will make improvement in
future patch submission.

Regards,
Shaohui

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

end of thread, other threads:[~2016-05-11  3:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-10  9:42 [PATCH] net: phylib: fix interrupts re-enablement in phy_start shh.xie
2016-05-10 18:25 ` Florian Fainelli
2016-05-11  2:15   ` Shaohui Xie
2016-05-10 20:01 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.