aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/phy.c
diff options
context:
space:
mode:
authorAnatolij Gustschin <agust@denx.de>2009-04-06 22:01:42 -0400
committerDavid S. Miller <davem@davemloft.net>2009-04-13 17:51:23 -0400
commita8729eb302a5b5da8b0b4d29582c42648a2e0f12 (patch)
tree88af13216c6c7ae1b7a802e65996f6a0db447a4b /drivers/net/phy/phy.c
parent140bc92903287cff4545e358c1651e4b7312cbd3 (diff)
phylib: Allow early-out in phy_change
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/phy.c')
-rw-r--r--drivers/net/phy/phy.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 3ff1f425f1bb..e3b8932d7d74 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)
655 struct phy_device *phydev = 655 struct phy_device *phydev =
656 container_of(work, struct phy_device, phy_queue); 656 container_of(work, struct phy_device, phy_queue);
657 657
658 if (phydev->drv->did_interrupt &&
659 !phydev->drv->did_interrupt(phydev))
660 goto ignore;
661
658 err = phy_disable_interrupts(phydev); 662 err = phy_disable_interrupts(phydev);
659 663
660 if (err) 664 if (err)
@@ -681,6 +685,11 @@ static void phy_change(struct work_struct *work)
681 685
682 return; 686 return;
683 687
688ignore:
689 atomic_dec(&phydev->irq_disable);
690 enable_irq(phydev->irq);
691 return;
692
684irq_enable_err: 693irq_enable_err:
685 disable_irq(phydev->irq); 694 disable_irq(phydev->irq);
686 atomic_inc(&phydev->irq_disable); 695 atomic_inc(&phydev->irq_disable);