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
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/66868
Original-Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Original-Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/71479
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/buspirate_spi.c b/buspirate_spi.c
index e7c2b29..2f58f0a 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>
@@ -227,8 +228,8 @@
int spispeed = 0x7;
int serialspeed_index = -1;
int ret = 0;
- int pullup = 0;
- int psu = 0;
+ bool pullup = false;
+ bool psu = false;
dev = extract_programmer_param("dev");
if (dev && !strlen(dev)) {
@@ -270,7 +271,7 @@
tmp = extract_programmer_param("pullups");
if (tmp) {
if (strcasecmp("on", tmp) == 0)
- pullup = 1;
+ pullup = true;
else if (strcasecmp("off", tmp) == 0)
; // ignore
else
@@ -281,7 +282,7 @@
tmp = extract_programmer_param("psus");
if (tmp) {
if (strcasecmp("on", tmp) == 0)
- psu = 1;
+ psu = true;
else if (strcasecmp("off", tmp) == 0)
; // ignore
else
@@ -533,11 +534,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");
}
@@ -563,7 +564,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");
}