On Sat, Oct 24, 2020 at 07:17:05PM +0200, Andrew Lunn wrote: > > - Every PHY driver gains a .handle_interrupt() implementation that, for > > the most part, would look like below: > > > > irq_status = phy_read(phydev, INTR_STATUS); > > if (irq_status < 0) { > > phy_error(phydev); > > return IRQ_NONE; > > } > > > > if (irq_status == 0) > > return IRQ_NONE; > > > > phy_trigger_machine(phydev); > > > > return IRQ_HANDLED; > > Hi Ioana > > It looks like phy_trigger_machine(phydev) could be left in the core, > phy_interrupt(). It just needs to look at the return code, IRQ_HANDLED > means trigger the state machine.
I tend to disagree that this would bring us any benefit. Keeping the phy_trigger_machine() inside the phy_interrupt() would mean that we are changing the convention of what the implementation of .handle_interrupt() should do. At the moment, there are drivers which use it to handle multiple interrupt sources within the same PHY device (e.g. MACSEC, 1588, link state). With your suggestion, when a MACSEC interrupt is received, the PHY driver would be forced to return IRQ_NONE just so phylib does not trigger the link state machine. I think this would eventually lead to some "irq X: nobody cared". Also, the vsc8584_handle_interrupt() already calls a wrapper over phy_trigger_machine() called phy_mac_interrupt() which was intended for MAC driver use only. Ioana