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

net: phy: qsemi: 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.

Also, add a comment describing the multiple step interrupt
acknoledgement process.

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
a1a44174 efc3d9de

+17 -3
+17 -3
drivers/net/phy/qsemi.c
··· 75 75 { 76 76 int err; 77 77 78 + /* The Interrupt Source register is not self-clearing, bits 4 and 5 are 79 + * cleared when MII_BMSR is read and bits 1 and 3 are cleared when 80 + * MII_EXPANSION is read 81 + */ 78 82 err = phy_read(phydev, MII_QS6612_ISR); 79 83 80 84 if (err < 0) ··· 100 96 static int qs6612_config_intr(struct phy_device *phydev) 101 97 { 102 98 int err; 103 - if (phydev->interrupts == PHY_INTERRUPT_ENABLED) 99 + if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { 100 + /* clear any interrupts before enabling them */ 101 + err = qs6612_ack_interrupt(phydev); 102 + if (err) 103 + return err; 104 + 104 105 err = phy_write(phydev, MII_QS6612_IMR, 105 106 MII_QS6612_IMR_INIT); 106 - else 107 + } else { 107 108 err = phy_write(phydev, MII_QS6612_IMR, 0); 109 + if (err) 110 + return err; 111 + 112 + /* clear any leftover interrupts */ 113 + err = qs6612_ack_interrupt(phydev); 114 + } 108 115 109 116 return err; 110 117 ··· 148 133 .phy_id_mask = 0xfffffff0, 149 134 /* PHY_BASIC_FEATURES */ 150 135 .config_init = qs6612_config_init, 151 - .ack_interrupt = qs6612_ack_interrupt, 152 136 .config_intr = qs6612_config_intr, 153 137 .handle_interrupt = qs6612_handle_interrupt, 154 138 } };