1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-27 23:22:37 +02:00

mstarddc_spi.c: Retype appropriate variables with bool

Use the bool type instead of an integer for appropriate variables, since
this represents their purpose much better.

Signed-off-by: Felix Singer <felixsinger@posteo.net>
Change-Id: I3a72a0877b47f67f8984c28cbf5b5d429ec1534e
Reviewed-on: https://review.coreboot.org/c/flashrom/+/66874
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Felix Singer 2022-08-19 00:32:34 +02:00 committed by Anastasia Klimchuk
parent 5fe7f4f6d1
commit 4840cfe210

View File

@ -15,6 +15,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#include <sys/types.h> #include <sys/types.h>
@ -32,7 +33,7 @@
struct mstarddc_spi_data { struct mstarddc_spi_data {
int fd; int fd;
int addr; int addr;
int doreset; bool doreset;
}; };
// MSTAR DDC Commands // MSTAR DDC Commands
@ -47,7 +48,7 @@ static int mstarddc_spi_shutdown(void *data)
struct mstarddc_spi_data *mstarddc_data = data; struct mstarddc_spi_data *mstarddc_data = data;
// Reset, disables ISP mode // Reset, disables ISP mode
if (mstarddc_data->doreset == 1) { if (mstarddc_data->doreset) {
uint8_t cmd = MSTARDDC_SPI_RESET; uint8_t cmd = MSTARDDC_SPI_RESET;
if (write(mstarddc_data->fd, &cmd, 1) < 0) { if (write(mstarddc_data->fd, &cmd, 1) < 0) {
msg_perr("Error sending reset command: errno %d.\n", msg_perr("Error sending reset command: errno %d.\n",
@ -129,7 +130,7 @@ static int mstarddc_spi_send_command(const struct flashctx *flash,
/* Do not reset if something went wrong, as it might prevent from /* Do not reset if something went wrong, as it might prevent from
* retrying flashing. */ * retrying flashing. */
if (ret != 0) if (ret != 0)
mstarddc_data->doreset = 0; mstarddc_data->doreset = false;
if (cmd) if (cmd)
free(cmd); free(cmd);
@ -155,7 +156,7 @@ static int mstarddc_spi_init(const struct programmer_cfg *cfg)
int ret = 0; int ret = 0;
int mstarddc_fd = -1; int mstarddc_fd = -1;
int mstarddc_addr; int mstarddc_addr;
int mstarddc_doreset = 1; bool mstarddc_doreset = true;
struct mstarddc_spi_data *mstarddc_data; struct mstarddc_spi_data *mstarddc_data;
// Get device, address from command-line // Get device, address from command-line
@ -184,7 +185,7 @@ static int mstarddc_spi_init(const struct programmer_cfg *cfg)
// Get noreset=1 option from command-line // Get noreset=1 option from command-line
char *noreset = extract_programmer_param_str(cfg, "noreset"); char *noreset = extract_programmer_param_str(cfg, "noreset");
if (noreset != NULL && noreset[0] == '1') if (noreset != NULL && noreset[0] == '1')
mstarddc_doreset = 0; mstarddc_doreset = false;
free(noreset); free(noreset);
msg_pinfo("Info: Will %sreset the device at the end.\n", mstarddc_doreset ? "" : "NOT "); msg_pinfo("Info: Will %sreset the device at the end.\n", mstarddc_doreset ? "" : "NOT ");
// Open device // Open device