diff options
author | stephen hemminger <shemminger@vyatta.com> | 2011-04-04 08:43:42 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-06 14:30:07 -0700 |
commit | a5b9f41c228f93d368ab0f292d890ea7143ca5aa (patch) | |
tree | d3a6975c11f4d7933bb349b3bac0cd00b5b72840 | |
parent | 74e532ff3c634f20ee2eefe3f8f0083ea547c74c (diff) |
skge: implement set_phys_id
Implement set_phys_id led control on SysKonnect board.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/skge.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 35b28f42d20..e579ff7579a 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c @@ -786,28 +786,27 @@ static void skge_led(struct skge_port *skge, enum led_mode mode) } /* blink LED's for finding board */ -static int skge_phys_id(struct net_device *dev, u32 data) +static int skge_set_phys_id(struct net_device *dev, + enum ethtool_phys_id_state state) { struct skge_port *skge = netdev_priv(dev); - unsigned long ms; - enum led_mode mode = LED_MODE_TST; - if (!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ)) - ms = jiffies_to_msecs(MAX_SCHEDULE_TIMEOUT / HZ) * 1000; - else - ms = data * 1000; + switch (state) { + case ETHTOOL_ID_ACTIVE: + return -EINVAL; - while (ms > 0) { - skge_led(skge, mode); - mode ^= LED_MODE_TST; + case ETHTOOL_ID_ON: + skge_led(skge, LED_MODE_TST); + break; - if (msleep_interruptible(BLINK_MS)) - break; - ms -= BLINK_MS; - } + case ETHTOOL_ID_OFF: + skge_led(skge, LED_MODE_OFF); + break; - /* back to regular LED state */ - skge_led(skge, netif_running(dev) ? LED_MODE_ON : LED_MODE_OFF); + case ETHTOOL_ID_INACTIVE: + /* back to regular LED state */ + skge_led(skge, netif_running(dev) ? LED_MODE_ON : LED_MODE_OFF); + } return 0; } @@ -930,7 +929,7 @@ static const struct ethtool_ops skge_ethtool_ops = { .get_rx_csum = skge_get_rx_csum, .set_rx_csum = skge_set_rx_csum, .get_strings = skge_get_strings, - .phys_id = skge_phys_id, + .set_phys_id = skge_set_phys_id, .get_sset_count = skge_get_sset_count, .get_ethtool_stats = skge_get_ethtool_stats, }; |