summaryrefslogtreecommitdiff
path: root/drivers/net/bnx2.c
diff options
context:
space:
mode:
authorMichael Chan <mchan@broadcom.com>2008-05-02 16:56:16 -0700
committerDavid S. Miller <davem@davemloft.net>2008-05-02 16:56:16 -0700
commit74ecc62d6e595ca64bbef2471787bf53b94e5d3c (patch)
treeb9e8be132291f739a726f5329c094afce04c5702 /drivers/net/bnx2.c
parentae4f8fca4030a4e783fa4ccb0c9d8d8a8cf60a32 (diff)
bnx2: Refine remote PHY locking.
bnx2_set_remote_link() should be called under bp->phy_lock to protect against concurrent polling and interrupt calls. This change is needed by the next patch which will add one initial poll of the remote PHY link status. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Benjamin Li <benli@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2.c')
-rw-r--r--drivers/net/bnx2.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 861387928e6d..506c5ccd7156 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -1717,7 +1717,6 @@ bnx2_remote_phy_event(struct bnx2 *bp)
break;
}
- spin_lock(&bp->phy_lock);
bp->flow_ctrl = 0;
if ((bp->autoneg & (AUTONEG_SPEED | AUTONEG_FLOW_CTRL)) !=
(AUTONEG_SPEED | AUTONEG_FLOW_CTRL)) {
@@ -1739,7 +1738,6 @@ bnx2_remote_phy_event(struct bnx2 *bp)
if (old_port != bp->phy_port)
bnx2_set_default_link(bp);
- spin_unlock(&bp->phy_lock);
}
if (bp->link_up != link_up)
bnx2_report_link(bp);
@@ -2447,14 +2445,15 @@ bnx2_phy_event_is_set(struct bnx2 *bp, struct bnx2_napi *bnapi, u32 event)
static void
bnx2_phy_int(struct bnx2 *bp, struct bnx2_napi *bnapi)
{
- if (bnx2_phy_event_is_set(bp, bnapi, STATUS_ATTN_BITS_LINK_STATE)) {
- spin_lock(&bp->phy_lock);
+ spin_lock(&bp->phy_lock);
+
+ if (bnx2_phy_event_is_set(bp, bnapi, STATUS_ATTN_BITS_LINK_STATE))
bnx2_set_link(bp);
- spin_unlock(&bp->phy_lock);
- }
if (bnx2_phy_event_is_set(bp, bnapi, STATUS_ATTN_BITS_TIMER_ABORT))
bnx2_set_remote_link(bp);
+ spin_unlock(&bp->phy_lock);
+
}
static inline u16