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

net: phy: meson-gxl: 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: Jerome Brunet <jbrunet@baylibre.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>
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
6719e2be 12ae7ba3

+20
+20
drivers/net/phy/meson-gxl.c
··· 222 222 return phy_write(phydev, INTSRC_MASK, val); 223 223 } 224 224 225 + static irqreturn_t meson_gxl_handle_interrupt(struct phy_device *phydev) 226 + { 227 + int irq_status; 228 + 229 + irq_status = phy_read(phydev, INTSRC_FLAG); 230 + if (irq_status < 0) { 231 + phy_error(phydev); 232 + return IRQ_NONE; 233 + } 234 + 235 + if (irq_status == 0) 236 + return IRQ_NONE; 237 + 238 + phy_trigger_machine(phydev); 239 + 240 + return IRQ_HANDLED; 241 + } 242 + 225 243 static struct phy_driver meson_gxl_phy[] = { 226 244 { 227 245 PHY_ID_MATCH_EXACT(0x01814400), ··· 251 233 .read_status = meson_gxl_read_status, 252 234 .ack_interrupt = meson_gxl_ack_interrupt, 253 235 .config_intr = meson_gxl_config_intr, 236 + .handle_interrupt = meson_gxl_handle_interrupt, 254 237 .suspend = genphy_suspend, 255 238 .resume = genphy_resume, 256 239 }, { ··· 262 243 .soft_reset = genphy_soft_reset, 263 244 .ack_interrupt = meson_gxl_ack_interrupt, 264 245 .config_intr = meson_gxl_config_intr, 246 + .handle_interrupt = meson_gxl_handle_interrupt, 265 247 .suspend = genphy_suspend, 266 248 .resume = genphy_resume, 267 249 },