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

net: phy: intel-xway: 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: Mathias Kresin <dev@kresin.me>
Cc: Hauke Mehrtens <hauke@hauke-m.de>
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
16c9709a 1566db04

+15 -12
+15 -12
drivers/net/phy/intel-xway.c
··· 212 212 static int xway_gphy_config_intr(struct phy_device *phydev) 213 213 { 214 214 u16 mask = 0; 215 + int err; 215 216 216 - if (phydev->interrupts == PHY_INTERRUPT_ENABLED) 217 + if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { 218 + err = xway_gphy_ack_interrupt(phydev); 219 + if (err) 220 + return err; 221 + 217 222 mask = XWAY_MDIO_INIT_MASK; 223 + err = phy_write(phydev, XWAY_MDIO_IMASK, mask); 224 + } else { 225 + err = phy_write(phydev, XWAY_MDIO_IMASK, mask); 226 + if (err) 227 + return err; 218 228 219 - return phy_write(phydev, XWAY_MDIO_IMASK, mask); 229 + err = xway_gphy_ack_interrupt(phydev); 230 + } 231 + 232 + return err; 220 233 } 221 234 222 235 static irqreturn_t xway_gphy_handle_interrupt(struct phy_device *phydev) ··· 258 245 /* PHY_GBIT_FEATURES */ 259 246 .config_init = xway_gphy_config_init, 260 247 .config_aneg = xway_gphy14_config_aneg, 261 - .ack_interrupt = xway_gphy_ack_interrupt, 262 248 .handle_interrupt = xway_gphy_handle_interrupt, 263 249 .config_intr = xway_gphy_config_intr, 264 250 .suspend = genphy_suspend, ··· 269 257 /* PHY_BASIC_FEATURES */ 270 258 .config_init = xway_gphy_config_init, 271 259 .config_aneg = xway_gphy14_config_aneg, 272 - .ack_interrupt = xway_gphy_ack_interrupt, 273 260 .handle_interrupt = xway_gphy_handle_interrupt, 274 261 .config_intr = xway_gphy_config_intr, 275 262 .suspend = genphy_suspend, ··· 280 269 /* PHY_GBIT_FEATURES */ 281 270 .config_init = xway_gphy_config_init, 282 271 .config_aneg = xway_gphy14_config_aneg, 283 - .ack_interrupt = xway_gphy_ack_interrupt, 284 272 .handle_interrupt = xway_gphy_handle_interrupt, 285 273 .config_intr = xway_gphy_config_intr, 286 274 .suspend = genphy_suspend, ··· 291 281 /* PHY_BASIC_FEATURES */ 292 282 .config_init = xway_gphy_config_init, 293 283 .config_aneg = xway_gphy14_config_aneg, 294 - .ack_interrupt = xway_gphy_ack_interrupt, 295 284 .handle_interrupt = xway_gphy_handle_interrupt, 296 285 .config_intr = xway_gphy_config_intr, 297 286 .suspend = genphy_suspend, ··· 301 292 .name = "Intel XWAY PHY11G (PEF 7071/PEF 7072) v1.5 / v1.6", 302 293 /* PHY_GBIT_FEATURES */ 303 294 .config_init = xway_gphy_config_init, 304 - .ack_interrupt = xway_gphy_ack_interrupt, 305 295 .handle_interrupt = xway_gphy_handle_interrupt, 306 296 .config_intr = xway_gphy_config_intr, 307 297 .suspend = genphy_suspend, ··· 311 303 .name = "Intel XWAY PHY22F (PEF 7061) v1.5 / v1.6", 312 304 /* PHY_BASIC_FEATURES */ 313 305 .config_init = xway_gphy_config_init, 314 - .ack_interrupt = xway_gphy_ack_interrupt, 315 306 .handle_interrupt = xway_gphy_handle_interrupt, 316 307 .config_intr = xway_gphy_config_intr, 317 308 .suspend = genphy_suspend, ··· 321 314 .name = "Intel XWAY PHY11G (xRX v1.1 integrated)", 322 315 /* PHY_GBIT_FEATURES */ 323 316 .config_init = xway_gphy_config_init, 324 - .ack_interrupt = xway_gphy_ack_interrupt, 325 317 .handle_interrupt = xway_gphy_handle_interrupt, 326 318 .config_intr = xway_gphy_config_intr, 327 319 .suspend = genphy_suspend, ··· 331 325 .name = "Intel XWAY PHY22F (xRX v1.1 integrated)", 332 326 /* PHY_BASIC_FEATURES */ 333 327 .config_init = xway_gphy_config_init, 334 - .ack_interrupt = xway_gphy_ack_interrupt, 335 328 .handle_interrupt = xway_gphy_handle_interrupt, 336 329 .config_intr = xway_gphy_config_intr, 337 330 .suspend = genphy_suspend, ··· 341 336 .name = "Intel XWAY PHY11G (xRX v1.2 integrated)", 342 337 /* PHY_GBIT_FEATURES */ 343 338 .config_init = xway_gphy_config_init, 344 - .ack_interrupt = xway_gphy_ack_interrupt, 345 339 .handle_interrupt = xway_gphy_handle_interrupt, 346 340 .config_intr = xway_gphy_config_intr, 347 341 .suspend = genphy_suspend, ··· 351 347 .name = "Intel XWAY PHY22F (xRX v1.2 integrated)", 352 348 /* PHY_BASIC_FEATURES */ 353 349 .config_init = xway_gphy_config_init, 354 - .ack_interrupt = xway_gphy_ack_interrupt, 355 350 .handle_interrupt = xway_gphy_handle_interrupt, 356 351 .config_intr = xway_gphy_config_intr, 357 352 .suspend = genphy_suspend,