diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2008-10-31 19:52:04 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-11-02 08:00:15 -0500 |
commit | e053b628d367cd7b39ae2c4bb0124edc2e058a41 (patch) | |
tree | e5a5c6ae57e55185f92ea6f453a70a32663b6dbf /drivers/net/atlx | |
parent | 02e7173149c3ffcf963075ec2bdc5f7be8335a78 (diff) |
atlx: timer cleanup
Do some cleanup on timer usage in this driver:
* Use round_jiffies to align wakeups and reduce power.
* Remove atl1_watchdog which does nothing but rearm itself
* Use setup_timer() function
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/atlx')
-rw-r--r-- | drivers/net/atlx/atl1.c | 25 | ||||
-rw-r--r-- | drivers/net/atlx/atl1.h | 2 | ||||
-rw-r--r-- | drivers/net/atlx/atl2.c | 8 |
3 files changed, 10 insertions, 25 deletions
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c index 6cc47616b6d4..3836e625ba58 100644 --- a/drivers/net/atlx/atl1.c +++ b/drivers/net/atlx/atl1.c | |||
@@ -1390,7 +1390,8 @@ static u32 atl1_check_link(struct atl1_adapter *adapter) | |||
1390 | /* auto-neg, insert timer to re-config phy */ | 1390 | /* auto-neg, insert timer to re-config phy */ |
1391 | if (!adapter->phy_timer_pending) { | 1391 | if (!adapter->phy_timer_pending) { |
1392 | adapter->phy_timer_pending = true; | 1392 | adapter->phy_timer_pending = true; |
1393 | mod_timer(&adapter->phy_config_timer, jiffies + 3 * HZ); | 1393 | mod_timer(&adapter->phy_config_timer, |
1394 | round_jiffies(jiffies + 3 * HZ)); | ||
1394 | } | 1395 | } |
1395 | 1396 | ||
1396 | return 0; | 1397 | return 0; |
@@ -2525,17 +2526,6 @@ static irqreturn_t atl1_intr(int irq, void *data) | |||
2525 | return IRQ_HANDLED; | 2526 | return IRQ_HANDLED; |
2526 | } | 2527 | } |
2527 | 2528 | ||
2528 | /* | ||
2529 | * atl1_watchdog - Timer Call-back | ||
2530 | * @data: pointer to netdev cast into an unsigned long | ||
2531 | */ | ||
2532 | static void atl1_watchdog(unsigned long data) | ||
2533 | { | ||
2534 | struct atl1_adapter *adapter = (struct atl1_adapter *)data; | ||
2535 | |||
2536 | /* Reset the timer */ | ||
2537 | mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); | ||
2538 | } | ||
2539 | 2529 | ||
2540 | /* | 2530 | /* |
2541 | * atl1_phy_config - Timer Call-back | 2531 | * atl1_phy_config - Timer Call-back |
@@ -2608,7 +2598,6 @@ static s32 atl1_up(struct atl1_adapter *adapter) | |||
2608 | if (unlikely(err)) | 2598 | if (unlikely(err)) |
2609 | goto err_up; | 2599 | goto err_up; |
2610 | 2600 | ||
2611 | mod_timer(&adapter->watchdog_timer, jiffies); | ||
2612 | atlx_irq_enable(adapter); | 2601 | atlx_irq_enable(adapter); |
2613 | atl1_check_link(adapter); | 2602 | atl1_check_link(adapter); |
2614 | netif_start_queue(netdev); | 2603 | netif_start_queue(netdev); |
@@ -2626,7 +2615,6 @@ static void atl1_down(struct atl1_adapter *adapter) | |||
2626 | struct net_device *netdev = adapter->netdev; | 2615 | struct net_device *netdev = adapter->netdev; |
2627 | 2616 | ||
2628 | netif_stop_queue(netdev); | 2617 | netif_stop_queue(netdev); |
2629 | del_timer_sync(&adapter->watchdog_timer); | ||
2630 | del_timer_sync(&adapter->phy_config_timer); | 2618 | del_timer_sync(&adapter->phy_config_timer); |
2631 | adapter->phy_timer_pending = false; | 2619 | adapter->phy_timer_pending = false; |
2632 | 2620 | ||
@@ -3050,13 +3038,8 @@ static int __devinit atl1_probe(struct pci_dev *pdev, | |||
3050 | netif_carrier_off(netdev); | 3038 | netif_carrier_off(netdev); |
3051 | netif_stop_queue(netdev); | 3039 | netif_stop_queue(netdev); |
3052 | 3040 | ||
3053 | init_timer(&adapter->watchdog_timer); | 3041 | setup_timer(&adapter->phy_config_timer, &atl1_phy_config, |
3054 | adapter->watchdog_timer.function = &atl1_watchdog; | 3042 | (unsigned long)adapter); |
3055 | adapter->watchdog_timer.data = (unsigned long)adapter; | ||
3056 | |||
3057 | init_timer(&adapter->phy_config_timer); | ||
3058 | adapter->phy_config_timer.function = &atl1_phy_config; | ||
3059 | adapter->phy_config_timer.data = (unsigned long)adapter; | ||
3060 | adapter->phy_timer_pending = false; | 3043 | adapter->phy_timer_pending = false; |
3061 | 3044 | ||
3062 | INIT_WORK(&adapter->tx_timeout_task, atl1_tx_timeout_task); | 3045 | INIT_WORK(&adapter->tx_timeout_task, atl1_tx_timeout_task); |
diff --git a/drivers/net/atlx/atl1.h b/drivers/net/atlx/atl1.h index 324ef5e93412..146372fd6683 100644 --- a/drivers/net/atlx/atl1.h +++ b/drivers/net/atlx/atl1.h | |||
@@ -765,7 +765,7 @@ struct atl1_adapter { | |||
765 | struct work_struct tx_timeout_task; | 765 | struct work_struct tx_timeout_task; |
766 | struct work_struct link_chg_task; | 766 | struct work_struct link_chg_task; |
767 | struct work_struct pcie_dma_to_rst_task; | 767 | struct work_struct pcie_dma_to_rst_task; |
768 | struct timer_list watchdog_timer; | 768 | |
769 | struct timer_list phy_config_timer; | 769 | struct timer_list phy_config_timer; |
770 | bool phy_timer_pending; | 770 | bool phy_timer_pending; |
771 | 771 | ||
diff --git a/drivers/net/atlx/atl2.c b/drivers/net/atlx/atl2.c index 8c5d009ca821..21ca6dd78b18 100644 --- a/drivers/net/atlx/atl2.c +++ b/drivers/net/atlx/atl2.c | |||
@@ -724,7 +724,7 @@ static int atl2_open(struct net_device *netdev) | |||
724 | 724 | ||
725 | clear_bit(__ATL2_DOWN, &adapter->flags); | 725 | clear_bit(__ATL2_DOWN, &adapter->flags); |
726 | 726 | ||
727 | mod_timer(&adapter->watchdog_timer, jiffies + 4*HZ); | 727 | mod_timer(&adapter->watchdog_timer, round_jiffies(jiffies + 4*HZ)); |
728 | 728 | ||
729 | val = ATL2_READ_REG(&adapter->hw, REG_MASTER_CTRL); | 729 | val = ATL2_READ_REG(&adapter->hw, REG_MASTER_CTRL); |
730 | ATL2_WRITE_REG(&adapter->hw, REG_MASTER_CTRL, | 730 | ATL2_WRITE_REG(&adapter->hw, REG_MASTER_CTRL, |
@@ -1051,7 +1051,8 @@ static void atl2_watchdog(unsigned long data) | |||
1051 | adapter->netdev->stats.rx_over_errors += drop_rxd + drop_rxs; | 1051 | adapter->netdev->stats.rx_over_errors += drop_rxd + drop_rxs; |
1052 | 1052 | ||
1053 | /* Reset the timer */ | 1053 | /* Reset the timer */ |
1054 | mod_timer(&adapter->watchdog_timer, jiffies + 4 * HZ); | 1054 | mod_timer(&adapter->watchdog_timer, |
1055 | round_jiffies(jiffies + 4 * HZ)); | ||
1055 | } | 1056 | } |
1056 | } | 1057 | } |
1057 | 1058 | ||
@@ -1255,7 +1256,8 @@ static int atl2_check_link(struct atl2_adapter *adapter) | |||
1255 | * (if interval smaller than 5 seconds, something strange) */ | 1256 | * (if interval smaller than 5 seconds, something strange) */ |
1256 | if (!test_bit(__ATL2_DOWN, &adapter->flags)) { | 1257 | if (!test_bit(__ATL2_DOWN, &adapter->flags)) { |
1257 | if (!test_and_set_bit(0, &adapter->cfg_phy)) | 1258 | if (!test_and_set_bit(0, &adapter->cfg_phy)) |
1258 | mod_timer(&adapter->phy_config_timer, jiffies + 5 * HZ); | 1259 | mod_timer(&adapter->phy_config_timer, |
1260 | round_jiffies(jiffies + 5 * HZ)); | ||
1259 | } | 1261 | } |
1260 | 1262 | ||
1261 | return 0; | 1263 | return 0; |