linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: phy: Move interrupt check from phy_check to phy_interrupt
@ 2018-03-07 22:50 Brad Mouring
  2018-03-08 16:29 ` Andrew Lunn
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Brad Mouring @ 2018-03-07 22:50 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli; +Cc: netdev, linux-kernel, Brad Mouring

If multiple phys share the same interrupt (e.g. a multi-phy chip),
the first device registered is the only one checked as phy_interrupt
will always return IRQ_HANDLED if the first phydev is not halted.
Move the interrupt check into phy_interrupt and, if it was not this
phydev, return IRQ_NONE to allow other devices on this irq a chance
to check if it was their interrupt.

Signed-off-by: Brad Mouring <brad.mouring@ni.com>
---
 drivers/net/phy/phy.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index e3e29c2b028b..ff1aa815568f 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -632,6 +632,12 @@ static irqreturn_t phy_interrupt(int irq, void *phy_dat)
 	if (PHY_HALTED == phydev->state)
 		return IRQ_NONE;		/* It can't be ours.  */
 
+	if (phy_interrupt_is_valid(phydev)) {
+		if (phydev->drv->did_interrupt &&
+			!phydev->drv->did_interrupt(phydev))
+			return IRQ_NONE;
+	}
+
 	phy_change(phydev);
 
 	return IRQ_HANDLED;
@@ -725,16 +731,6 @@ EXPORT_SYMBOL(phy_stop_interrupts);
  */
 void phy_change(struct phy_device *phydev)
 {
-	if (phy_interrupt_is_valid(phydev)) {
-		if (phydev->drv->did_interrupt &&
-		    !phydev->drv->did_interrupt(phydev))
-			return;
-
-		if (phydev->state == PHY_HALTED)
-			if (phy_disable_interrupts(phydev))
-				goto phy_err;
-	}
-
 	mutex_lock(&phydev->lock);
 	if ((PHY_RUNNING == phydev->state) || (PHY_NOLINK == phydev->state))
 		phydev->state = PHY_CHANGELINK;
-- 
2.16.2

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

end of thread, other threads:[~2018-03-12 14:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-07 22:50 [PATCH] net: phy: Move interrupt check from phy_check to phy_interrupt Brad Mouring
2018-03-08 16:29 ` Andrew Lunn
2018-03-08 16:46   ` Brad Mouring
2018-03-08 19:41 ` Sergei Shtylyov
2018-03-08 19:57   ` Sergei Shtylyov
2018-03-08 20:16   ` Brad Mouring
2018-03-08 20:25 ` Sergei Shtylyov
2018-03-08 20:31 ` [PATCH] net: phy: Tell caller result of phy_change() Brad Mouring
2018-03-08 20:47   ` Andrew Lunn
2018-03-08 22:23   ` [PATCH net v3] " Brad Mouring
2018-03-12 14:34     ` 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).