summaryrefslogtreecommitdiff
path: root/mstarddc_spi.c
diff options
context:
space:
mode:
authorFelix Singer <felixsinger@posteo.net>2022-08-19 00:32:34 +0200
committerAnastasia Klimchuk <aklm@chromium.org>2022-09-08 02:01:19 +0000
commit4840cfe2105655ba519dc835ef0ed71c937fcc70 (patch)
tree601de29e732193693be414fe50f05a5f4b6e4c12 /mstarddc_spi.c
parent5fe7f4f6d18990b9d5fd336fef16b3a09cfbc8b1 (diff)
downloadflashrom-git-4840cfe2105655ba519dc835ef0ed71c937fcc70.tar.gz
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>
Diffstat (limited to 'mstarddc_spi.c')
-rw-r--r--mstarddc_spi.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/mstarddc_spi.c b/mstarddc_spi.c
index ee5779c2..af46b244 100644
--- a/mstarddc_spi.c
+++ b/mstarddc_spi.c
@@ -15,6 +15,7 @@
#include <stdio.h>
#include <string.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <ctype.h>
#include <sys/types.h>
@@ -32,7 +33,7 @@
struct mstarddc_spi_data {
int fd;
int addr;
- int doreset;
+ bool doreset;
};
// MSTAR DDC Commands
@@ -47,7 +48,7 @@ static int mstarddc_spi_shutdown(void *data)
struct mstarddc_spi_data *mstarddc_data = data;
// Reset, disables ISP mode
- if (mstarddc_data->doreset == 1) {
+ if (mstarddc_data->doreset) {
uint8_t cmd = MSTARDDC_SPI_RESET;
if (write(mstarddc_data->fd, &cmd, 1) < 0) {
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
* retrying flashing. */
if (ret != 0)
- mstarddc_data->doreset = 0;
+ mstarddc_data->doreset = false;
if (cmd)
free(cmd);
@@ -155,7 +156,7 @@ static int mstarddc_spi_init(const struct programmer_cfg *cfg)
int ret = 0;
int mstarddc_fd = -1;
int mstarddc_addr;
- int mstarddc_doreset = 1;
+ bool mstarddc_doreset = true;
struct mstarddc_spi_data *mstarddc_data;
// 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
char *noreset = extract_programmer_param_str(cfg, "noreset");
if (noreset != NULL && noreset[0] == '1')
- mstarddc_doreset = 0;
+ mstarddc_doreset = false;
free(noreset);
msg_pinfo("Info: Will %sreset the device at the end.\n", mstarddc_doreset ? "" : "NOT ");
// Open device