summaryrefslogtreecommitdiff
path: root/drivers/net/phy/national.c
diff options
context:
space:
mode:
authorIoana Ciornei <ioana.ciornei@nxp.com>2020-11-23 18:38:12 +0300
committerJakub Kicinski <kuba@kernel.org>2020-11-25 22:18:37 +0300
commita4d7742149f6a4880fa8bdf941a40c345162074c (patch)
tree66de64b41f293e0ccab8099b2f1bbad198b59358 /drivers/net/phy/national.c
parent6571b4555dc94908f13d811898cddc5c0fa8bd71 (diff)
downloadlinux-a4d7742149f6a4880fa8bdf941a40c345162074c.tar.xz
net: phy: national: remove the use of the .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. Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/phy/national.c')
-rw-r--r--drivers/net/phy/national.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/drivers/net/phy/national.c b/drivers/net/phy/national.c
index 8c71fd66b0b1..5a8c8eb18582 100644
--- a/drivers/net/phy/national.c
+++ b/drivers/net/phy/national.c
@@ -63,19 +63,6 @@ static void ns_exp_write(struct phy_device *phydev, u16 reg, u8 data)
phy_write(phydev, NS_EXP_MEM_DATA, data);
}
-static int ns_config_intr(struct phy_device *phydev)
-{
- int err;
-
- if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
- err = phy_write(phydev, DP83865_INT_MASK,
- DP83865_INT_MASK_DEFAULT);
- else
- err = phy_write(phydev, DP83865_INT_MASK, 0);
-
- return err;
-}
-
static int ns_ack_interrupt(struct phy_device *phydev)
{
int ret = phy_read(phydev, DP83865_INT_STATUS);
@@ -110,6 +97,28 @@ static irqreturn_t ns_handle_interrupt(struct phy_device *phydev)
return IRQ_HANDLED;
}
+static int ns_config_intr(struct phy_device *phydev)
+{
+ int err;
+
+ if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
+ err = ns_ack_interrupt(phydev);
+ if (err)
+ return err;
+
+ err = phy_write(phydev, DP83865_INT_MASK,
+ DP83865_INT_MASK_DEFAULT);
+ } else {
+ err = phy_write(phydev, DP83865_INT_MASK, 0);
+ if (err)
+ return err;
+
+ err = ns_ack_interrupt(phydev);
+ }
+
+ return err;
+}
+
static void ns_giga_speed_fallback(struct phy_device *phydev, int mode)
{
int bmcr = phy_read(phydev, MII_BMCR);
@@ -154,7 +163,6 @@ static struct phy_driver dp83865_driver[] = { {
.name = "NatSemi DP83865",
/* PHY_GBIT_FEATURES */
.config_init = ns_config_init,
- .ack_interrupt = ns_ack_interrupt,
.config_intr = ns_config_intr,
.handle_interrupt = ns_handle_interrupt,
} };