Skip to content

Commit 25497b7

Browse files
IoanaCiorneikuba-moo
authored andcommitted
net: phy: icplus: implement generic .handle_interrupt() callback
In an attempt to actually support shared IRQs in phylib, we now move the responsibility of triggering the phylib state machine or just returning IRQ_NONE, based on the IRQ status register, to the PHY driver. Having 3 different IRQ handling callbacks (.handle_interrupt(), .did_interrupt() and .ack_interrupt() ) is confusing so let the PHY driver implement directly an IRQ handler like any other device driver. Make this driver follow the new convention. Cc: Martin Blumenstingl <[email protected]> Signed-off-by: Ioana Ciornei <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 16c9709 commit 25497b7

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

drivers/net/phy/icplus.c

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -285,16 +285,24 @@ static int ip101a_g_config_intr(struct phy_device *phydev)
285285
return phy_write(phydev, IP101A_G_IRQ_CONF_STATUS, val);
286286
}
287287

288-
static int ip101a_g_did_interrupt(struct phy_device *phydev)
288+
static irqreturn_t ip101a_g_handle_interrupt(struct phy_device *phydev)
289289
{
290-
int val = phy_read(phydev, IP101A_G_IRQ_CONF_STATUS);
290+
int irq_status;
291291

292-
if (val < 0)
293-
return 0;
292+
irq_status = phy_read(phydev, IP101A_G_IRQ_CONF_STATUS);
293+
if (irq_status < 0) {
294+
phy_error(phydev);
295+
return IRQ_NONE;
296+
}
297+
298+
if (!(irq_status & (IP101A_G_IRQ_SPEED_CHANGE |
299+
IP101A_G_IRQ_DUPLEX_CHANGE |
300+
IP101A_G_IRQ_LINK_CHANGE)))
301+
return IRQ_NONE;
302+
303+
phy_trigger_machine(phydev);
294304

295-
return val & (IP101A_G_IRQ_SPEED_CHANGE |
296-
IP101A_G_IRQ_DUPLEX_CHANGE |
297-
IP101A_G_IRQ_LINK_CHANGE);
305+
return IRQ_HANDLED;
298306
}
299307

300308
static int ip101a_g_ack_interrupt(struct phy_device *phydev)
@@ -332,8 +340,8 @@ static struct phy_driver icplus_driver[] = {
332340
/* PHY_BASIC_FEATURES */
333341
.probe = ip101a_g_probe,
334342
.config_intr = ip101a_g_config_intr,
335-
.did_interrupt = ip101a_g_did_interrupt,
336343
.ack_interrupt = ip101a_g_ack_interrupt,
344+
.handle_interrupt = ip101a_g_handle_interrupt,
337345
.config_init = &ip101a_g_config_init,
338346
.suspend = genphy_suspend,
339347
.resume = genphy_resume,

0 commit comments

Comments
 (0)