Anastasia Klimchuk submitted this change.

View Change


Approvals: build bot (Jenkins): Verified Angel Pons: Looks good to me, approved Anastasia Klimchuk: Looks good to me, approved
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>
---
M mstarddc_spi.c
1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/mstarddc_spi.c b/mstarddc_spi.c
index ee5779c..af46b24 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 @@
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 @@
/* 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 @@
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 @@
// 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

To view, visit change 66874. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I3a72a0877b47f67f8984c28cbf5b5d429ec1534e
Gerrit-Change-Number: 66874
Gerrit-PatchSet: 15
Gerrit-Owner: Felix Singer <felixsinger@posteo.net>
Gerrit-Reviewer: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged