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>,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Subject: [PATCH net-next 03/15] net: phy: icplus: implement generic .handle_interrupt() callback
Date: Mon, 23 Nov 2020 17:38:05 +0200 [thread overview]
Message-ID: <20201123153817.1616814-4-ciorneiioana@gmail.com> (raw)
In-Reply-To: <20201123153817.1616814-1-ciorneiioana@gmail.com>
From: Ioana Ciornei <ioana.ciornei@nxp.com>
In an attempt to actually support shared IRQs in phylib, we now move the
responsibility of triggering the phylib state machine or just returning
IRQ_NONE, based on the IRQ status register, to the PHY driver. Having
3 different IRQ handling callbacks (.handle_interrupt(),
.did_interrupt() and .ack_interrupt() ) is confusing so let the PHY
driver implement directly an IRQ handler like any other device driver.
Make this driver follow the new convention.
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
drivers/net/phy/icplus.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c
index d6e8516cd146..a74ff45fa99c 100644
--- a/drivers/net/phy/icplus.c
+++ b/drivers/net/phy/icplus.c
@@ -285,16 +285,24 @@ static int ip101a_g_config_intr(struct phy_device *phydev)
return phy_write(phydev, IP101A_G_IRQ_CONF_STATUS, val);
}
-static int ip101a_g_did_interrupt(struct phy_device *phydev)
+static irqreturn_t ip101a_g_handle_interrupt(struct phy_device *phydev)
{
- int val = phy_read(phydev, IP101A_G_IRQ_CONF_STATUS);
+ int irq_status;
- if (val < 0)
- return 0;
+ irq_status = phy_read(phydev, IP101A_G_IRQ_CONF_STATUS);
+ if (irq_status < 0) {
+ phy_error(phydev);
+ return IRQ_NONE;
+ }
+
+ if (!(irq_status & (IP101A_G_IRQ_SPEED_CHANGE |
+ IP101A_G_IRQ_DUPLEX_CHANGE |
+ IP101A_G_IRQ_LINK_CHANGE)))
+ return IRQ_NONE;
+
+ phy_trigger_machine(phydev);
- return val & (IP101A_G_IRQ_SPEED_CHANGE |
- IP101A_G_IRQ_DUPLEX_CHANGE |
- IP101A_G_IRQ_LINK_CHANGE);
+ return IRQ_HANDLED;
}
static int ip101a_g_ack_interrupt(struct phy_device *phydev)
@@ -332,8 +340,8 @@ static struct phy_driver icplus_driver[] = {
/* PHY_BASIC_FEATURES */
.probe = ip101a_g_probe,
.config_intr = ip101a_g_config_intr,
- .did_interrupt = ip101a_g_did_interrupt,
.ack_interrupt = ip101a_g_ack_interrupt,
+ .handle_interrupt = ip101a_g_handle_interrupt,
.config_init = &ip101a_g_config_init,
.suspend = genphy_suspend,
.resume = genphy_resume,
--
2.28.0
next prev 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 ` Ioana Ciornei [this message]
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 ` [PATCH net-next 10/15] net: phy: national: remove the use of the .ack_interrupt() Ioana Ciornei
2020-11-23 15:38 ` [PATCH net-next 11/15] net: phy: ti: implement generic .handle_interrupt() callback 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-4-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=martin.blumenstingl@googlemail.com \
--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).