diff options
author | Michael Chan <mchan@broadcom.com> | 2008-05-02 19:56:16 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-05-02 19:56:16 -0400 |
commit | 74ecc62d6e595ca64bbef2471787bf53b94e5d3c (patch) | |
tree | b9e8be132291f739a726f5329c094afce04c5702 | |
parent | ae4f8fca4030a4e783fa4ccb0c9d8d8a8cf60a32 (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>
-rw-r--r-- | drivers/net/bnx2.c | 11 |
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) | |||
1717 | break; | 1717 | break; |
1718 | } | 1718 | } |
1719 | 1719 | ||
1720 | spin_lock(&bp->phy_lock); | ||
1721 | bp->flow_ctrl = 0; | 1720 | bp->flow_ctrl = 0; |
1722 | if ((bp->autoneg & (AUTONEG_SPEED | AUTONEG_FLOW_CTRL)) != | 1721 | if ((bp->autoneg & (AUTONEG_SPEED | AUTONEG_FLOW_CTRL)) != |
1723 | (AUTONEG_SPEED | AUTONEG_FLOW_CTRL)) { | 1722 | (AUTONEG_SPEED | AUTONEG_FLOW_CTRL)) { |
@@ -1739,7 +1738,6 @@ bnx2_remote_phy_event(struct bnx2 *bp) | |||
1739 | if (old_port != bp->phy_port) | 1738 | if (old_port != bp->phy_port) |
1740 | bnx2_set_default_link(bp); | 1739 | bnx2_set_default_link(bp); |
1741 | 1740 | ||
1742 | spin_unlock(&bp->phy_lock); | ||
1743 | } | 1741 | } |
1744 | if (bp->link_up != link_up) | 1742 | if (bp->link_up != link_up) |
1745 | bnx2_report_link(bp); | 1743 | bnx2_report_link(bp); |
@@ -2447,14 +2445,15 @@ bnx2_phy_event_is_set(struct bnx2 *bp, struct bnx2_napi *bnapi, u32 event) | |||
2447 | static void | 2445 | static void |
2448 | bnx2_phy_int(struct bnx2 *bp, struct bnx2_napi *bnapi) | 2446 | bnx2_phy_int(struct bnx2 *bp, struct bnx2_napi *bnapi) |
2449 | { | 2447 | { |
2450 | if (bnx2_phy_event_is_set(bp, bnapi, STATUS_ATTN_BITS_LINK_STATE)) { | 2448 | spin_lock(&bp->phy_lock); |
2451 | spin_lock(&bp->phy_lock); | 2449 | |
2450 | if (bnx2_phy_event_is_set(bp, bnapi, STATUS_ATTN_BITS_LINK_STATE)) | ||
2452 | bnx2_set_link(bp); | 2451 | bnx2_set_link(bp); |
2453 | spin_unlock(&bp->phy_lock); | ||
2454 | } | ||
2455 | if (bnx2_phy_event_is_set(bp, bnapi, STATUS_ATTN_BITS_TIMER_ABORT)) | 2452 | if (bnx2_phy_event_is_set(bp, bnapi, STATUS_ATTN_BITS_TIMER_ABORT)) |
2456 | bnx2_set_remote_link(bp); | 2453 | bnx2_set_remote_link(bp); |
2457 | 2454 | ||
2455 | spin_unlock(&bp->phy_lock); | ||
2456 | |||
2458 | } | 2457 | } |
2459 | 2458 | ||
2460 | static inline u16 | 2459 | static inline u16 |