sfc: Merge struct efx_blinker into struct efx_board
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
63f1988419
commit
7d4cdb5af0
@ -35,30 +35,31 @@
|
|||||||
static void blink_led_timer(unsigned long context)
|
static void blink_led_timer(unsigned long context)
|
||||||
{
|
{
|
||||||
struct efx_nic *efx = (struct efx_nic *)context;
|
struct efx_nic *efx = (struct efx_nic *)context;
|
||||||
struct efx_blinker *bl = &efx->board_info.blinker;
|
struct efx_board *board = &efx->board_info;
|
||||||
efx->board_info.set_id_led(efx, bl->state);
|
|
||||||
bl->state = !bl->state;
|
board->set_id_led(efx, board->blink_state);
|
||||||
if (bl->resubmit)
|
board->blink_state = !board->blink_state;
|
||||||
mod_timer(&bl->timer, jiffies + BLINK_INTERVAL);
|
if (board->blink_resubmit)
|
||||||
|
mod_timer(&board->blink_timer, jiffies + BLINK_INTERVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void board_blink(struct efx_nic *efx, bool blink)
|
static void board_blink(struct efx_nic *efx, bool blink)
|
||||||
{
|
{
|
||||||
struct efx_blinker *blinker = &efx->board_info.blinker;
|
struct efx_board *board = &efx->board_info;
|
||||||
|
|
||||||
/* The rtnl mutex serialises all ethtool ioctls, so
|
/* The rtnl mutex serialises all ethtool ioctls, so
|
||||||
* nothing special needs doing here. */
|
* nothing special needs doing here. */
|
||||||
if (blink) {
|
if (blink) {
|
||||||
blinker->resubmit = true;
|
board->blink_resubmit = true;
|
||||||
blinker->state = false;
|
board->blink_state = false;
|
||||||
setup_timer(&blinker->timer, blink_led_timer,
|
setup_timer(&board->blink_timer, blink_led_timer,
|
||||||
(unsigned long)efx);
|
(unsigned long)efx);
|
||||||
mod_timer(&blinker->timer, jiffies + BLINK_INTERVAL);
|
mod_timer(&board->blink_timer, jiffies + BLINK_INTERVAL);
|
||||||
} else {
|
} else {
|
||||||
blinker->resubmit = false;
|
board->blink_resubmit = false;
|
||||||
if (blinker->timer.function)
|
if (board->blink_timer.function)
|
||||||
del_timer_sync(&blinker->timer);
|
del_timer_sync(&board->blink_timer);
|
||||||
efx->board_info.init_leds(efx);
|
board->init_leds(efx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,19 +388,6 @@ struct efx_channel {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* struct efx_blinker - S/W LED blinking context
|
|
||||||
* @state: Current state - on or off
|
|
||||||
* @resubmit: Timer resubmission flag
|
|
||||||
* @timer: Control timer for blinking
|
|
||||||
*/
|
|
||||||
struct efx_blinker {
|
|
||||||
bool state;
|
|
||||||
bool resubmit;
|
|
||||||
struct timer_list timer;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct efx_board - board information
|
* struct efx_board - board information
|
||||||
* @type: Board model type
|
* @type: Board model type
|
||||||
@ -412,7 +399,9 @@ struct efx_blinker {
|
|||||||
* @blink: Starts/stops blinking
|
* @blink: Starts/stops blinking
|
||||||
* @monitor: Board-specific health check function
|
* @monitor: Board-specific health check function
|
||||||
* @fini: Cleanup function
|
* @fini: Cleanup function
|
||||||
* @blinker: used to blink LEDs in software
|
* @blink_state: Current blink state
|
||||||
|
* @blink_resubmit: Blink timer resubmission flag
|
||||||
|
* @blink_timer: Blink timer
|
||||||
* @hwmon_client: I2C client for hardware monitor
|
* @hwmon_client: I2C client for hardware monitor
|
||||||
* @ioexp_client: I2C client for power/port control
|
* @ioexp_client: I2C client for power/port control
|
||||||
*/
|
*/
|
||||||
@ -429,7 +418,9 @@ struct efx_board {
|
|||||||
int (*monitor) (struct efx_nic *nic);
|
int (*monitor) (struct efx_nic *nic);
|
||||||
void (*blink) (struct efx_nic *efx, bool start);
|
void (*blink) (struct efx_nic *efx, bool start);
|
||||||
void (*fini) (struct efx_nic *nic);
|
void (*fini) (struct efx_nic *nic);
|
||||||
struct efx_blinker blinker;
|
bool blink_state;
|
||||||
|
bool blink_resubmit;
|
||||||
|
struct timer_list blink_timer;
|
||||||
struct i2c_client *hwmon_client, *ioexp_client;
|
struct i2c_client *hwmon_client, *ioexp_client;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user