From f23525e5dd1ed1e0a63f2ecf57bf7927be1a9765 Mon Sep 17 00:00:00 2001 From: Marc Schink Date: Wed, 1 Jul 2020 10:23:44 +0200 Subject: [PATCH] flash/nor/cfi: Use 'bool' data type Change-Id: I25198223175c26aded9ad667b802da09883e94ee Signed-off-by: Marc Schink Reviewed-on: http://openocd.zylin.com/5738 Tested-by: jenkins Reviewed-by: Antonio Borneo --- src/flash/nor/cfi.c | 22 +++++++++++----------- src/flash/nor/cfi.h | 10 +++++----- src/flash/nor/non_cfi.c | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c index 19fb6b2c2c..9d2a53a6bc 100644 --- a/src/flash/nor/cfi.c +++ b/src/flash/nor/cfi.c @@ -814,7 +814,7 @@ static int cfi_intel_info(struct flash_bank *bank, char *buf, int buf_size) int cfi_flash_bank_cmd(struct flash_bank *bank, unsigned int argc, const char **argv) { struct cfi_flash_bank *cfi_info; - int bus_swap = 0; + bool bus_swap = false; if (argc < 6) return ERROR_COMMAND_SYNTAX_ERROR; @@ -841,20 +841,20 @@ int cfi_flash_bank_cmd(struct flash_bank *bank, unsigned int argc, const char ** cfi_info->pri_ext = NULL; bank->driver_priv = cfi_info; - cfi_info->x16_as_x8 = 0; - cfi_info->jedec_probe = 0; - cfi_info->not_cfi = 0; - cfi_info->data_swap = 0; + cfi_info->x16_as_x8 = false; + cfi_info->jedec_probe = false; + cfi_info->not_cfi = false; + cfi_info->data_swap = false; for (unsigned i = 6; i < argc; i++) { if (strcmp(argv[i], "x16_as_x8") == 0) - cfi_info->x16_as_x8 = 1; + cfi_info->x16_as_x8 = true; else if (strcmp(argv[i], "data_swap") == 0) - cfi_info->data_swap = 1; + cfi_info->data_swap = true; else if (strcmp(argv[i], "bus_swap") == 0) - bus_swap = 1; + bus_swap = true; else if (strcmp(argv[i], "jedec_probe") == 0) - cfi_info->jedec_probe = 1; + cfi_info->jedec_probe = true; } if (bus_swap) @@ -2661,7 +2661,7 @@ int cfi_probe(struct flash_bank *bank) /* query only if this is a CFI compatible flash, * otherwise the relevant info has already been filled in */ - if (cfi_info->not_cfi == 0) { + if (!cfi_info->not_cfi) { /* enter CFI query mode * according to JEDEC Standard No. 68.01, * a single bus sequence with address = 0x55, data = 0x98 should put @@ -3011,7 +3011,7 @@ int cfi_get_info(struct flash_bank *bank, char *buf, int buf_size) return ERROR_OK; } - if (cfi_info->not_cfi == 0) + if (!cfi_info->not_cfi) printed = snprintf(buf, buf_size, "\nCFI flash: "); else printed = snprintf(buf, buf_size, "\nnon-CFI flash: "); diff --git a/src/flash/nor/cfi.h b/src/flash/nor/cfi.h index effa1d5c0d..eceb9a4b3c 100644 --- a/src/flash/nor/cfi.h +++ b/src/flash/nor/cfi.h @@ -23,13 +23,13 @@ #define CFI_STATUS_POLL_MASK_DQ6_DQ7 0xC0 /* DQ6..DQ7 */ struct cfi_flash_bank { - int x16_as_x8; - int jedec_probe; - int not_cfi; - int probed; + bool x16_as_x8; + bool jedec_probe; + bool not_cfi; + bool probed; enum target_endianness endianness; - int data_swap; + bool data_swap; uint16_t manufacturer; uint16_t device_id; diff --git a/src/flash/nor/non_cfi.c b/src/flash/nor/non_cfi.c index 851c0ae819..f44adba137 100644 --- a/src/flash/nor/non_cfi.c +++ b/src/flash/nor/non_cfi.c @@ -487,7 +487,7 @@ void cfi_fixup_non_cfi(struct flash_bank *bank) if (!non_cfi->mfr) return; - cfi_info->not_cfi = 1; + cfi_info->not_cfi = true; /* fill in defaults for non-critical data */ cfi_info->vcc_min = 0x0; -- 2.30.2