All of lore.kernel.org
 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 16/18] net: phy: ste10Xp: remove the use of .ack_interrupt()
Date: Thu, 12 Nov 2020 17:55:11 +0200	[thread overview]
Message-ID: <20201112155513.411604-17-ciorneiioana@gmail.com> (raw)
In-Reply-To: <20201112155513.411604-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/ste10Xp.c | 41 +++++++++++++++++++++------------------
 1 file changed, 22 insertions(+), 19 deletions(-)

diff --git a/drivers/net/phy/ste10Xp.c b/drivers/net/phy/ste10Xp.c
index 9f315332e0f2..431fe5e0ce31 100644
--- a/drivers/net/phy/ste10Xp.c
+++ b/drivers/net/phy/ste10Xp.c
@@ -48,32 +48,37 @@ static int ste10Xp_config_init(struct phy_device *phydev)
 	return 0;
 }
 
+static int ste10Xp_ack_interrupt(struct phy_device *phydev)
+{
+	int err = phy_read(phydev, MII_XCIIS);
+
+	if (err < 0)
+		return err;
+
+	return 0;
+}
+
 static int ste10Xp_config_intr(struct phy_device *phydev)
 {
-	int err, value;
+	int err;
 
 	if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
+		/* clear any pending interrupts */
+		err = ste10Xp_ack_interrupt(phydev);
+		if (err)
+			return err;
+
 		/* Enable all STe101P interrupts (PR12) */
 		err = phy_write(phydev, MII_XIE, MII_XIE_DEFAULT_MASK);
-		/* clear any pending interrupts */
-		if (err == 0) {
-			value = phy_read(phydev, MII_XCIIS);
-			if (value < 0)
-				err = value;
-		}
-	} else
+	} else {
 		err = phy_write(phydev, MII_XIE, 0);
+		if (err)
+			return err;
 
-	return err;
-}
-
-static int ste10Xp_ack_interrupt(struct phy_device *phydev)
-{
-	int err = phy_read(phydev, MII_XCIIS);
-	if (err < 0)
-		return err;
+		err = ste10Xp_ack_interrupt(phydev);
+	}
 
-	return 0;
+	return err;
 }
 
 static irqreturn_t ste10Xp_handle_interrupt(struct phy_device *phydev)
@@ -101,7 +106,6 @@ static struct phy_driver ste10xp_pdriver[] = {
 	.name = "STe101p",
 	/* PHY_BASIC_FEATURES */
 	.config_init = ste10Xp_config_init,
-	.ack_interrupt = ste10Xp_ack_interrupt,
 	.config_intr = ste10Xp_config_intr,
 	.handle_interrupt = ste10Xp_handle_interrupt,
 	.suspend = genphy_suspend,
@@ -112,7 +116,6 @@ static struct phy_driver ste10xp_pdriver[] = {
 	.name = "STe100p",
 	/* PHY_BASIC_FEATURES */
 	.config_init = ste10Xp_config_init,
-	.ack_interrupt = ste10Xp_ack_interrupt,
 	.config_intr = ste10Xp_config_intr,
 	.handle_interrupt = ste10Xp_handle_interrupt,
 	.suspend = genphy_suspend,
-- 
2.28.0


  parent reply	other threads:[~2020-11-12 15:59 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-12 15:54 [PATCH net-next 00/18] net: phy: add support for shared interrupts (part 2) Ioana Ciornei
2020-11-12 15:54 ` [PATCH net-next 01/18] net: phy: vitesse: implement generic .handle_interrupt() callback Ioana Ciornei
2020-11-12 15:54 ` [PATCH net-next 02/18] net: phy: vitesse: remove the use of .ack_interrupt() Ioana Ciornei
2020-11-12 15:54 ` [PATCH net-next 03/18] net: phy: microchip: implement generic .handle_interrupt() callback Ioana Ciornei
2020-11-12 15:54 ` [PATCH net-next 04/18] net: phy: microchip: remove the use of .ack_interrupt() Ioana Ciornei
2020-11-12 15:55 ` [PATCH net-next 05/18] net: phy: marvell: implement generic .handle_interrupt() callback Ioana Ciornei
2020-11-12 15:55 ` [PATCH net-next 06/18] net: phy: marvell: remove the use of .ack_interrupt() Ioana Ciornei
2020-11-12 15:55 ` [PATCH net-next 07/18] net: phy: lxt: implement generic .handle_interrupt() callback Ioana Ciornei
2020-11-12 15:55 ` [PATCH net-next 08/18] net: phy: lxt: remove the use of .ack_interrupt() Ioana Ciornei
2020-11-12 15:55 ` [PATCH net-next 09/18] net: phy: nxp-tja11xx: implement generic .handle_interrupt() callback Ioana Ciornei
2020-11-12 15:55 ` [PATCH net-next 10/18] net: phy: nxp-tja11xx: remove the use of .ack_interrupt() Ioana Ciornei
2020-11-12 15:55 ` [PATCH net-next 11/18] net: phy: amd: implement generic .handle_interrupt() callback Ioana Ciornei
2020-11-12 15:55 ` [PATCH net-next 12/18] net: phy: amd: remove the use of .ack_interrupt() Ioana Ciornei
2020-11-12 15:55 ` [PATCH net-next 13/18] net: phy: smsc: implement generic .handle_interrupt() callback Ioana Ciornei
2020-11-12 15:55 ` [PATCH net-next 14/18] net: phy: smsc: remove the use of .ack_interrupt() Ioana Ciornei
2020-11-12 15:55 ` [PATCH net-next 15/18] net: phy: ste10Xp: implement generic .handle_interrupt() callback Ioana Ciornei
2020-11-12 15:55 ` Ioana Ciornei [this message]
2020-11-12 15:55 ` [PATCH net-next 17/18] net: phy: adin: " Ioana Ciornei
2020-11-12 15:55 ` [PATCH net-next 18/18] net: phy: adin: remove the use of the .ack_interrupt() Ioana Ciornei
2020-11-13  2:19 ` [PATCH net-next 00/18] net: phy: add support for shared interrupts (part 2) Jakub Kicinski
2020-11-13  8:17   ` Ioana Ciornei
2020-11-13 19:54     ` Jakub Kicinski

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=20201112155513.411604-17-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.