Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: phy: qsemi: 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.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Ioana Ciornei and committed by
Jakub Kicinski
efc3d9de aa2d603a

+22
+22
drivers/net/phy/qsemi.c
··· 106 106 107 107 } 108 108 109 + static irqreturn_t qs6612_handle_interrupt(struct phy_device *phydev) 110 + { 111 + int irq_status; 112 + 113 + irq_status = phy_read(phydev, MII_QS6612_ISR); 114 + if (irq_status < 0) { 115 + phy_error(phydev); 116 + return IRQ_NONE; 117 + } 118 + 119 + if (!(irq_status & MII_QS6612_IMR_INIT)) 120 + return IRQ_NONE; 121 + 122 + /* the interrupt source register is not self-clearing */ 123 + qs6612_ack_interrupt(phydev); 124 + 125 + phy_trigger_machine(phydev); 126 + 127 + return IRQ_HANDLED; 128 + } 129 + 109 130 static struct phy_driver qs6612_driver[] = { { 110 131 .phy_id = 0x00181440, 111 132 .name = "QS6612", ··· 135 114 .config_init = qs6612_config_init, 136 115 .ack_interrupt = qs6612_ack_interrupt, 137 116 .config_intr = qs6612_config_intr, 117 + .handle_interrupt = qs6612_handle_interrupt, 138 118 } }; 139 119 140 120 module_phy_driver(qs6612_driver);