Skip to content

Commit 73f476a

Browse files
IoanaCiorneikuba-moo
authored andcommitted
net: phy: ti: take into account all possible interrupt sources
The previous implementation of .handle_interrupt() did not take into account the fact that all the interrupt status registers should be acknowledged since multiple interrupt sources could be asserted. Fix this by reading all the status registers before exiting with IRQ_NONE or triggering the PHY state machine. Fixes: 1d1ae3c ("net: phy: ti: implement generic .handle_interrupt() callback") Reported-by: Sven Schuchmann <[email protected]> Signed-off-by: Ioana Ciornei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 447621e commit 73f476a

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

drivers/net/phy/dp83822.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ static int dp83822_config_intr(struct phy_device *phydev)
290290

291291
static irqreturn_t dp83822_handle_interrupt(struct phy_device *phydev)
292292
{
293+
bool trigger_machine = false;
293294
int irq_status;
294295

295296
/* The MISR1 and MISR2 registers are holding the interrupt status in
@@ -305,19 +306,19 @@ static irqreturn_t dp83822_handle_interrupt(struct phy_device *phydev)
305306
return IRQ_NONE;
306307
}
307308
if (irq_status & ((irq_status & GENMASK(7, 0)) << 8))
308-
goto trigger_machine;
309+
trigger_machine = true;
309310

310311
irq_status = phy_read(phydev, MII_DP83822_MISR2);
311312
if (irq_status < 0) {
312313
phy_error(phydev);
313314
return IRQ_NONE;
314315
}
315316
if (irq_status & ((irq_status & GENMASK(7, 0)) << 8))
316-
goto trigger_machine;
317+
trigger_machine = true;
317318

318-
return IRQ_NONE;
319+
if (!trigger_machine)
320+
return IRQ_NONE;
319321

320-
trigger_machine:
321322
phy_trigger_machine(phydev);
322323

323324
return IRQ_HANDLED;

drivers/net/phy/dp83tc811.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ static int dp83811_config_intr(struct phy_device *phydev)
264264

265265
static irqreturn_t dp83811_handle_interrupt(struct phy_device *phydev)
266266
{
267+
bool trigger_machine = false;
267268
int irq_status;
268269

269270
/* The INT_STAT registers 1, 2 and 3 are holding the interrupt status
@@ -279,27 +280,27 @@ static irqreturn_t dp83811_handle_interrupt(struct phy_device *phydev)
279280
return IRQ_NONE;
280281
}
281282
if (irq_status & ((irq_status & GENMASK(7, 0)) << 8))
282-
goto trigger_machine;
283+
trigger_machine = true;
283284

284285
irq_status = phy_read(phydev, MII_DP83811_INT_STAT2);
285286
if (irq_status < 0) {
286287
phy_error(phydev);
287288
return IRQ_NONE;
288289
}
289290
if (irq_status & ((irq_status & GENMASK(7, 0)) << 8))
290-
goto trigger_machine;
291+
trigger_machine = true;
291292

292293
irq_status = phy_read(phydev, MII_DP83811_INT_STAT3);
293294
if (irq_status < 0) {
294295
phy_error(phydev);
295296
return IRQ_NONE;
296297
}
297298
if (irq_status & ((irq_status & GENMASK(7, 0)) << 8))
298-
goto trigger_machine;
299+
trigger_machine = true;
299300

300-
return IRQ_NONE;
301+
if (!trigger_machine)
302+
return IRQ_NONE;
301303

302-
trigger_machine:
303304
phy_trigger_machine(phydev);
304305

305306
return IRQ_HANDLED;

0 commit comments

Comments
 (0)