netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: David Miller <davem@davemloft.net>
Cc: netdev <netdev@vger.kernel.org>,
	linux-net-drivers@solarflare.com,
	"Stephen Hemminger" <shemminger@vyatta.com>,
	"Michał Mirosław" <mirqus@gmail.com>
Subject: [PATCH net-next-2.6 6/6] sfc: Implement ethtool_ops::set_phys_id instead of ethtool_ops::phys_id
Date: Sun, 03 Apr 2011 20:55:04 +0100	[thread overview]
Message-ID: <1301860504.2935.31.camel@localhost> (raw)
In-Reply-To: <1301859889.2935.23.camel@localhost>

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
 drivers/net/sfc/ethtool.c |   28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/drivers/net/sfc/ethtool.c b/drivers/net/sfc/ethtool.c
index 0d55439..644f7c1 100644
--- a/drivers/net/sfc/ethtool.c
+++ b/drivers/net/sfc/ethtool.c
@@ -178,19 +178,27 @@ static struct efx_ethtool_stat efx_ethtool_stats[] = {
  */
 
 /* Identify device by flashing LEDs */
-static int efx_ethtool_phys_id(struct net_device *net_dev, u32 count)
+static int efx_ethtool_phys_id(struct net_device *net_dev,
+			       enum ethtool_phys_id_state state)
 {
 	struct efx_nic *efx = netdev_priv(net_dev);
+	enum efx_led_mode mode;
 
-	do {
-		efx->type->set_id_led(efx, EFX_LED_ON);
-		schedule_timeout_interruptible(HZ / 2);
-
-		efx->type->set_id_led(efx, EFX_LED_OFF);
-		schedule_timeout_interruptible(HZ / 2);
-	} while (!signal_pending(current) && --count != 0);
+	switch (state) {
+	case ETHTOOL_ID_ON:
+		mode = EFX_LED_ON;
+		break;
+	case ETHTOOL_ID_OFF:
+		mode = EFX_LED_OFF;
+		break;
+	case ETHTOOL_ID_INACTIVE:
+		mode = EFX_LED_DEFAULT;
+		break;
+	default:
+		return -EINVAL;
+	}
 
-	efx->type->set_id_led(efx, EFX_LED_DEFAULT);
+	efx->type->set_id_led(efx, mode);
 	return 0;
 }
 
@@ -1007,7 +1015,7 @@ const struct ethtool_ops efx_ethtool_ops = {
 	.get_sset_count		= efx_ethtool_get_sset_count,
 	.self_test		= efx_ethtool_self_test,
 	.get_strings		= efx_ethtool_get_strings,
-	.phys_id		= efx_ethtool_phys_id,
+	.set_phys_id		= efx_ethtool_phys_id,
 	.get_ethtool_stats	= efx_ethtool_get_stats,
 	.get_wol                = efx_ethtool_get_wol,
 	.set_wol                = efx_ethtool_set_wol,
-- 
1.5.4


-- 
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


  parent reply	other threads:[~2011-04-03 19:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-03 19:44 pull request: sfc-next-2.6 2011-04-03 Ben Hutchings
2011-04-03 19:50 ` [PATCH net-next-2.6 1/6] sfc: Move test of rx_checksum_enabled from nic.c to rx.c Ben Hutchings
2011-04-03 19:51 ` [PATCH net-next-2.6 2/6] sfc: Implement generic features interface Ben Hutchings
2011-04-03 20:13   ` Michał Mirosław
2011-04-03 20:27     ` Ben Hutchings
2011-04-03 20:50   ` Michał Mirosław
2011-04-03 19:51 ` [PATCH net-next-2.6 3/6] ethtool: Convert struct ethtool_ops comment to kernel-doc format Ben Hutchings
2011-04-03 19:52 ` [PATCH net-next-2.6 4/6] ethtool: Fill out and update comment for struct ethtool_ops Ben Hutchings
2011-04-03 21:25   ` Michał Mirosław
2011-04-03 21:36     ` Ben Hutchings
2011-04-03 19:53 ` [PATCH net-next-2.6 5/6] ethtool: Change ETHTOOL_PHYS_ID implementation to allow dropping RTNL Ben Hutchings
2011-04-04 23:26   ` Ben Hutchings
2011-04-05  1:01     ` Stephen Hemminger
2011-04-05 20:21       ` Ben Hutchings
2011-04-03 19:55 ` Ben Hutchings [this message]
2011-04-04  0:50 ` pull request: sfc-next-2.6 2011-04-03 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=1301860504.2935.31.camel@localhost \
    --to=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=linux-net-drivers@solarflare.com \
    --cc=mirqus@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.com \
    /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).