Anastasia Klimchuk has submitted this change. ( https://review.coreboot.org/c/flashrom/+/66868 )
Change subject: buspirate_spi.c: Retype appropriate variables with bool ......................................................................
buspirate_spi.c: Retype appropriate variables with bool
Use the bool type instead of integer for appropriate variables, since this represents their purpose much better.
Signed-off-by: Felix Singer felixsinger@posteo.net Change-Id: I245616168796f2c7fe99388688b0f606bd3405bf Reviewed-on: https://review.coreboot.org/c/flashrom/+/66868 Reviewed-by: Anastasia Klimchuk aklm@chromium.org Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Angel Pons th3fanbus@gmail.com --- M buspirate_spi.c 1 file changed, 25 insertions(+), 7 deletions(-)
Approvals: build bot (Jenkins): Verified Angel Pons: Looks good to me, approved Anastasia Klimchuk: Looks good to me, approved
diff --git a/buspirate_spi.c b/buspirate_spi.c index 8fa60f6..0704887 100644 --- a/buspirate_spi.c +++ b/buspirate_spi.c @@ -16,6 +16,7 @@ #include <stdio.h> #include <strings.h> #include <string.h> +#include <stdbool.h> #include <stdlib.h> #include <ctype.h> #include <unistd.h> @@ -327,8 +328,8 @@ int spispeed = 0x7; int serialspeed_index = -1; int ret = 0; - int pullup = 0; - int psu = 0; + bool pullup = false; + bool psu = false; unsigned char *bp_commbuf; int bp_commbufsize;
@@ -372,7 +373,7 @@ tmp = extract_programmer_param_str(cfg, "pullups"); if (tmp) { if (strcasecmp("on", tmp) == 0) - pullup = 1; + pullup = true; else if (strcasecmp("off", tmp) == 0) ; // ignore else @@ -383,7 +384,7 @@ tmp = extract_programmer_param_str(cfg, "psus"); if (tmp) { if (strcasecmp("on", tmp) == 0) - psu = 1; + psu = true; else if (strcasecmp("off", tmp) == 0) ; // ignore else @@ -646,11 +647,11 @@
/* Initial setup (SPI peripherals config): Enable power, CS high, AUX */ bp_commbuf[0] = 0x40 | 0x0b; - if (pullup == 1) { + if (pullup) { bp_commbuf[0] |= (1 << 2); msg_pdbg("Enabling pull-up resistors.\n"); } - if (psu == 1) { + if (psu) { bp_commbuf[0] |= (1 << 3); msg_pdbg("Enabling PSUs.\n"); } @@ -676,7 +677,7 @@
/* Set SPI config: output type, idle, clock edge, sample */ bp_commbuf[0] = 0x80 | 0xa; - if (pullup == 1) { + if (pullup) { bp_commbuf[0] &= ~(1 << 3); msg_pdbg("Pull-ups enabled, so using HiZ pin output! (Open-Drain mode)\n"); }