Skip to content

Commit

Permalink
net: phy: lxt: remove the use of .ack_interrupt()
Browse files Browse the repository at this point in the history
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: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Ioana Ciornei authored and Jakub Kicinski committed Nov 17, 2020
1 parent 01c4a00 commit 9a12dd6
Showing 1 changed file with 34 additions and 10 deletions.
44 changes: 34 additions & 10 deletions drivers/net/phy/lxt.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,23 @@ static int lxt970_ack_interrupt(struct phy_device *phydev)

static int lxt970_config_intr(struct phy_device *phydev)
{
if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
return phy_write(phydev, MII_LXT970_IER, MII_LXT970_IER_IEN);
else
return phy_write(phydev, MII_LXT970_IER, 0);
int err;

if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
err = lxt970_ack_interrupt(phydev);
if (err)
return err;

err = phy_write(phydev, MII_LXT970_IER, MII_LXT970_IER_IEN);
} else {
err = phy_write(phydev, MII_LXT970_IER, 0);
if (err)
return err;

err = lxt970_ack_interrupt(phydev);
}

return err;
}

static irqreturn_t lxt970_handle_interrupt(struct phy_device *phydev)
Expand Down Expand Up @@ -129,10 +142,23 @@ static int lxt971_ack_interrupt(struct phy_device *phydev)

static int lxt971_config_intr(struct phy_device *phydev)
{
if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
return phy_write(phydev, MII_LXT971_IER, MII_LXT971_IER_IEN);
else
return phy_write(phydev, MII_LXT971_IER, 0);
int err;

if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
err = lxt971_ack_interrupt(phydev);
if (err)
return err;

err = phy_write(phydev, MII_LXT971_IER, MII_LXT971_IER_IEN);
} else {
err = phy_write(phydev, MII_LXT971_IER, 0);
if (err)
return err;

err = lxt971_ack_interrupt(phydev);
}

return err;
}

static irqreturn_t lxt971_handle_interrupt(struct phy_device *phydev)
Expand Down Expand Up @@ -285,15 +311,13 @@ static struct phy_driver lxt97x_driver[] = {
.phy_id_mask = 0xfffffff0,
/* PHY_BASIC_FEATURES */
.config_init = lxt970_config_init,
.ack_interrupt = lxt970_ack_interrupt,
.config_intr = lxt970_config_intr,
.handle_interrupt = lxt970_handle_interrupt,
}, {
.phy_id = 0x001378e0,
.name = "LXT971",
.phy_id_mask = 0xfffffff0,
/* PHY_BASIC_FEATURES */
.ack_interrupt = lxt971_ack_interrupt,
.config_intr = lxt971_config_intr,
.handle_interrupt = lxt971_handle_interrupt,
.suspend = genphy_suspend,
Expand Down

0 comments on commit 9a12dd6

Please sign in to comment.