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@vger.kernel.org, linux-net-drivers@solarflare.com
Subject: [PATCH 18/20] sfc: Clean up LED control
Date: Thu, 29 Jan 2009 19:21:36 +0000	[thread overview]
Message-ID: <1233256896.3656.47.camel@achroite> (raw)
In-Reply-To: <1233256358.3656.9.camel@achroite>

Reinitialise LEDs after overriding them for identification.

Rename set_fault_led method to set_id_led since we always use it for
NIC identification and not faults.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
 drivers/net/sfc/boards.c     |   11 +++++------
 drivers/net/sfc/efx.c        |    4 ++--
 drivers/net/sfc/net_driver.h |    8 ++++----
 3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/net/sfc/boards.c b/drivers/net/sfc/boards.c
index 1260875..b709878 100644
--- a/drivers/net/sfc/boards.c
+++ b/drivers/net/sfc/boards.c
@@ -26,7 +26,7 @@ static void blink_led_timer(unsigned long context)
 {
 	struct efx_nic *efx = (struct efx_nic *)context;
 	struct efx_blinker *bl = &efx->board_info.blinker;
-	efx->board_info.set_fault_led(efx, bl->state);
+	efx->board_info.set_id_led(efx, bl->state);
 	bl->state = !bl->state;
 	if (bl->resubmit)
 		mod_timer(&bl->timer, jiffies + BLINK_INTERVAL);
@@ -48,7 +48,7 @@ static void board_blink(struct efx_nic *efx, bool blink)
 		blinker->resubmit = false;
 		if (blinker->timer.function)
 			del_timer_sync(&blinker->timer);
-		efx->board_info.set_fault_led(efx, false);
+		efx->board_info.init_leds(efx);
 	}
 }
 
@@ -185,7 +185,7 @@ static struct i2c_board_info sfe4002_hwmon_info = {
 #define SFE4002_RX_LED    (0)	/* Green */
 #define SFE4002_TX_LED    (1)	/* Amber */
 
-static int sfe4002_init_leds(struct efx_nic *efx)
+static void sfe4002_init_leds(struct efx_nic *efx)
 {
 	/* Set the TX and RX LEDs to reflect status and activity, and the
 	 * fault LED off */
@@ -194,10 +194,9 @@ static int sfe4002_init_leds(struct efx_nic *efx)
 	xfp_set_led(efx, SFE4002_RX_LED,
 		    QUAKE_LED_RXLINK | QUAKE_LED_LINK_ACTSTAT);
 	xfp_set_led(efx, SFE4002_FAULT_LED, QUAKE_LED_OFF);
-	return 0;
 }
 
-static void sfe4002_fault_led(struct efx_nic *efx, bool state)
+static void sfe4002_set_id_led(struct efx_nic *efx, bool state)
 {
 	xfp_set_led(efx, SFE4002_FAULT_LED, state ? QUAKE_LED_ON :
 			QUAKE_LED_OFF);
@@ -221,7 +220,7 @@ static int sfe4002_init(struct efx_nic *efx)
 		return rc;
 	efx->board_info.monitor = sfe4002_check_hw;
 	efx->board_info.init_leds = sfe4002_init_leds;
-	efx->board_info.set_fault_led = sfe4002_fault_led;
+	efx->board_info.set_id_led = sfe4002_set_id_led;
 	efx->board_info.blink = board_blink;
 	efx->board_info.fini = efx_fini_lm87;
 	return 0;
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index b0e5308..7fcdd04 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -1847,8 +1847,8 @@ static struct efx_phy_operations efx_dummy_phy_operations = {
 
 static struct efx_board efx_dummy_board_info = {
 	.init		= efx_port_dummy_op_int,
-	.init_leds	= efx_port_dummy_op_int,
-	.set_fault_led	= efx_port_dummy_op_blink,
+	.init_leds	= efx_port_dummy_op_void,
+	.set_id_led	= efx_port_dummy_op_blink,
 	.monitor	= efx_port_dummy_op_int,
 	.blink		= efx_port_dummy_op_blink,
 	.fini		= efx_port_dummy_op_void,
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h
index 1f0dc8f..44bbf65 100644
--- a/drivers/net/sfc/net_driver.h
+++ b/drivers/net/sfc/net_driver.h
@@ -411,8 +411,8 @@ struct efx_blinker {
  * @major: Major rev. ('A', 'B' ...)
  * @minor: Minor rev. (0, 1, ...)
  * @init: Initialisation function
- * @init_leds: Sets up board LEDs
- * @set_fault_led: Turns the fault LED on or off
+ * @init_leds: Sets up board LEDs. May be called repeatedly.
+ * @set_id_led: Turns the identification LED on or off
  * @blink: Starts/stops blinking
  * @monitor: Board-specific health check function
  * @fini: Cleanup function
@@ -428,9 +428,9 @@ struct efx_board {
 	/* As the LEDs are typically attached to the PHY, LEDs
 	 * have a separate init callback that happens later than
 	 * board init. */
-	int (*init_leds)(struct efx_nic *efx);
+	void (*init_leds)(struct efx_nic *efx);
+	void (*set_id_led) (struct efx_nic *efx, bool state);
 	int (*monitor) (struct efx_nic *nic);
-	void (*set_fault_led) (struct efx_nic *efx, bool state);
 	void (*blink) (struct efx_nic *efx, bool start);
 	void (*fini) (struct efx_nic *nic);
 	struct efx_blinker blinker;

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
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:[~2009-01-29 19:21 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-29 19:12 [PATCH 00/20] sfc: Fixes and new PHY support for 2.6.29 Ben Hutchings
2009-01-29 19:15 ` [PATCH 01/20] sfc: SFT9001: Include non-breaking cable diagnostics in online self-tests Ben Hutchings
2009-01-29 19:16 ` [PATCH 02/20] sfc: Fix test for MDIO read failure Ben Hutchings
2009-01-29 19:17 ` [PATCH 03/20] sfc: SFT9001: Enable robust link training Ben Hutchings
2009-01-29 19:23   ` Ben Hutchings
2009-01-29 19:17 ` [PATCH 04/20] sfc: SFX7101: Remove workaround for bad " Ben Hutchings
2009-01-29 19:23   ` Ben Hutchings
2009-01-29 19:17 ` [PATCH 05/20] sfc: SFT9001/SFN4111T: Check PHY boot status during board initialisation Ben Hutchings
2009-01-29 19:17 ` [PATCH 06/20] sfc: SFT9001: Fix speed reporting in 1G PHY loopback Ben Hutchings
2009-01-29 19:18 ` [PATCH 07/20] sfc: SFN4111T: Fix GPIO sharing between I2C and FLASH_CFG_1 Ben Hutchings
2009-01-29 19:19 ` [PATCH 08/20] sfc: Fix post-reset MAC selection Ben Hutchings
2009-01-29 19:19 ` [PATCH 09/20] sfc: Reinitialise the PHY completely in case of a PHY or NIC reset Ben Hutchings
2009-01-29 19:19 ` [PATCH 10/20] sfc: Test for PHYXS faults whenever we cannot test link state bits Ben Hutchings
2009-01-29 19:19 ` [PATCH 11/20] sfc: Update board info for hardware monitor on SFN4111T-R5 and later Ben Hutchings
2009-01-29 19:20 ` [PATCH 12/20] sfc: SFT9001: Always enable XNP exchange on SFT9001 rev B Ben Hutchings
2009-01-29 19:20 ` [PATCH 13/20] sfc: SFX7101/SFT9001: Fix AN advertisements Ben Hutchings
2009-01-29 19:20 ` [PATCH 14/20] sfc: Remove "XFP" from log messages that are not specific to XFP Ben Hutchings
2009-01-29 19:20 ` [PATCH 15/20] sfc: Fix reporting of PHY id Ben Hutchings
2009-01-29 19:21 ` [PATCH 16/20] sfc: Add support for QT2025C PHY Ben Hutchings
2009-01-29 19:21 ` [PATCH 17/20] sfc: Delete unused efx_blinker::led_num field Ben Hutchings
2009-01-29 19:21 ` Ben Hutchings [this message]
2009-01-29 19:21 ` [PATCH 19/20] sfc: Add support for SFN4112F SFP+ reference design Ben Hutchings
2009-01-29 19:22 ` [PATCH 20/20] sfc: Replace stats_enabled flag with a disable count Ben Hutchings
2009-01-29 23:26 ` [PATCH 00/20] sfc: Fixes and new PHY support for 2.6.29 David Miller
2009-01-30  1:05   ` Ben Hutchings
2009-01-30  1:08     ` David Miller
2009-01-30  3:48       ` [PATCH 01/11] sfc: SFT9001: Enable robust link training Ben Hutchings
2009-01-30 22:09         ` David Miller
2009-01-31  0:04           ` Ben Hutchings
2009-01-31  0:02             ` David Miller
2009-01-30  3:48       ` [PATCH 02/11] sfc: SFX7101: Remove workaround for bad " Ben Hutchings
2009-01-30  3:49       ` [PATCH 03/11] sfc: SFT9001: Fix speed reporting in 1G PHY loopback Ben Hutchings
2009-01-30  3:49       ` [PATCH 04/11] sfc: SFN4111T: Fix GPIO sharing between I2C and FLASH_CFG_1 Ben Hutchings
2009-01-30  3:49       ` [PATCH 05/11] sfc: Fix post-reset MAC selection Ben Hutchings
2009-01-30  3:50       ` [PATCH 06/11] sfc: Reinitialise the PHY completely in case of a PHY or NIC reset Ben Hutchings
2009-01-30  3:51       ` [PATCH 07/11] sfc: Test for PHYXS faults whenever we cannot test link state bits Ben Hutchings
2009-01-30  3:51       ` [PATCH 08/11] sfc: Update board info for hardware monitor on SFN4111T-R5 and later Ben Hutchings
2009-01-30  3:52       ` [PATCH 09/11] sfc: SFT9001: Always enable XNP exchange on SFT9001 rev B Ben Hutchings
2009-01-30  3:59       ` [PATCH 10/11] sfc: SFX7101/SFT9001: Fix AN advertisements Ben Hutchings
2009-01-30  4:00       ` [PATCH 11/11] sfc: Replace stats_enabled flag with a disable count Ben Hutchings

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=1233256896.3656.47.camel@achroite \
    --to=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=linux-net-drivers@solarflare.com \
    --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).