Nico Huber has submitted this change. ( https://review.coreboot.org/c/flashrom/+/52413 )
Change subject: ene_lpc.c: Clean up cosmetics ......................................................................
ene_lpc.c: Clean up cosmetics
Reflow long lines, drop unnecessary parentheses, add spaces after `if` and `while` keywords and add braces to a single-statement `else if` block that follows a multi-statement `if` block.
TEST=Build with `make distclean && make VERSION=none -j` with and without this patch, the flashrom executable does not change.
Change-Id: Iaa5277b12fca192c46c11f5e0f375dc43d06bf5c Signed-off-by: Angel Pons th3fanbus@gmail.com Reviewed-on: https://review.coreboot.org/c/flashrom/+/52413 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Edward O'Callaghan quasisec@chromium.org --- M ene_lpc.c 1 file changed, 18 insertions(+), 32 deletions(-)
Approvals: build bot (Jenkins): Verified Edward O'Callaghan: Looks good to me, approved
diff --git a/ene_lpc.c b/ene_lpc.c index 56d6580..993ef4d 100644 --- a/ene_lpc.c +++ b/ene_lpc.c @@ -166,7 +166,7 @@ gettimeofday(&begin, NULL); while (INB(chip->port_ec_command) & MASK_INPUT_BUFFER_FULL) { gettimeofday(&now, NULL); - if ((now.tv_sec - begin.tv_sec) >= EC_COMMAND_TIMEOUT) { + if (now.tv_sec - begin.tv_sec >= EC_COMMAND_TIMEOUT) { msg_pdbg("%s: buf not empty\n", __func__); return; } @@ -178,11 +178,9 @@ if (chip->chip_id == ENE_KB932) { /* Spin wait for EC input buffer empty */ gettimeofday(&begin, NULL); - while (INB(chip->port_ec_command) & - MASK_INPUT_BUFFER_FULL) { + while (INB(chip->port_ec_command) & MASK_INPUT_BUFFER_FULL) { gettimeofday(&now, NULL); - if ((now.tv_sec - begin.tv_sec) >= - EC_COMMAND_TIMEOUT) { + if (now.tv_sec - begin.tv_sec >= EC_COMMAND_TIMEOUT) { msg_pdbg("%s: buf not empty\n", __func__); return; } @@ -295,9 +293,9 @@ struct timeval begin, now;
gettimeofday(&begin, NULL); - while(ene_read(chip, REG_SPI_CONFIG) & CFG_STATUS) { + while (ene_read(chip, REG_SPI_CONFIG) & CFG_STATUS) { gettimeofday(&now, NULL); - if ((now.tv_sec - begin.tv_sec) >= EC_COMMAND_TIMEOUT) { + if (now.tv_sec - begin.tv_sec >= EC_COMMAND_TIMEOUT) { msg_pdbg("%s: spi busy\n", __func__); return 1; } @@ -318,17 +316,14 @@
gettimeofday(&begin, NULL); /* Spin wait for EC ready */ - while (ene_read(chip, chip->ec_status_buf) != - chip->ec_is_pausing) { + while (ene_read(chip, chip->ec_status_buf) != chip->ec_is_pausing) { gettimeofday(&now, NULL); - if ((now.tv_sec - begin.tv_sec) >= - EC_COMMAND_TIMEOUT) { + if (now.tv_sec - begin.tv_sec >= EC_COMMAND_TIMEOUT) { msg_pdbg("%s: unable to pause ec\n", __func__); return -1; } }
- gettimeofday(&ctx_data->pause_begin, NULL); ctx_data->ec_state = EC_STATE_IDLE; return 0; @@ -346,11 +341,9 @@ ene_write(chip, REG_EC_EXTCMD, 0xff);
gettimeofday(&begin, NULL); - while (ene_read(chip, chip->ec_status_buf) != - chip->ec_is_running) { + while (ene_read(chip, chip->ec_status_buf) != chip->ec_is_running) { gettimeofday(&now, NULL); - if ((now.tv_sec - begin.tv_sec) >= - EC_COMMAND_TIMEOUT) { + if (now.tv_sec - begin.tv_sec >= EC_COMMAND_TIMEOUT) { msg_pdbg("%s: unable to resume ec\n", __func__); return -1; } @@ -364,11 +357,9 @@ { struct timeval pause_now; gettimeofday(&pause_now, NULL); - if ((pause_now.tv_sec - ctx_data->pause_begin.tv_sec) >= - EC_PAUSE_TIMEOUT) { - if(ene_resume_ec(ctx_data) == 0) + if (pause_now.tv_sec - ctx_data->pause_begin.tv_sec >= EC_PAUSE_TIMEOUT) { + if (ene_resume_ec(ctx_data) == 0) ene_pause_ec(ctx_data); - } return 0; } @@ -385,11 +376,9 @@ ec_command(chip, chip->ec_reset_cmd, chip->ec_reset_data);
/* Spin wait for EC ready */ - while (ene_read(chip, chip->ec_status_buf) != - chip->ec_is_stopping) { + while (ene_read(chip, chip->ec_status_buf) != chip->ec_is_stopping) { gettimeofday(&now, NULL); - if ((now.tv_sec - begin.tv_sec) >= - EC_COMMAND_TIMEOUT) { + if (now.tv_sec - begin.tv_sec >= EC_COMMAND_TIMEOUT) { msg_pdbg("%s: unable to reset ec\n", __func__); return -1; } @@ -440,9 +429,9 @@ ctx_data->ec_state = EC_STATE_IDLE; return 1; } - } - else if(chip->chip_id == ENE_KB94X && ctx_data->ec_state == EC_STATE_IDLE) + } else if (chip->chip_id == ENE_KB94X && ctx_data->ec_state == EC_STATE_IDLE) { ene_pause_timeout_check(ctx_data); + }
ene_spi_start(chip);
@@ -487,19 +476,16 @@
gettimeofday(&begin, NULL); /* EC restart */ - while (ene_read(chip, chip->ec_status_buf) != - chip->ec_is_running) { + while (ene_read(chip, chip->ec_status_buf) != chip->ec_is_running) { gettimeofday(&now, NULL); - if ((now.tv_sec - begin.tv_sec) >= - EC_RESTART_TIMEOUT) { + if (now.tv_sec - begin.tv_sec >= EC_RESTART_TIMEOUT) { msg_pdbg("%s: ec restart busy\n", __func__); rv = 1; goto exit; } } msg_pdbg("%s: send ec restart\n", __func__); - ec_command(chip, chip->ec_restart_cmd, - chip->ec_restart_data); + ec_command(chip, chip->ec_restart_cmd, chip->ec_restart_data);
ctx_data->ec_state = EC_STATE_NORMAL; rv = 0;