summaryrefslogtreecommitdiffstats
path: root/realtek_mst_i2c_spi.c
diff options
context:
space:
mode:
authorFelix Singer <felixsinger@posteo.net>2022-07-18 07:34:35 +0200
committerAnastasia Klimchuk <aklm@chromium.org>2022-07-22 01:30:22 +0000
commit3089a4d6846558829d56a280c2b2c4244ca6bec0 (patch)
treeafcaaa8496b679666efabf27fea472a34e195c9f /realtek_mst_i2c_spi.c
parentbde9479dc167aacbaaeb1bec2338eb9fb096e018 (diff)
downloadflashrom-3089a4d6846558829d56a280c2b2c4244ca6bec0.tar.gz
flashrom-3089a4d6846558829d56a280c2b2c4244ca6bec0.tar.bz2
flashrom-3089a4d6846558829d56a280c2b2c4244ca6bec0.zip
realtek_mst_i2c_spi.c: Use bool type for parameters
Use the bool type instead of integer for options, since this represents the purpose of their variables much better. Also, use the bool type for the attribute `reset` from the struct `realtek_mst_i2c_spi_data`, which is used to store the value of the parameter `reset_mcu`. Signed-off-by: Felix Singer <felixsinger@posteo.net> Change-Id: Idffd860e0de0bb82eec6102087e2e19783c32521 Reviewed-on: https://review.coreboot.org/c/flashrom/+/65943 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Thomas Heijligen <src@posteo.de> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Diffstat (limited to 'realtek_mst_i2c_spi.c')
-rw-r--r--realtek_mst_i2c_spi.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/realtek_mst_i2c_spi.c b/realtek_mst_i2c_spi.c
index 126f7de1a..1aa18cb0a 100644
--- a/realtek_mst_i2c_spi.c
+++ b/realtek_mst_i2c_spi.c
@@ -51,7 +51,7 @@
struct realtek_mst_i2c_spi_data {
int fd;
- int reset;
+ bool reset;
};
static int realtek_mst_i2c_spi_write_data(int fd, uint16_t addr, void *buf, uint16_t len)
@@ -444,16 +444,16 @@ static const struct spi_master spi_master_i2c_realtek_mst = {
.probe_opcode = default_spi_probe_opcode,
};
-static int get_params(int *reset, int *enter_isp, int *allow_brick)
+static int get_params(bool *reset, bool *enter_isp, bool *allow_brick)
{
char *reset_str = NULL, *isp_str = NULL, *brick_str = NULL;
int ret = 0;
- *allow_brick = 0; /* Default behaviour is to bail. */
+ *allow_brick = false; /* Default behaviour is to bail. */
brick_str = extract_programmer_param_str("allow_brick");
if (brick_str) {
if (!strcmp(brick_str, "yes")) {
- *allow_brick = 1;
+ *allow_brick = true;
} else {
msg_perr("%s: Incorrect param format, allow_brick=yes.\n", __func__);
ret = SPI_GENERIC_ERROR;
@@ -461,13 +461,13 @@ static int get_params(int *reset, int *enter_isp, int *allow_brick)
}
free(brick_str);
- *reset = 0; /* Default behaviour is no MCU reset on tear-down. */
+ *reset = false; /* Default behaviour is no MCU reset on tear-down. */
reset_str = extract_programmer_param_str("reset_mcu");
if (reset_str) {
if (reset_str[0] == '1') {
- *reset = 1;
+ *reset = true;
} else if (reset_str[0] == '0') {
- *reset = 0;
+ *reset = false;
} else {
msg_perr("%s: Incorrect param format, reset_mcu=1 or 0.\n", __func__);
ret = SPI_GENERIC_ERROR;
@@ -475,13 +475,13 @@ static int get_params(int *reset, int *enter_isp, int *allow_brick)
}
free(reset_str);
- *enter_isp = 1; /* Default behaviour is enter ISP on setup. */
+ *enter_isp = true; /* Default behaviour is enter ISP on setup. */
isp_str = extract_programmer_param_str("enter_isp");
if (isp_str) {
if (isp_str[0] == '1') {
- *enter_isp = 1;
+ *enter_isp = true;
} else if (isp_str[0] == '0') {
- *enter_isp = 0;
+ *enter_isp = false;
} else {
msg_perr("%s: Incorrect param format, enter_isp=1 or 0.\n", __func__);
ret = SPI_GENERIC_ERROR;
@@ -495,7 +495,7 @@ static int get_params(int *reset, int *enter_isp, int *allow_brick)
static int realtek_mst_i2c_spi_init(void)
{
int ret = 0;
- int reset = 0, enter_isp = 0, allow_brick = 0;
+ bool reset = false, enter_isp = false, allow_brick = false;
if (get_params(&reset, &enter_isp, &allow_brick))
return SPI_GENERIC_ERROR;