netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ioana Ciornei <ciorneiioana@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Ioana Ciornei <ioana.ciornei@nxp.com>
Subject: [PATCH net-next 10/15] net: phy: national: remove the use of the .ack_interrupt()
Date: Mon, 23 Nov 2020 17:38:12 +0200	[thread overview]
Message-ID: <20201123153817.1616814-11-ciorneiioana@gmail.com> (raw)
In-Reply-To: <20201123153817.1616814-1-ciorneiioana@gmail.com>

From: Ioana Ciornei <ioana.ciornei@nxp.com>

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>
---
 drivers/net/phy/national.c | 36 ++++++++++++++++++++++--------------
 1 file 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,
 } };
-- 
2.28.0


  parent reply	other threads:[~2020-11-23 15:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-23 15:38 [PATCH net-next 00/15] net: phy: add support for shared interrupts (part 3) Ioana Ciornei
2020-11-23 15:38 ` [PATCH net-next 01/15] net: phy: intel-xway: implement generic .handle_interrupt() callback Ioana Ciornei
2020-11-23 15:38 ` [PATCH net-next 02/15] net: phy: intel-xway: remove the use of .ack_interrupt() Ioana Ciornei
2020-11-23 15:38 ` [PATCH net-next 03/15] net: phy: icplus: implement generic .handle_interrupt() callback Ioana Ciornei
2020-11-23 15:38 ` [PATCH net-next 04/15] net: phy: icplus: remove the use .ack_interrupt() Ioana Ciornei
2020-11-23 15:38 ` [PATCH net-next 05/15] net: phy: meson-gxl: implement generic .handle_interrupt() callback Ioana Ciornei
2020-11-23 15:38 ` [PATCH net-next 06/15] net: phy: meson-gxl: remove the use of .ack_callback() Ioana Ciornei
2020-11-26  9:02   ` Jerome Brunet
2020-11-23 15:38 ` [PATCH net-next 07/15] net: phy: micrel: implement generic .handle_interrupt() callback Ioana Ciornei
2020-11-23 15:38 ` [PATCH net-next 08/15] net: phy: micrel: remove the use of .ack_interrupt() Ioana Ciornei
2020-11-23 15:38 ` [PATCH net-next 09/15] net: phy: national: implement generic .handle_interrupt() callback Ioana Ciornei
2020-11-23 15:38 ` Ioana Ciornei [this message]
2020-11-23 15:38 ` [PATCH net-next 11/15] net: phy: ti: " Ioana Ciornei
2020-11-23 15:38 ` [PATCH net-next 12/15] net: phy: ti: remove the use of .ack_interrupt() Ioana Ciornei
2020-11-23 15:38 ` [PATCH net-next 13/15] net: phy: qsemi: implement generic .handle_interrupt() callback Ioana Ciornei
2020-11-23 15:38 ` [PATCH net-next 14/15] net: phy: qsemi: remove the use of .ack_interrupt() Ioana Ciornei
2020-11-23 15:38 ` [PATCH net-next 15/15] net: phy: remove the .did_interrupt() and .ack_interrupt() callback Ioana Ciornei
2020-11-23 22:13 ` [PATCH net-next 00/15] net: phy: add support for shared interrupts (part 3) Martin Blumenstingl
2020-11-23 22:37   ` Jakub Kicinski
2020-11-23 22:55     ` Ioana Ciornei
2020-11-25 19:40 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201123153817.1616814-11-ciorneiioana@gmail.com \
    --to=ciorneiioana@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=ioana.ciornei@nxp.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).