diff options
author | stephen hemminger <shemminger@vyatta.com> | 2011-04-04 04:43:41 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-06 17:30:06 -0400 |
commit | 74e532ff3c634f20ee2eefe3f8f0083ea547c74c (patch) | |
tree | f8dd98ac163fc0ed11fffa31f0d35f8ad5fb5525 | |
parent | 191350e7887aa6d843f1097fc1de06cb59eb6ac1 (diff) |
sky2: support ethtool set_phys_id
Use ethtool set_phys_id to control LED. Fixes issues with RTNL being
held for extended periods.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/sky2.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 2a91868788f7..afc925a340d1 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -3826,23 +3826,24 @@ static void sky2_led(struct sky2_port *sky2, enum led_mode mode) | |||
3826 | } | 3826 | } |
3827 | 3827 | ||
3828 | /* blink LED's for finding board */ | 3828 | /* blink LED's for finding board */ |
3829 | static int sky2_phys_id(struct net_device *dev, u32 data) | 3829 | static int sky2_set_phys_id(struct net_device *dev, |
3830 | enum ethtool_phys_id_state state) | ||
3830 | { | 3831 | { |
3831 | struct sky2_port *sky2 = netdev_priv(dev); | 3832 | struct sky2_port *sky2 = netdev_priv(dev); |
3832 | unsigned int i; | ||
3833 | |||
3834 | if (data == 0) | ||
3835 | data = UINT_MAX; | ||
3836 | 3833 | ||
3837 | for (i = 0; i < data; i++) { | 3834 | switch (state) { |
3835 | case ETHTOOL_ID_ACTIVE: | ||
3836 | return -EINVAL; | ||
3837 | case ETHTOOL_ID_INACTIVE: | ||
3838 | sky2_led(sky2, MO_LED_NORM); | ||
3839 | break; | ||
3840 | case ETHTOOL_ID_ON: | ||
3838 | sky2_led(sky2, MO_LED_ON); | 3841 | sky2_led(sky2, MO_LED_ON); |
3839 | if (msleep_interruptible(500)) | 3842 | break; |
3840 | break; | 3843 | case ETHTOOL_ID_OFF: |
3841 | sky2_led(sky2, MO_LED_OFF); | 3844 | sky2_led(sky2, MO_LED_OFF); |
3842 | if (msleep_interruptible(500)) | 3845 | break; |
3843 | break; | ||
3844 | } | 3846 | } |
3845 | sky2_led(sky2, MO_LED_NORM); | ||
3846 | 3847 | ||
3847 | return 0; | 3848 | return 0; |
3848 | } | 3849 | } |
@@ -4269,7 +4270,7 @@ static const struct ethtool_ops sky2_ethtool_ops = { | |||
4269 | .set_ringparam = sky2_set_ringparam, | 4270 | .set_ringparam = sky2_set_ringparam, |
4270 | .get_pauseparam = sky2_get_pauseparam, | 4271 | .get_pauseparam = sky2_get_pauseparam, |
4271 | .set_pauseparam = sky2_set_pauseparam, | 4272 | .set_pauseparam = sky2_set_pauseparam, |
4272 | .phys_id = sky2_phys_id, | 4273 | .set_phys_id = sky2_set_phys_id, |
4273 | .get_sset_count = sky2_get_sset_count, | 4274 | .get_sset_count = sky2_get_sset_count, |
4274 | .get_ethtool_stats = sky2_get_ethtool_stats, | 4275 | .get_ethtool_stats = sky2_get_ethtool_stats, |
4275 | .set_flags = sky2_set_flags, | 4276 | .set_flags = sky2_set_flags, |