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

net: phy: microchip: remove the use of .ack_interrupt()

In preparation of removing the .ack_interrupt() callback, we must replace
its occurrences (aka phy_clear_interrupt), from the 2 places where it is
called from (phy_enable_interrupts and phy_disable_interrupts), with
equivalent functionality.

This means that clearing interrupts now becomes something that the PHY
driver is responsible of doing, before enabling interrupts and after
clearing them. Make this driver follow the new contract.

Cc: Nisar Sayed <Nisar.Sayed@microchip.com>
Cc: Yuiko Oshino <yuiko.oshino@microchip.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
cf499391 e01a3feb

+12 -18
+5 -8
drivers/net/phy/microchip.c
··· 44 44 LAN88XX_INT_MASK_LINK_CHANGE_); 45 45 } else { 46 46 rc = phy_write(phydev, LAN88XX_INT_MASK, 0); 47 + if (rc) 48 + return rc; 49 + 50 + /* Ack interrupts after they have been disabled */ 51 + rc = phy_read(phydev, LAN88XX_INT_STS); 47 52 } 48 - 49 - return rc < 0 ? rc : 0; 50 - } 51 - 52 - static int lan88xx_phy_ack_interrupt(struct phy_device *phydev) 53 - { 54 - int rc = phy_read(phydev, LAN88XX_INT_STS); 55 53 56 54 return rc < 0 ? rc : 0; 57 55 } ··· 356 358 .config_init = lan88xx_config_init, 357 359 .config_aneg = lan88xx_config_aneg, 358 360 359 - .ack_interrupt = lan88xx_phy_ack_interrupt, 360 361 .config_intr = lan88xx_phy_config_intr, 361 362 .handle_interrupt = lan88xx_handle_interrupt, 362 363
+7 -10
drivers/net/phy/microchip_t1.c
··· 189 189 rc = phy_write(phydev, LAN87XX_INTERRUPT_MASK, 0x7FFF); 190 190 rc = phy_read(phydev, LAN87XX_INTERRUPT_SOURCE); 191 191 val = LAN87XX_MASK_LINK_UP | LAN87XX_MASK_LINK_DOWN; 192 + rc = phy_write(phydev, LAN87XX_INTERRUPT_MASK, val); 193 + } else { 194 + rc = phy_write(phydev, LAN87XX_INTERRUPT_MASK, val); 195 + if (rc) 196 + return rc; 197 + 198 + rc = phy_read(phydev, LAN87XX_INTERRUPT_SOURCE); 192 199 } 193 - 194 - rc = phy_write(phydev, LAN87XX_INTERRUPT_MASK, val); 195 - 196 - return rc < 0 ? rc : 0; 197 - } 198 - 199 - static int lan87xx_phy_ack_interrupt(struct phy_device *phydev) 200 - { 201 - int rc = phy_read(phydev, LAN87XX_INTERRUPT_SOURCE); 202 200 203 201 return rc < 0 ? rc : 0; 204 202 } ··· 236 238 237 239 .config_init = lan87xx_config_init, 238 240 239 - .ack_interrupt = lan87xx_phy_ack_interrupt, 240 241 .config_intr = lan87xx_phy_config_intr, 241 242 .handle_interrupt = lan87xx_handle_interrupt, 242 243