aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000
diff options
context:
space:
mode:
authorJeff Kirsher <jeffrey.t.kirsher@intel.com>2011-05-03 01:26:13 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2011-05-07 06:10:13 -0400
commit6435909199c2d1b0aad3ebbfa01f641aaa24fa2a (patch)
treeec6019d5709213e8d06f120f9f0bb45486493760 /drivers/net/e1000
parenta70b86ae206fdd3bef13c5ac148c22a805e83896 (diff)
e1000: convert to set_phys_id
Based on the original patch from Stephen Hemminger. Convert to new LED control infrastucture and remove no longer necessary bits. CC: Stephen Hemminger <shemminger@vyatta.com> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/e1000')
-rw-r--r--drivers/net/e1000/e1000.h3
-rw-r--r--drivers/net/e1000/e1000_ethtool.c50
2 files changed, 16 insertions, 37 deletions
diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
index b1b23ddd4eed..8676899120c3 100644
--- a/drivers/net/e1000/e1000.h
+++ b/drivers/net/e1000/e1000.h
@@ -238,9 +238,6 @@ struct e1000_adapter {
238 struct work_struct reset_task; 238 struct work_struct reset_task;
239 u8 fc_autoneg; 239 u8 fc_autoneg;
240 240
241 struct timer_list blink_timer;
242 unsigned long led_status;
243
244 /* TX */ 241 /* TX */
245 struct e1000_tx_ring *tx_ring; /* One per active queue */ 242 struct e1000_tx_ring *tx_ring; /* One per active queue */
246 unsigned int restart_queue; 243 unsigned int restart_queue;
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index 4fa727ce8374..ec0fa426cce2 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -1755,46 +1755,28 @@ static int e1000_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
1755 return 0; 1755 return 0;
1756} 1756}
1757 1757
1758/* toggle LED 4 times per second = 2 "blinks" per second */ 1758static int e1000_set_phys_id(struct net_device *netdev,
1759#define E1000_ID_INTERVAL (HZ/4) 1759 enum ethtool_phys_id_state state)
1760
1761/* bit defines for adapter->led_status */
1762#define E1000_LED_ON 0
1763
1764static void e1000_led_blink_callback(unsigned long data)
1765{ 1760{
1766 struct e1000_adapter *adapter = (struct e1000_adapter *) data; 1761 struct e1000_adapter *adapter = netdev_priv(netdev);
1767 struct e1000_hw *hw = &adapter->hw; 1762 struct e1000_hw *hw = &adapter->hw;
1768 1763
1769 if (test_and_change_bit(E1000_LED_ON, &adapter->led_status)) 1764 switch (state) {
1770 e1000_led_off(hw); 1765 case ETHTOOL_ID_ACTIVE:
1771 else 1766 e1000_setup_led(hw);
1772 e1000_led_on(hw); 1767 return 2;
1773
1774 mod_timer(&adapter->blink_timer, jiffies + E1000_ID_INTERVAL);
1775}
1776 1768
1777static int e1000_phys_id(struct net_device *netdev, u32 data) 1769 case ETHTOOL_ID_ON:
1778{ 1770 e1000_led_on(hw);
1779 struct e1000_adapter *adapter = netdev_priv(netdev); 1771 break;
1780 struct e1000_hw *hw = &adapter->hw;
1781 1772
1782 if (!data) 1773 case ETHTOOL_ID_OFF:
1783 data = INT_MAX; 1774 e1000_led_off(hw);
1775 break;
1784 1776
1785 if (!adapter->blink_timer.function) { 1777 case ETHTOOL_ID_INACTIVE:
1786 init_timer(&adapter->blink_timer); 1778 e1000_cleanup_led(hw);
1787 adapter->blink_timer.function = e1000_led_blink_callback;
1788 adapter->blink_timer.data = (unsigned long)adapter;
1789 } 1779 }
1790 e1000_setup_led(hw);
1791 mod_timer(&adapter->blink_timer, jiffies);
1792 msleep_interruptible(data * 1000);
1793 del_timer_sync(&adapter->blink_timer);
1794
1795 e1000_led_off(hw);
1796 clear_bit(E1000_LED_ON, &adapter->led_status);
1797 e1000_cleanup_led(hw);
1798 1780
1799 return 0; 1781 return 0;
1800} 1782}
@@ -1931,7 +1913,7 @@ static const struct ethtool_ops e1000_ethtool_ops = {
1931 .set_tso = e1000_set_tso, 1913 .set_tso = e1000_set_tso,
1932 .self_test = e1000_diag_test, 1914 .self_test = e1000_diag_test,
1933 .get_strings = e1000_get_strings, 1915 .get_strings = e1000_get_strings,
1934 .phys_id = e1000_phys_id, 1916 .set_phys_id = e1000_set_phys_id,
1935 .get_ethtool_stats = e1000_get_ethtool_stats, 1917 .get_ethtool_stats = e1000_get_ethtool_stats,
1936 .get_sset_count = e1000_get_sset_count, 1918 .get_sset_count = e1000_get_sset_count,
1937 .get_coalesce = e1000_get_coalesce, 1919 .get_coalesce = e1000_get_coalesce,