From: Anatolij Gustschin <agust@denx.de>
To: netdev@vger.kernel.org
Cc: afleming@freescale.com
Subject: [PATCH 2/3] phylib: Allow early-out in phy_change
Date: Tue, 7 Apr 2009 14:01:42 +0200 [thread overview]
Message-ID: <1239105703-26240-2-git-send-email-agust@denx.de> (raw)
In-Reply-To: <1239105703-26240-1-git-send-email-agust@denx.de>
Marvell 88E1121R Dual PHY device can be hardware-configured
to use shared interrupt pin for both PHY ports. For such
PHY configurations using shared PHY interrupt phy_interrupt()
handler will also schedule a work for PHY port which didn't
cause an interrupt.
This patch adds a possibility for PHY drivers to provide
did_interrupt() function which reports if the PHY (or a PHY
port in a multi-PHY device) generated an interrupt. This
function is called in phy_change() as phy_change() shouldn't
proceed if it is invoked for a PHY which didn't cause an
interrupt. So check for interrupt originator in phy_change()
to allow early-out.
Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
drivers/net/phy/phy.c | 9 +++++++++
include/linux/phy.h | 6 ++++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 3ff1f42..e3b8932 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -655,6 +655,10 @@ static void phy_change(struct work_struct *work)
struct phy_device *phydev =
container_of(work, struct phy_device, phy_queue);
+ if (phydev->drv->did_interrupt &&
+ !phydev->drv->did_interrupt(phydev))
+ goto ignore;
+
err = phy_disable_interrupts(phydev);
if (err)
@@ -681,6 +685,11 @@ static void phy_change(struct work_struct *work)
return;
+ignore:
+ atomic_dec(&phydev->irq_disable);
+ enable_irq(phydev->irq);
+ return;
+
irq_enable_err:
disable_irq(phydev->irq);
atomic_inc(&phydev->irq_disable);
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 32cf14a..c871065 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -388,6 +388,12 @@ struct phy_driver {
/* Enables or disables interrupts */
int (*config_intr)(struct phy_device *phydev);
+ /*
+ * Checks if the PHY generated an interrupt.
+ * For multy-PHY devices with shared PHY interrupt pin
+ */
+ int (*did_interrupt)(struct phy_device *phydev);
+
/* Clears up any memory if needed */
void (*remove)(struct phy_device *phydev);
--
1.5.6.3
next prev parent reply other threads:[~2009-04-07 12:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-07 12:01 [PATCH 1/3] phylib: Basic support for the M88E1121R Marvell chip Anatolij Gustschin
2009-04-07 12:01 ` Anatolij Gustschin [this message]
2009-04-07 12:01 ` [PATCH 3/3] phylib: Add interrupt source check function to M88E1121R driver Anatolij Gustschin
2009-04-13 21:51 ` David Miller
2009-04-13 21:52 ` [PATCH 2/3] phylib: Allow early-out in phy_change David Miller
2009-04-13 21:51 ` [PATCH 1/3] phylib: Basic support for the M88E1121R Marvell chip David Miller
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=1239105703-26240-2-git-send-email-agust@denx.de \
--to=agust@denx.de \
--cc=afleming@freescale.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).