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

net: phy: at803x: 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: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: Michael Walle <michael@walle.cc>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Ioana Ciornei and committed by
Jakub Kicinski
a3417885 29773097

+12 -7
+12 -7
drivers/net/phy/at803x.c
··· 614 614 value = phy_read(phydev, AT803X_INTR_ENABLE); 615 615 616 616 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { 617 + /* Clear any pending interrupts */ 618 + err = at803x_ack_interrupt(phydev); 619 + if (err) 620 + return err; 621 + 617 622 value |= AT803X_INTR_ENABLE_AUTONEG_ERR; 618 623 value |= AT803X_INTR_ENABLE_SPEED_CHANGED; 619 624 value |= AT803X_INTR_ENABLE_DUPLEX_CHANGED; ··· 626 621 value |= AT803X_INTR_ENABLE_LINK_SUCCESS; 627 622 628 623 err = phy_write(phydev, AT803X_INTR_ENABLE, value); 629 - } 630 - else 624 + } else { 631 625 err = phy_write(phydev, AT803X_INTR_ENABLE, 0); 626 + if (err) 627 + return err; 628 + 629 + /* Clear any pending interrupts */ 630 + err = at803x_ack_interrupt(phydev); 631 + } 632 632 633 633 return err; 634 634 } ··· 1098 1088 .resume = at803x_resume, 1099 1089 /* PHY_GBIT_FEATURES */ 1100 1090 .read_status = at803x_read_status, 1101 - .ack_interrupt = at803x_ack_interrupt, 1102 1091 .config_intr = at803x_config_intr, 1103 1092 .handle_interrupt = at803x_handle_interrupt, 1104 1093 .get_tunable = at803x_get_tunable, ··· 1118 1109 .suspend = at803x_suspend, 1119 1110 .resume = at803x_resume, 1120 1111 /* PHY_BASIC_FEATURES */ 1121 - .ack_interrupt = at803x_ack_interrupt, 1122 1112 .config_intr = at803x_config_intr, 1123 1113 .handle_interrupt = at803x_handle_interrupt, 1124 1114 }, { ··· 1136 1128 /* PHY_GBIT_FEATURES */ 1137 1129 .read_status = at803x_read_status, 1138 1130 .aneg_done = at803x_aneg_done, 1139 - .ack_interrupt = &at803x_ack_interrupt, 1140 1131 .config_intr = &at803x_config_intr, 1141 1132 .handle_interrupt = at803x_handle_interrupt, 1142 1133 .get_tunable = at803x_get_tunable, ··· 1156 1149 .suspend = at803x_suspend, 1157 1150 .resume = at803x_resume, 1158 1151 /* PHY_BASIC_FEATURES */ 1159 - .ack_interrupt = at803x_ack_interrupt, 1160 1152 .config_intr = at803x_config_intr, 1161 1153 .handle_interrupt = at803x_handle_interrupt, 1162 1154 .cable_test_start = at803x_cable_test_start, ··· 1168 1162 .resume = at803x_resume, 1169 1163 .flags = PHY_POLL_CABLE_TEST, 1170 1164 /* PHY_BASIC_FEATURES */ 1171 - .ack_interrupt = &at803x_ack_interrupt, 1172 1165 .config_intr = &at803x_config_intr, 1173 1166 .handle_interrupt = at803x_handle_interrupt, 1174 1167 .cable_test_start = at803x_cable_test_start,