aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000e
diff options
context:
space:
mode:
authorBruce Allan <bruce.w.allan@intel.com>2011-03-18 20:27:20 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2011-04-13 22:17:06 -0400
commit1bba4386ab4f67a53c9649268dd9c83bc6110a9b (patch)
tree5519c317c5f2828422c7cb44fa6251bae5b5aff9 /drivers/net/e1000e
parent563988dcfe706457ec7049d59e18d6147179bb0a (diff)
e1000e: convert short duration msleep() to usleep_range()
With durations less than 20ms, the jiffies or legacy timer backed msleep() may sleep ~20ms which might not be what the caller expects. Instead, it is recommended to use the hrtimers backed usleep_range(). For more, see Documentation/timers/timers-howto.txt. Issues reported by checkpatch. In addition, remove unnecessary sleep in e1000e_write_nvm_spi(). Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/e1000e')
-rw-r--r--drivers/net/e1000e/82571.c10
-rw-r--r--drivers/net/e1000e/es2lan.c4
-rw-r--r--drivers/net/e1000e/ethtool.c20
-rw-r--r--drivers/net/e1000e/ich8lan.c12
-rw-r--r--drivers/net/e1000e/lib.c10
-rw-r--r--drivers/net/e1000e/netdev.c8
-rw-r--r--drivers/net/e1000e/phy.c4
7 files changed, 33 insertions, 35 deletions
diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c
index 89a69035e538..9fedbca66dfd 100644
--- a/drivers/net/e1000e/82571.c
+++ b/drivers/net/e1000e/82571.c
@@ -594,7 +594,7 @@ static s32 e1000_get_hw_semaphore_82573(struct e1000_hw *hw)
594 594
595 extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; 595 extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP;
596 596
597 msleep(2); 597 usleep_range(2000, 4000);
598 i++; 598 i++;
599 } while (i < MDIO_OWNERSHIP_TIMEOUT); 599 } while (i < MDIO_OWNERSHIP_TIMEOUT);
600 600
@@ -816,7 +816,7 @@ static s32 e1000_update_nvm_checksum_82571(struct e1000_hw *hw)
816 816
817 /* Check for pending operations. */ 817 /* Check for pending operations. */
818 for (i = 0; i < E1000_FLASH_UPDATES; i++) { 818 for (i = 0; i < E1000_FLASH_UPDATES; i++) {
819 msleep(1); 819 usleep_range(1000, 2000);
820 if ((er32(EECD) & E1000_EECD_FLUPD) == 0) 820 if ((er32(EECD) & E1000_EECD_FLUPD) == 0)
821 break; 821 break;
822 } 822 }
@@ -840,7 +840,7 @@ static s32 e1000_update_nvm_checksum_82571(struct e1000_hw *hw)
840 ew32(EECD, eecd); 840 ew32(EECD, eecd);
841 841
842 for (i = 0; i < E1000_FLASH_UPDATES; i++) { 842 for (i = 0; i < E1000_FLASH_UPDATES; i++) {
843 msleep(1); 843 usleep_range(1000, 2000);
844 if ((er32(EECD) & E1000_EECD_FLUPD) == 0) 844 if ((er32(EECD) & E1000_EECD_FLUPD) == 0)
845 break; 845 break;
846 } 846 }
@@ -930,7 +930,7 @@ static s32 e1000_get_cfg_done_82571(struct e1000_hw *hw)
930 if (er32(EEMNGCTL) & 930 if (er32(EEMNGCTL) &
931 E1000_NVM_CFG_DONE_PORT_0) 931 E1000_NVM_CFG_DONE_PORT_0)
932 break; 932 break;
933 msleep(1); 933 usleep_range(1000, 2000);
934 timeout--; 934 timeout--;
935 } 935 }
936 if (!timeout) { 936 if (!timeout) {
@@ -1037,7 +1037,7 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
1037 ew32(TCTL, E1000_TCTL_PSP); 1037 ew32(TCTL, E1000_TCTL_PSP);
1038 e1e_flush(); 1038 e1e_flush();
1039 1039
1040 msleep(10); 1040 usleep_range(10000, 20000);
1041 1041
1042 /* 1042 /*
1043 * Must acquire the MDIO ownership before MAC reset. 1043 * Must acquire the MDIO ownership before MAC reset.
diff --git a/drivers/net/e1000e/es2lan.c b/drivers/net/e1000e/es2lan.c
index 2fefa820302b..0279695b6942 100644
--- a/drivers/net/e1000e/es2lan.c
+++ b/drivers/net/e1000e/es2lan.c
@@ -612,7 +612,7 @@ static s32 e1000_get_cfg_done_80003es2lan(struct e1000_hw *hw)
612 while (timeout) { 612 while (timeout) {
613 if (er32(EEMNGCTL) & mask) 613 if (er32(EEMNGCTL) & mask)
614 break; 614 break;
615 msleep(1); 615 usleep_range(1000, 2000);
616 timeout--; 616 timeout--;
617 } 617 }
618 if (!timeout) { 618 if (!timeout) {
@@ -802,7 +802,7 @@ static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw)
802 ew32(TCTL, E1000_TCTL_PSP); 802 ew32(TCTL, E1000_TCTL_PSP);
803 e1e_flush(); 803 e1e_flush();
804 804
805 msleep(10); 805 usleep_range(10000, 20000);
806 806
807 ctrl = er32(CTRL); 807 ctrl = er32(CTRL);
808 808
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index 07f09e96e453..5b4cf9076bac 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -253,7 +253,7 @@ static int e1000_set_settings(struct net_device *netdev,
253 } 253 }
254 254
255 while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) 255 while (test_and_set_bit(__E1000_RESETTING, &adapter->state))
256 msleep(1); 256 usleep_range(1000, 2000);
257 257
258 if (ecmd->autoneg == AUTONEG_ENABLE) { 258 if (ecmd->autoneg == AUTONEG_ENABLE) {
259 hw->mac.autoneg = 1; 259 hw->mac.autoneg = 1;
@@ -317,7 +317,7 @@ static int e1000_set_pauseparam(struct net_device *netdev,
317 adapter->fc_autoneg = pause->autoneg; 317 adapter->fc_autoneg = pause->autoneg;
318 318
319 while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) 319 while (test_and_set_bit(__E1000_RESETTING, &adapter->state))
320 msleep(1); 320 usleep_range(1000, 2000);
321 321
322 if (adapter->fc_autoneg == AUTONEG_ENABLE) { 322 if (adapter->fc_autoneg == AUTONEG_ENABLE) {
323 hw->fc.requested_mode = e1000_fc_default; 323 hw->fc.requested_mode = e1000_fc_default;
@@ -673,7 +673,7 @@ static int e1000_set_ringparam(struct net_device *netdev,
673 return -EINVAL; 673 return -EINVAL;
674 674
675 while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) 675 while (test_and_set_bit(__E1000_RESETTING, &adapter->state))
676 msleep(1); 676 usleep_range(1000, 2000);
677 677
678 if (netif_running(adapter->netdev)) 678 if (netif_running(adapter->netdev))
679 e1000e_down(adapter); 679 e1000e_down(adapter);
@@ -952,7 +952,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
952 952
953 /* Disable all the interrupts */ 953 /* Disable all the interrupts */
954 ew32(IMC, 0xFFFFFFFF); 954 ew32(IMC, 0xFFFFFFFF);
955 msleep(10); 955 usleep_range(10000, 20000);
956 956
957 /* Test each interrupt */ 957 /* Test each interrupt */
958 for (i = 0; i < 10; i++) { 958 for (i = 0; i < 10; i++) {
@@ -984,7 +984,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
984 adapter->test_icr = 0; 984 adapter->test_icr = 0;
985 ew32(IMC, mask); 985 ew32(IMC, mask);
986 ew32(ICS, mask); 986 ew32(ICS, mask);
987 msleep(10); 987 usleep_range(10000, 20000);
988 988
989 if (adapter->test_icr & mask) { 989 if (adapter->test_icr & mask) {
990 *data = 3; 990 *data = 3;
@@ -1002,7 +1002,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
1002 adapter->test_icr = 0; 1002 adapter->test_icr = 0;
1003 ew32(IMS, mask); 1003 ew32(IMS, mask);
1004 ew32(ICS, mask); 1004 ew32(ICS, mask);
1005 msleep(10); 1005 usleep_range(10000, 20000);
1006 1006
1007 if (!(adapter->test_icr & mask)) { 1007 if (!(adapter->test_icr & mask)) {
1008 *data = 4; 1008 *data = 4;
@@ -1020,7 +1020,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
1020 adapter->test_icr = 0; 1020 adapter->test_icr = 0;
1021 ew32(IMC, ~mask & 0x00007FFF); 1021 ew32(IMC, ~mask & 0x00007FFF);
1022 ew32(ICS, ~mask & 0x00007FFF); 1022 ew32(ICS, ~mask & 0x00007FFF);
1023 msleep(10); 1023 usleep_range(10000, 20000);
1024 1024
1025 if (adapter->test_icr) { 1025 if (adapter->test_icr) {
1026 *data = 5; 1026 *data = 5;
@@ -1031,7 +1031,7 @@ static int e1000_intr_test(struct e1000_adapter *adapter, u64 *data)
1031 1031
1032 /* Disable all the interrupts */ 1032 /* Disable all the interrupts */
1033 ew32(IMC, 0xFFFFFFFF); 1033 ew32(IMC, 0xFFFFFFFF);
1034 msleep(10); 1034 usleep_range(10000, 20000);
1035 1035
1036 /* Unhook test interrupt handler */ 1036 /* Unhook test interrupt handler */
1037 free_irq(irq, netdev); 1037 free_irq(irq, netdev);
@@ -1406,7 +1406,7 @@ static int e1000_set_82571_fiber_loopback(struct e1000_adapter *adapter)
1406 */ 1406 */
1407#define E1000_SERDES_LB_ON 0x410 1407#define E1000_SERDES_LB_ON 0x410
1408 ew32(SCTL, E1000_SERDES_LB_ON); 1408 ew32(SCTL, E1000_SERDES_LB_ON);
1409 msleep(10); 1409 usleep_range(10000, 20000);
1410 1410
1411 return 0; 1411 return 0;
1412} 1412}
@@ -1501,7 +1501,7 @@ static void e1000_loopback_cleanup(struct e1000_adapter *adapter)
1501 hw->phy.media_type == e1000_media_type_internal_serdes) { 1501 hw->phy.media_type == e1000_media_type_internal_serdes) {
1502#define E1000_SERDES_LB_OFF 0x400 1502#define E1000_SERDES_LB_OFF 0x400
1503 ew32(SCTL, E1000_SERDES_LB_OFF); 1503 ew32(SCTL, E1000_SERDES_LB_OFF);
1504 msleep(10); 1504 usleep_range(10000, 20000);
1505 break; 1505 break;
1506 } 1506 }
1507 /* Fall Through */ 1507 /* Fall Through */
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index ce1dbfdca112..06ff884bc2c7 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -338,7 +338,7 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw)
338 /* Ungate automatic PHY configuration on non-managed 82579 */ 338 /* Ungate automatic PHY configuration on non-managed 82579 */
339 if ((hw->mac.type == e1000_pch2lan) && 339 if ((hw->mac.type == e1000_pch2lan) &&
340 !(fwsm & E1000_ICH_FWSM_FW_VALID)) { 340 !(fwsm & E1000_ICH_FWSM_FW_VALID)) {
341 msleep(10); 341 usleep_range(10000, 20000);
342 e1000_gate_hw_phy_config_ich8lan(hw, false); 342 e1000_gate_hw_phy_config_ich8lan(hw, false);
343 } 343 }
344 344
@@ -427,7 +427,7 @@ static s32 e1000_init_phy_params_ich8lan(struct e1000_hw *hw)
427 phy->id = 0; 427 phy->id = 0;
428 while ((e1000_phy_unknown == e1000e_get_phy_type_from_id(phy->id)) && 428 while ((e1000_phy_unknown == e1000e_get_phy_type_from_id(phy->id)) &&
429 (i++ < 100)) { 429 (i++ < 100)) {
430 msleep(1); 430 usleep_range(1000, 2000);
431 ret_val = e1000e_get_phy_id(hw); 431 ret_val = e1000e_get_phy_id(hw);
432 if (ret_val) 432 if (ret_val)
433 return ret_val; 433 return ret_val;
@@ -1704,7 +1704,7 @@ static s32 e1000_post_phy_reset_ich8lan(struct e1000_hw *hw)
1704 goto out; 1704 goto out;
1705 1705
1706 /* Allow time for h/w to get to quiescent state after reset */ 1706 /* Allow time for h/w to get to quiescent state after reset */
1707 msleep(10); 1707 usleep_range(10000, 20000);
1708 1708
1709 /* Perform any necessary post-reset workarounds */ 1709 /* Perform any necessary post-reset workarounds */
1710 switch (hw->mac.type) { 1710 switch (hw->mac.type) {
@@ -1737,7 +1737,7 @@ static s32 e1000_post_phy_reset_ich8lan(struct e1000_hw *hw)
1737 if (hw->mac.type == e1000_pch2lan) { 1737 if (hw->mac.type == e1000_pch2lan) {
1738 /* Ungate automatic PHY configuration on non-managed 82579 */ 1738 /* Ungate automatic PHY configuration on non-managed 82579 */
1739 if (!(er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) { 1739 if (!(er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) {
1740 msleep(10); 1740 usleep_range(10000, 20000);
1741 e1000_gate_hw_phy_config_ich8lan(hw, false); 1741 e1000_gate_hw_phy_config_ich8lan(hw, false);
1742 } 1742 }
1743 1743
@@ -2532,7 +2532,7 @@ release:
2532 */ 2532 */
2533 if (!ret_val) { 2533 if (!ret_val) {
2534 e1000e_reload_nvm(hw); 2534 e1000e_reload_nvm(hw);
2535 msleep(10); 2535 usleep_range(10000, 20000);
2536 } 2536 }
2537 2537
2538out: 2538out:
@@ -3009,7 +3009,7 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
3009 ew32(TCTL, E1000_TCTL_PSP); 3009 ew32(TCTL, E1000_TCTL_PSP);
3010 e1e_flush(); 3010 e1e_flush();
3011 3011
3012 msleep(10); 3012 usleep_range(10000, 20000);
3013 3013
3014 /* Workaround for ICH8 bit corruption issue in FIFO memory */ 3014 /* Workaround for ICH8 bit corruption issue in FIFO memory */
3015 if (hw->mac.type == e1000_ich8lan) { 3015 if (hw->mac.type == e1000_ich8lan) {
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c
index 96921de5df2e..30ef8fa4968c 100644
--- a/drivers/net/e1000e/lib.c
+++ b/drivers/net/e1000e/lib.c
@@ -868,7 +868,7 @@ static s32 e1000_poll_fiber_serdes_link_generic(struct e1000_hw *hw)
868 * milliseconds even if the other end is doing it in SW). 868 * milliseconds even if the other end is doing it in SW).
869 */ 869 */
870 for (i = 0; i < FIBER_LINK_UP_LIMIT; i++) { 870 for (i = 0; i < FIBER_LINK_UP_LIMIT; i++) {
871 msleep(10); 871 usleep_range(10000, 20000);
872 status = er32(STATUS); 872 status = er32(STATUS);
873 if (status & E1000_STATUS_LU) 873 if (status & E1000_STATUS_LU)
874 break; 874 break;
@@ -930,7 +930,7 @@ s32 e1000e_setup_fiber_serdes_link(struct e1000_hw *hw)
930 930
931 ew32(CTRL, ctrl); 931 ew32(CTRL, ctrl);
932 e1e_flush(); 932 e1e_flush();
933 msleep(1); 933 usleep_range(1000, 2000);
934 934
935 /* 935 /*
936 * For these adapters, the SW definable pin 1 is set when the optics 936 * For these adapters, the SW definable pin 1 is set when the optics
@@ -1385,7 +1385,7 @@ s32 e1000e_get_auto_rd_done(struct e1000_hw *hw)
1385 while (i < AUTO_READ_DONE_TIMEOUT) { 1385 while (i < AUTO_READ_DONE_TIMEOUT) {
1386 if (er32(EECD) & E1000_EECD_AUTO_RD) 1386 if (er32(EECD) & E1000_EECD_AUTO_RD)
1387 break; 1387 break;
1388 msleep(1); 1388 usleep_range(1000, 2000);
1389 i++; 1389 i++;
1390 } 1390 }
1391 1391
@@ -2087,8 +2087,6 @@ s32 e1000e_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
2087 if (ret_val) 2087 if (ret_val)
2088 return ret_val; 2088 return ret_val;
2089 2089
2090 msleep(10);
2091
2092 while (widx < words) { 2090 while (widx < words) {
2093 u8 write_opcode = NVM_WRITE_OPCODE_SPI; 2091 u8 write_opcode = NVM_WRITE_OPCODE_SPI;
2094 2092
@@ -2132,7 +2130,7 @@ s32 e1000e_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
2132 } 2130 }
2133 } 2131 }
2134 2132
2135 msleep(10); 2133 usleep_range(10000, 20000);
2136 nvm->ops.release(hw); 2134 nvm->ops.release(hw);
2137 return 0; 2135 return 0;
2138} 2136}
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 506a0a0043b3..909c8de58c15 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -2902,7 +2902,7 @@ static void e1000_configure_rx(struct e1000_adapter *adapter)
2902 rctl = er32(RCTL); 2902 rctl = er32(RCTL);
2903 ew32(RCTL, rctl & ~E1000_RCTL_EN); 2903 ew32(RCTL, rctl & ~E1000_RCTL_EN);
2904 e1e_flush(); 2904 e1e_flush();
2905 msleep(10); 2905 usleep_range(10000, 20000);
2906 2906
2907 if (adapter->flags2 & FLAG2_DMA_BURST) { 2907 if (adapter->flags2 & FLAG2_DMA_BURST) {
2908 /* 2908 /*
@@ -3383,7 +3383,7 @@ void e1000e_down(struct e1000_adapter *adapter)
3383 ew32(TCTL, tctl); 3383 ew32(TCTL, tctl);
3384 /* flush both disables and wait for them to finish */ 3384 /* flush both disables and wait for them to finish */
3385 e1e_flush(); 3385 e1e_flush();
3386 msleep(10); 3386 usleep_range(10000, 20000);
3387 3387
3388 napi_disable(&adapter->napi); 3388 napi_disable(&adapter->napi);
3389 e1000_irq_disable(adapter); 3389 e1000_irq_disable(adapter);
@@ -3418,7 +3418,7 @@ void e1000e_reinit_locked(struct e1000_adapter *adapter)
3418{ 3418{
3419 might_sleep(); 3419 might_sleep();
3420 while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) 3420 while (test_and_set_bit(__E1000_RESETTING, &adapter->state))
3421 msleep(1); 3421 usleep_range(1000, 2000);
3422 e1000e_down(adapter); 3422 e1000e_down(adapter);
3423 e1000e_up(adapter); 3423 e1000e_up(adapter);
3424 clear_bit(__E1000_RESETTING, &adapter->state); 3424 clear_bit(__E1000_RESETTING, &adapter->state);
@@ -5028,7 +5028,7 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
5028 } 5028 }
5029 5029
5030 while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) 5030 while (test_and_set_bit(__E1000_RESETTING, &adapter->state))
5031 msleep(1); 5031 usleep_range(1000, 2000);
5032 /* e1000e_down -> e1000e_reset dependent on max_frame_size & mtu */ 5032 /* e1000e_down -> e1000e_reset dependent on max_frame_size & mtu */
5033 adapter->max_frame_size = max_frame; 5033 adapter->max_frame_size = max_frame;
5034 e_info("changing MTU from %d to %d\n", netdev->mtu, new_mtu); 5034 e_info("changing MTU from %d to %d\n", netdev->mtu, new_mtu);
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c
index 6ae31fcfb629..484774c13c21 100644
--- a/drivers/net/e1000e/phy.c
+++ b/drivers/net/e1000e/phy.c
@@ -2372,7 +2372,7 @@ s32 e1000e_determine_phy_address(struct e1000_hw *hw)
2372 ret_val = 0; 2372 ret_val = 0;
2373 goto out; 2373 goto out;
2374 } 2374 }
2375 msleep(1); 2375 usleep_range(1000, 2000);
2376 i++; 2376 i++;
2377 } while (i < 10); 2377 } while (i < 10);
2378 } 2378 }
@@ -2740,7 +2740,7 @@ void e1000_power_down_phy_copper(struct e1000_hw *hw)
2740 e1e_rphy(hw, PHY_CONTROL, &mii_reg); 2740 e1e_rphy(hw, PHY_CONTROL, &mii_reg);
2741 mii_reg |= MII_CR_POWER_DOWN; 2741 mii_reg |= MII_CR_POWER_DOWN;
2742 e1e_wphy(hw, PHY_CONTROL, mii_reg); 2742 e1e_wphy(hw, PHY_CONTROL, mii_reg);
2743 msleep(1); 2743 usleep_range(1000, 2000);
2744} 2744}
2745 2745
2746/** 2746/**