From: Stephen Hemminger <shemminger@vyatta.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: Ben Hutchings <bhutchings@solarflare.com>, netdev@vger.kernel.org
Subject: [PATCH 5/8] niu: convert to new ethtool set_phys_id
Date: Mon, 4 Apr 2011 15:31:19 -0700 [thread overview]
Message-ID: <20110404153119.29c02c9c@nehalam> (raw)
In-Reply-To: <20110404210805.696664557@linuxplumber.net>
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
---
Sorry for mangled version..
drivers/net/niu.c | 33 ++++++++++++++++++---------------
drivers/net/niu.h | 1 +
2 files changed, 19 insertions(+), 15 deletions(-)
--- a/drivers/net/niu.c 2011-04-04 13:15:46.805340164 -0700
+++ b/drivers/net/niu.c 2011-04-04 13:19:17.551610508 -0700
@@ -7888,28 +7888,31 @@ static void niu_force_led(struct niu *np
nw64_mac(reg, val);
}
-static int niu_phys_id(struct net_device *dev, u32 data)
+static int niu_set_phys_id(struct net_device *dev,
+ enum ethtool_phys_id_state state)
+
{
struct niu *np = netdev_priv(dev);
- u64 orig_led_state;
- int i;
if (!netif_running(dev))
return -EAGAIN;
- if (data == 0)
- data = 2;
-
- orig_led_state = niu_led_state_save(np);
- for (i = 0; i < (data * 2); i++) {
- int on = ((i % 2) == 0);
-
- niu_force_led(np, on);
+ switch (state) {
+ case ETHTOOL_ID_ACTIVE:
+ np->orig_led_state = niu_led_state_save(np);
+ return -EINVAL;
+
+ case ETHTOOL_ID_ON:
+ niu_force_led(np, 1);
+ break;
+
+ case ETHTOOL_ID_OFF:
+ niu_force_led(np, 0);
+ break;
- if (msleep_interruptible(500))
- break;
+ case ETHTOOL_ID_INACTIVE:
+ niu_led_state_restore(np, np->orig_led_state);
}
- niu_led_state_restore(np, orig_led_state);
return 0;
}
@@ -7932,7 +7935,7 @@ static const struct ethtool_ops niu_etht
.get_strings = niu_get_strings,
.get_sset_count = niu_get_sset_count,
.get_ethtool_stats = niu_get_ethtool_stats,
- .phys_id = niu_phys_id,
+ .set_phys_id = niu_set_phys_id,
.get_rxnfc = niu_get_nfc,
.set_rxnfc = niu_set_nfc,
.set_flags = niu_set_flags,
--- a/drivers/net/niu.h 2011-04-04 13:16:37.445885085 -0700
+++ b/drivers/net/niu.h 2011-04-04 13:17:27.034418897 -0700
@@ -3279,6 +3279,7 @@ struct niu {
unsigned long xpcs_off;
struct timer_list timer;
+ u64 orig_led_state;
const struct niu_phy_ops *phy_ops;
int phy_addr;
next prev parent reply other threads:[~2011-04-04 22:31 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-04 21:06 [PATCH 0/8] Convert even more drivers to set_phys_id Stephen Hemminger
2011-04-04 21:06 ` [PATCH 1/8] vxge: convert " Stephen Hemminger
2011-04-06 21:36 ` David Miller
2011-04-04 21:06 ` [PATCH 2/8] bnx2: " Stephen Hemminger
2011-04-06 21:36 ` David Miller
2011-04-04 21:06 ` [PATCH 3/8] bnx2x: " Stephen Hemminger
2011-04-06 21:36 ` David Miller
2011-04-04 21:06 ` [PATCH 4/8] s2io: " Stephen Hemminger
2011-04-04 23:17 ` Ben Hutchings
2011-04-05 1:08 ` Stephen Hemminger
2011-04-05 1:09 ` [PATCH 4/8] s2io: convert to set_phys_id (v2) Stephen Hemminger
2011-04-06 21:36 ` [PATCH 4/8] s2io: convert to set_phys_id David Miller
2011-04-04 21:06 ` [PATCH 5/8] --- drivers/net/niu.c | 33 ++++++++++++++++++--------------- drivers/net/niu.h | 1 + 2 files changed, 19 insertions(+), 15 deletions(-) Stephen Hemminger
2011-04-04 22:31 ` Stephen Hemminger [this message]
2011-04-06 21:36 ` [PATCH 5/8] niu: convert to new ethtool set_phys_id David Miller
2011-04-04 21:06 ` [PATCH 6/8] benet: convert to set_phys_id Stephen Hemminger
2011-04-04 22:32 ` Ajit.Khaparde
2011-04-06 21:36 ` David Miller
2011-04-04 21:06 ` [PATCH 7/8] pcnet32: " Stephen Hemminger
2011-04-06 21:36 ` David Miller
2011-04-04 21:06 ` [PATCH 8/8] ewrk3: " Stephen Hemminger
2011-04-04 23:21 ` Ben Hutchings
2011-04-06 21:37 ` David Miller
2011-04-06 21:58 ` Stephen Hemminger
2011-04-06 22:06 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110404153119.29c02c9c@nehalam \
--to=shemminger@vyatta.com \
--cc=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).