aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/niu.c29
-rw-r--r--drivers/net/niu.h1
2 files changed, 17 insertions, 13 deletions
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 681a42ca5c51..ab4e7dd82d0b 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -7888,28 +7888,31 @@ static void niu_force_led(struct niu *np, int on)
7888 nw64_mac(reg, val); 7888 nw64_mac(reg, val);
7889} 7889}
7890 7890
7891static int niu_phys_id(struct net_device *dev, u32 data) 7891static int niu_set_phys_id(struct net_device *dev,
7892 enum ethtool_phys_id_state state)
7893
7892{ 7894{
7893 struct niu *np = netdev_priv(dev); 7895 struct niu *np = netdev_priv(dev);
7894 u64 orig_led_state;
7895 int i;
7896 7896
7897 if (!netif_running(dev)) 7897 if (!netif_running(dev))
7898 return -EAGAIN; 7898 return -EAGAIN;
7899 7899
7900 if (data == 0) 7900 switch (state) {
7901 data = 2; 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); 7905 case ETHTOOL_ID_ON:
7904 for (i = 0; i < (data * 2); i++) { 7906 niu_force_led(np, 1);
7905 int on = ((i % 2) == 0); 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)) 7913 case ETHTOOL_ID_INACTIVE:
7910 break; 7914 niu_led_state_restore(np, np->orig_led_state);
7911 } 7915 }
7912 niu_led_state_restore(np, orig_led_state);
7913 7916
7914 return 0; 7917 return 0;
7915} 7918}
@@ -7932,7 +7935,7 @@ static const struct ethtool_ops niu_ethtool_ops = {
7932 .get_strings = niu_get_strings, 7935 .get_strings = niu_get_strings,
7933 .get_sset_count = niu_get_sset_count, 7936 .get_sset_count = niu_get_sset_count,
7934 .get_ethtool_stats = niu_get_ethtool_stats, 7937 .get_ethtool_stats = niu_get_ethtool_stats,
7935 .phys_id = niu_phys_id, 7938 .set_phys_id = niu_set_phys_id,
7936 .get_rxnfc = niu_get_nfc, 7939 .get_rxnfc = niu_get_nfc,
7937 .set_rxnfc = niu_set_nfc, 7940 .set_rxnfc = niu_set_nfc,
7938 .set_flags = niu_set_flags, 7941 .set_flags = niu_set_flags,
diff --git a/drivers/net/niu.h b/drivers/net/niu.h
index a41fa8ebe05f..51e177e1860d 100644
--- a/drivers/net/niu.h
+++ b/drivers/net/niu.h
@@ -3279,6 +3279,7 @@ struct niu {
3279 unsigned long xpcs_off; 3279 unsigned long xpcs_off;
3280 3280
3281 struct timer_list timer; 3281 struct timer_list timer;
3282 u64 orig_led_state;
3282 const struct niu_phy_ops *phy_ops; 3283 const struct niu_phy_ops *phy_ops;
3283 int phy_addr; 3284 int phy_addr;
3284 3285