Commit 7bc93714042418cbc4ca89c51d3ab448ea3ef2fe

Authored by stephen hemminger
Committed by David S. Miller
1 parent 9871acf67c

niu: convert to new ethtool set_phys_id

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 2 changed files with 17 additions and 13 deletions Side-by-side Diff

... ... @@ -7888,28 +7888,31 @@
7888 7888 nw64_mac(reg, val);
7889 7889 }
7890 7890  
7891   -static int niu_phys_id(struct net_device *dev, u32 data)
  7891 +static int niu_set_phys_id(struct net_device *dev,
  7892 + enum ethtool_phys_id_state state)
  7893 +
7892 7894 {
7893 7895 struct niu *np = netdev_priv(dev);
7894   - u64 orig_led_state;
7895   - int i;
7896 7896  
7897 7897 if (!netif_running(dev))
7898 7898 return -EAGAIN;
7899 7899  
7900   - if (data == 0)
7901   - data = 2;
  7900 + switch (state) {
  7901 + case ETHTOOL_ID_ACTIVE:
  7902 + np->orig_led_state = niu_led_state_save(np);
  7903 + return -EINVAL;
7902 7904  
7903   - orig_led_state = niu_led_state_save(np);
7904   - for (i = 0; i < (data * 2); i++) {
7905   - int on = ((i % 2) == 0);
  7905 + case ETHTOOL_ID_ON:
  7906 + niu_force_led(np, 1);
  7907 + break;
7906 7908  
7907   - niu_force_led(np, on);
  7909 + case ETHTOOL_ID_OFF:
  7910 + niu_force_led(np, 0);
  7911 + break;
7908 7912  
7909   - if (msleep_interruptible(500))
7910   - break;
  7913 + case ETHTOOL_ID_INACTIVE:
  7914 + niu_led_state_restore(np, np->orig_led_state);
7911 7915 }
7912   - niu_led_state_restore(np, orig_led_state);
7913 7916  
7914 7917 return 0;
7915 7918 }
... ... @@ -7932,7 +7935,7 @@
7932 7935 .get_strings = niu_get_strings,
7933 7936 .get_sset_count = niu_get_sset_count,
7934 7937 .get_ethtool_stats = niu_get_ethtool_stats,
7935   - .phys_id = niu_phys_id,
  7938 + .set_phys_id = niu_set_phys_id,
7936 7939 .get_rxnfc = niu_get_nfc,
7937 7940 .set_rxnfc = niu_set_nfc,
7938 7941 .set_flags = niu_set_flags,
... ... @@ -3279,6 +3279,7 @@
3279 3279 unsigned long xpcs_off;
3280 3280  
3281 3281 struct timer_list timer;
  3282 + u64 orig_led_state;
3282 3283 const struct niu_phy_ops *phy_ops;
3283 3284 int phy_addr;
3284 3285