Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

stephen hemminger and committed by
David S. Miller
7bc93714 9871acf6

+17 -13
+16 -13
drivers/net/niu.c
··· 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 } ··· 7935 7932 .get_strings = niu_get_strings, 7936 7933 .get_sset_count = niu_get_sset_count, 7937 7934 .get_ethtool_stats = niu_get_ethtool_stats, 7938 - .phys_id = niu_phys_id, 7935 + .set_phys_id = niu_set_phys_id, 7939 7936 .get_rxnfc = niu_get_nfc, 7940 7937 .set_rxnfc = niu_set_nfc, 7941 7938 .set_flags = niu_set_flags,
+1
drivers/net/niu.h
··· 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