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

net: phy: cicada: implement the 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
e5d2b0b6 15772e4d

+20
+20
drivers/net/phy/cicada.c
··· 96 96 return err; 97 97 } 98 98 99 + static irqreturn_t cis820x_handle_interrupt(struct phy_device *phydev) 100 + { 101 + int irq_status; 102 + 103 + irq_status = phy_read(phydev, MII_CIS8201_ISTAT); 104 + if (irq_status < 0) { 105 + phy_error(phydev); 106 + return IRQ_NONE; 107 + } 108 + 109 + if (!(irq_status & MII_CIS8201_IMASK_MASK)) 110 + return IRQ_NONE; 111 + 112 + phy_trigger_machine(phydev); 113 + 114 + return IRQ_HANDLED; 115 + } 116 + 99 117 /* Cicada 8201, a.k.a Vitesse VSC8201 */ 100 118 static struct phy_driver cis820x_driver[] = { 101 119 { ··· 124 106 .config_init = &cis820x_config_init, 125 107 .ack_interrupt = &cis820x_ack_interrupt, 126 108 .config_intr = &cis820x_config_intr, 109 + .handle_interrupt = &cis820x_handle_interrupt, 127 110 }, { 128 111 .phy_id = 0x000fc440, 129 112 .name = "Cicada Cis8204", ··· 133 114 .config_init = &cis820x_config_init, 134 115 .ack_interrupt = &cis820x_ack_interrupt, 135 116 .config_intr = &cis820x_config_intr, 117 + .handle_interrupt = &cis820x_handle_interrupt, 136 118 } }; 137 119 138 120 module_phy_driver(cis820x_driver);