diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2009-02-27 08:08:03 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-03-02 06:15:05 -0500 |
commit | 8129d2173ea7a5b030b4cba044d1f92689895083 (patch) | |
tree | 0ae9108fa888fbed0f4b846e17c27f6b44cd3c6e | |
parent | b4a44a69877960e620461c663805f7cc52e2a798 (diff) |
sfc: Clean up LED control
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/sfc/boards.c | 11 | ||||
-rw-r--r-- | drivers/net/sfc/efx.c | 4 | ||||
-rw-r--r-- | 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 12608750a9f5..b70987892dfe 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) | |||
26 | { | 26 | { |
27 | struct efx_nic *efx = (struct efx_nic *)context; | 27 | struct efx_nic *efx = (struct efx_nic *)context; |
28 | struct efx_blinker *bl = &efx->board_info.blinker; | 28 | struct efx_blinker *bl = &efx->board_info.blinker; |
29 | efx->board_info.set_fault_led(efx, bl->state); | 29 | efx->board_info.set_id_led(efx, bl->state); |
30 | bl->state = !bl->state; | 30 | bl->state = !bl->state; |
31 | if (bl->resubmit) | 31 | if (bl->resubmit) |
32 | mod_timer(&bl->timer, jiffies + BLINK_INTERVAL); | 32 | mod_timer(&bl->timer, jiffies + BLINK_INTERVAL); |
@@ -48,7 +48,7 @@ static void board_blink(struct efx_nic *efx, bool blink) | |||
48 | blinker->resubmit = false; | 48 | blinker->resubmit = false; |
49 | if (blinker->timer.function) | 49 | if (blinker->timer.function) |
50 | del_timer_sync(&blinker->timer); | 50 | del_timer_sync(&blinker->timer); |
51 | efx->board_info.set_fault_led(efx, false); | 51 | efx->board_info.init_leds(efx); |
52 | } | 52 | } |
53 | } | 53 | } |
54 | 54 | ||
@@ -185,7 +185,7 @@ static struct i2c_board_info sfe4002_hwmon_info = { | |||
185 | #define SFE4002_RX_LED (0) /* Green */ | 185 | #define SFE4002_RX_LED (0) /* Green */ |
186 | #define SFE4002_TX_LED (1) /* Amber */ | 186 | #define SFE4002_TX_LED (1) /* Amber */ |
187 | 187 | ||
188 | static int sfe4002_init_leds(struct efx_nic *efx) | 188 | static void sfe4002_init_leds(struct efx_nic *efx) |
189 | { | 189 | { |
190 | /* Set the TX and RX LEDs to reflect status and activity, and the | 190 | /* Set the TX and RX LEDs to reflect status and activity, and the |
191 | * fault LED off */ | 191 | * fault LED off */ |
@@ -194,10 +194,9 @@ static int sfe4002_init_leds(struct efx_nic *efx) | |||
194 | xfp_set_led(efx, SFE4002_RX_LED, | 194 | xfp_set_led(efx, SFE4002_RX_LED, |
195 | QUAKE_LED_RXLINK | QUAKE_LED_LINK_ACTSTAT); | 195 | QUAKE_LED_RXLINK | QUAKE_LED_LINK_ACTSTAT); |
196 | xfp_set_led(efx, SFE4002_FAULT_LED, QUAKE_LED_OFF); | 196 | xfp_set_led(efx, SFE4002_FAULT_LED, QUAKE_LED_OFF); |
197 | return 0; | ||
198 | } | 197 | } |
199 | 198 | ||
200 | static void sfe4002_fault_led(struct efx_nic *efx, bool state) | 199 | static void sfe4002_set_id_led(struct efx_nic *efx, bool state) |
201 | { | 200 | { |
202 | xfp_set_led(efx, SFE4002_FAULT_LED, state ? QUAKE_LED_ON : | 201 | xfp_set_led(efx, SFE4002_FAULT_LED, state ? QUAKE_LED_ON : |
203 | QUAKE_LED_OFF); | 202 | QUAKE_LED_OFF); |
@@ -221,7 +220,7 @@ static int sfe4002_init(struct efx_nic *efx) | |||
221 | return rc; | 220 | return rc; |
222 | efx->board_info.monitor = sfe4002_check_hw; | 221 | efx->board_info.monitor = sfe4002_check_hw; |
223 | efx->board_info.init_leds = sfe4002_init_leds; | 222 | efx->board_info.init_leds = sfe4002_init_leds; |
224 | efx->board_info.set_fault_led = sfe4002_fault_led; | 223 | efx->board_info.set_id_led = sfe4002_set_id_led; |
225 | efx->board_info.blink = board_blink; | 224 | efx->board_info.blink = board_blink; |
226 | efx->board_info.fini = efx_fini_lm87; | 225 | efx->board_info.fini = efx_fini_lm87; |
227 | return 0; | 226 | return 0; |
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c index 75836599e43d..45df110f8331 100644 --- a/drivers/net/sfc/efx.c +++ b/drivers/net/sfc/efx.c | |||
@@ -1848,8 +1848,8 @@ static struct efx_phy_operations efx_dummy_phy_operations = { | |||
1848 | 1848 | ||
1849 | static struct efx_board efx_dummy_board_info = { | 1849 | static struct efx_board efx_dummy_board_info = { |
1850 | .init = efx_port_dummy_op_int, | 1850 | .init = efx_port_dummy_op_int, |
1851 | .init_leds = efx_port_dummy_op_int, | 1851 | .init_leds = efx_port_dummy_op_void, |
1852 | .set_fault_led = efx_port_dummy_op_blink, | 1852 | .set_id_led = efx_port_dummy_op_blink, |
1853 | .monitor = efx_port_dummy_op_int, | 1853 | .monitor = efx_port_dummy_op_int, |
1854 | .blink = efx_port_dummy_op_blink, | 1854 | .blink = efx_port_dummy_op_blink, |
1855 | .fini = efx_port_dummy_op_void, | 1855 | .fini = efx_port_dummy_op_void, |
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h index ebc7b6340fb0..b81fc727dfff 100644 --- a/drivers/net/sfc/net_driver.h +++ b/drivers/net/sfc/net_driver.h | |||
@@ -402,8 +402,8 @@ struct efx_blinker { | |||
402 | * @major: Major rev. ('A', 'B' ...) | 402 | * @major: Major rev. ('A', 'B' ...) |
403 | * @minor: Minor rev. (0, 1, ...) | 403 | * @minor: Minor rev. (0, 1, ...) |
404 | * @init: Initialisation function | 404 | * @init: Initialisation function |
405 | * @init_leds: Sets up board LEDs | 405 | * @init_leds: Sets up board LEDs. May be called repeatedly. |
406 | * @set_fault_led: Turns the fault LED on or off | 406 | * @set_id_led: Turns the identification LED on or off |
407 | * @blink: Starts/stops blinking | 407 | * @blink: Starts/stops blinking |
408 | * @monitor: Board-specific health check function | 408 | * @monitor: Board-specific health check function |
409 | * @fini: Cleanup function | 409 | * @fini: Cleanup function |
@@ -419,9 +419,9 @@ struct efx_board { | |||
419 | /* As the LEDs are typically attached to the PHY, LEDs | 419 | /* As the LEDs are typically attached to the PHY, LEDs |
420 | * have a separate init callback that happens later than | 420 | * have a separate init callback that happens later than |
421 | * board init. */ | 421 | * board init. */ |
422 | int (*init_leds)(struct efx_nic *efx); | 422 | void (*init_leds)(struct efx_nic *efx); |
423 | void (*set_id_led) (struct efx_nic *efx, bool state); | ||
423 | int (*monitor) (struct efx_nic *nic); | 424 | int (*monitor) (struct efx_nic *nic); |
424 | void (*set_fault_led) (struct efx_nic *efx, bool state); | ||
425 | void (*blink) (struct efx_nic *efx, bool start); | 425 | void (*blink) (struct efx_nic *efx, bool start); |
426 | void (*fini) (struct efx_nic *nic); | 426 | void (*fini) (struct efx_nic *nic); |
427 | struct efx_blinker blinker; | 427 | struct efx_blinker blinker; |