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

net: phy: national: remove the use of the .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.

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
a4d77421 6571b455

+22 -14
+22 -14
drivers/net/phy/national.c
··· 63 63 phy_write(phydev, NS_EXP_MEM_DATA, data); 64 64 } 65 65 66 - static int ns_config_intr(struct phy_device *phydev) 67 - { 68 - int err; 69 - 70 - if (phydev->interrupts == PHY_INTERRUPT_ENABLED) 71 - err = phy_write(phydev, DP83865_INT_MASK, 72 - DP83865_INT_MASK_DEFAULT); 73 - else 74 - err = phy_write(phydev, DP83865_INT_MASK, 0); 75 - 76 - return err; 77 - } 78 - 79 66 static int ns_ack_interrupt(struct phy_device *phydev) 80 67 { 81 68 int ret = phy_read(phydev, DP83865_INT_STATUS); ··· 95 108 phy_trigger_machine(phydev); 96 109 97 110 return IRQ_HANDLED; 111 + } 112 + 113 + static int ns_config_intr(struct phy_device *phydev) 114 + { 115 + int err; 116 + 117 + if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { 118 + err = ns_ack_interrupt(phydev); 119 + if (err) 120 + return err; 121 + 122 + err = phy_write(phydev, DP83865_INT_MASK, 123 + DP83865_INT_MASK_DEFAULT); 124 + } else { 125 + err = phy_write(phydev, DP83865_INT_MASK, 0); 126 + if (err) 127 + return err; 128 + 129 + err = ns_ack_interrupt(phydev); 130 + } 131 + 132 + return err; 98 133 } 99 134 100 135 static void ns_giga_speed_fallback(struct phy_device *phydev, int mode) ··· 163 154 .name = "NatSemi DP83865", 164 155 /* PHY_GBIT_FEATURES */ 165 156 .config_init = ns_config_init, 166 - .ack_interrupt = ns_ack_interrupt, 167 157 .config_intr = ns_config_intr, 168 158 .handle_interrupt = ns_handle_interrupt, 169 159 } };