Commit 824ef51f authored by Ioana Ciornei's avatar Ioana Ciornei Committed by Jakub Kicinski

net: phy: smsc: 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: Andre Edich <andre.edich@microchip.com>
Cc: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 36b25c26
...@@ -48,6 +48,13 @@ struct smsc_phy_priv { ...@@ -48,6 +48,13 @@ struct smsc_phy_priv {
struct clk *refclk; struct clk *refclk;
}; };
static int smsc_phy_ack_interrupt(struct phy_device *phydev)
{
int rc = phy_read(phydev, MII_LAN83C185_ISF);
return rc < 0 ? rc : 0;
}
static int smsc_phy_config_intr(struct phy_device *phydev) static int smsc_phy_config_intr(struct phy_device *phydev)
{ {
struct smsc_phy_priv *priv = phydev->priv; struct smsc_phy_priv *priv = phydev->priv;
...@@ -55,19 +62,21 @@ static int smsc_phy_config_intr(struct phy_device *phydev) ...@@ -55,19 +62,21 @@ static int smsc_phy_config_intr(struct phy_device *phydev)
int rc; int rc;
if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
rc = smsc_phy_ack_interrupt(phydev);
if (rc)
return rc;
intmask = MII_LAN83C185_ISF_INT4 | MII_LAN83C185_ISF_INT6; intmask = MII_LAN83C185_ISF_INT4 | MII_LAN83C185_ISF_INT6;
if (priv->energy_enable) if (priv->energy_enable)
intmask |= MII_LAN83C185_ISF_INT7; intmask |= MII_LAN83C185_ISF_INT7;
}
rc = phy_write(phydev, MII_LAN83C185_IM, intmask); rc = phy_write(phydev, MII_LAN83C185_IM, intmask);
} else {
rc = phy_write(phydev, MII_LAN83C185_IM, intmask);
if (rc)
return rc;
return rc < 0 ? rc : 0; rc = smsc_phy_ack_interrupt(phydev);
} }
static int smsc_phy_ack_interrupt(struct phy_device *phydev)
{
int rc = phy_read (phydev, MII_LAN83C185_ISF);
return rc < 0 ? rc : 0; return rc < 0 ? rc : 0;
} }
...@@ -336,7 +345,6 @@ static struct phy_driver smsc_phy_driver[] = { ...@@ -336,7 +345,6 @@ static struct phy_driver smsc_phy_driver[] = {
.soft_reset = smsc_phy_reset, .soft_reset = smsc_phy_reset,
/* IRQ related */ /* IRQ related */
.ack_interrupt = smsc_phy_ack_interrupt,
.config_intr = smsc_phy_config_intr, .config_intr = smsc_phy_config_intr,
.handle_interrupt = smsc_phy_handle_interrupt, .handle_interrupt = smsc_phy_handle_interrupt,
...@@ -356,7 +364,6 @@ static struct phy_driver smsc_phy_driver[] = { ...@@ -356,7 +364,6 @@ static struct phy_driver smsc_phy_driver[] = {
.soft_reset = smsc_phy_reset, .soft_reset = smsc_phy_reset,
/* IRQ related */ /* IRQ related */
.ack_interrupt = smsc_phy_ack_interrupt,
.config_intr = smsc_phy_config_intr, .config_intr = smsc_phy_config_intr,
.handle_interrupt = smsc_phy_handle_interrupt, .handle_interrupt = smsc_phy_handle_interrupt,
...@@ -386,7 +393,6 @@ static struct phy_driver smsc_phy_driver[] = { ...@@ -386,7 +393,6 @@ static struct phy_driver smsc_phy_driver[] = {
.config_aneg = lan87xx_config_aneg, .config_aneg = lan87xx_config_aneg,
/* IRQ related */ /* IRQ related */
.ack_interrupt = smsc_phy_ack_interrupt,
.config_intr = smsc_phy_config_intr, .config_intr = smsc_phy_config_intr,
.handle_interrupt = smsc_phy_handle_interrupt, .handle_interrupt = smsc_phy_handle_interrupt,
...@@ -410,7 +416,6 @@ static struct phy_driver smsc_phy_driver[] = { ...@@ -410,7 +416,6 @@ static struct phy_driver smsc_phy_driver[] = {
.config_init = lan911x_config_init, .config_init = lan911x_config_init,
/* IRQ related */ /* IRQ related */
.ack_interrupt = smsc_phy_ack_interrupt,
.config_intr = smsc_phy_config_intr, .config_intr = smsc_phy_config_intr,
.handle_interrupt = smsc_phy_handle_interrupt, .handle_interrupt = smsc_phy_handle_interrupt,
...@@ -436,7 +441,6 @@ static struct phy_driver smsc_phy_driver[] = { ...@@ -436,7 +441,6 @@ static struct phy_driver smsc_phy_driver[] = {
.config_aneg = lan87xx_config_aneg_ext, .config_aneg = lan87xx_config_aneg_ext,
/* IRQ related */ /* IRQ related */
.ack_interrupt = smsc_phy_ack_interrupt,
.config_intr = smsc_phy_config_intr, .config_intr = smsc_phy_config_intr,
.handle_interrupt = smsc_phy_handle_interrupt, .handle_interrupt = smsc_phy_handle_interrupt,
...@@ -463,7 +467,6 @@ static struct phy_driver smsc_phy_driver[] = { ...@@ -463,7 +467,6 @@ static struct phy_driver smsc_phy_driver[] = {
.soft_reset = smsc_phy_reset, .soft_reset = smsc_phy_reset,
/* IRQ related */ /* IRQ related */
.ack_interrupt = smsc_phy_ack_interrupt,
.config_intr = smsc_phy_config_intr, .config_intr = smsc_phy_config_intr,
.handle_interrupt = smsc_phy_handle_interrupt, .handle_interrupt = smsc_phy_handle_interrupt,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment