diff options
author | Felix Singer <felixsinger@posteo.net> | 2022-08-19 02:48:15 +0200 |
---|---|---|
committer | Anastasia Klimchuk <aklm@chromium.org> | 2022-09-08 02:05:23 +0000 |
commit | 2ffc56b3379004747f02b28b07c635f83a21e6f5 (patch) | |
tree | 7ab40604bac7f12b35e2d5ebfd0f1d79fecaad41 | |
parent | bf85c62a8df4e9c198ff670414338946d88ed0de (diff) | |
download | flashrom-2ffc56b3379004747f02b28b07c635f83a21e6f5.tar.gz flashrom-2ffc56b3379004747f02b28b07c635f83a21e6f5.tar.bz2 flashrom-2ffc56b3379004747f02b28b07c635f83a21e6f5.zip |
tree: Retype variable `programmer_may_write` with bool
Use the bool type instead of an integer for the variable
`programmer_may_write`, since this represents its purpose much better.
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Change-Id: I69958527ae018a92f1c42734a7990d0c532dee0c
Reviewed-on: https://review.coreboot.org/c/flashrom/+/66885
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
-rw-r--r-- | chipset_enable.c | 3 | ||||
-rw-r--r-- | flashrom.c | 4 | ||||
-rw-r--r-- | gfxnvidia.c | 3 | ||||
-rw-r--r-- | include/programmer.h | 2 | ||||
-rw-r--r-- | sb600spi.c | 3 |
5 files changed, 9 insertions, 6 deletions
diff --git a/chipset_enable.c b/chipset_enable.c index e205a83d4..ae069894c 100644 --- a/chipset_enable.c +++ b/chipset_enable.c @@ -26,6 +26,7 @@ #define _LARGEFILE64_SOURCE +#include <stdbool.h> #include <stdlib.h> #include <string.h> #include <unistd.h> @@ -1526,7 +1527,7 @@ static int enable_flash_ck804(const struct programmer_cfg *cfg, struct pci_dev * if (err > 0) { msg_pinfo("%d locks could not be disabled, disabling writes (reads may also fail).\n", err); - programmer_may_write = 0; + programmer_may_write = false; } reg = 0x88; diff --git a/flashrom.c b/flashrom.c index a1e4d2301..b68ba5539 100644 --- a/flashrom.c +++ b/flashrom.c @@ -50,7 +50,7 @@ struct decode_sizes max_rom_decode; unsigned long flashbase; /* Is writing allowed with this programmer? */ -int programmer_may_write; +bool programmer_may_write; #define SHUTDOWN_MAXFN 32 static int shutdown_fn_count = 0; @@ -148,7 +148,7 @@ int programmer_init(const struct programmer_entry *prog, const char *param) /* Registering shutdown functions is now allowed. */ may_register_shutdown = true; /* Default to allowing writes. Broken programmers set this to 0. */ - programmer_may_write = 1; + programmer_may_write = true; programmer_param = param; msg_pdbg("Initializing %s programmer\n", programmer->name); diff --git a/gfxnvidia.c b/gfxnvidia.c index 941f0e8d4..ff510ef47 100644 --- a/gfxnvidia.c +++ b/gfxnvidia.c @@ -14,6 +14,7 @@ * GNU General Public License for more details. */ +#include <stdbool.h> #include <stdlib.h> #include <string.h> #include "flash.h" @@ -140,7 +141,7 @@ static int gfxnvidia_init(const struct programmer_cfg *cfg) pci_write_long(dev, REG_FLASH_ACCESS, reg32); /* Write/erase doesn't work. */ - programmer_may_write = 0; + programmer_may_write = false; return register_par_master(&par_master_gfxnvidia, BUS_PARALLEL, data); } diff --git a/include/programmer.h b/include/programmer.h index 776ac2113..abb7cfd64 100644 --- a/include/programmer.h +++ b/include/programmer.h @@ -286,7 +286,7 @@ struct decode_sizes { }; // FIXME: These need to be local, not global extern struct decode_sizes max_rom_decode; -extern int programmer_may_write; +extern bool programmer_may_write; extern unsigned long flashbase; unsigned int count_max_decode_exceedings(const struct flashctx *flash); char *extract_programmer_param_str(const struct programmer_cfg *cfg, const char *param_name); diff --git a/sb600spi.c b/sb600spi.c index 40a6dbbfd..8b02b51d2 100644 --- a/sb600spi.c +++ b/sb600spi.c @@ -18,6 +18,7 @@ * GNU General Public License for more details. */ +#include <stdbool.h> #include <string.h> #include <stdlib.h> #include "flash.h" @@ -554,7 +555,7 @@ static int handle_imc(const struct programmer_cfg *cfg, struct pci_dev *dev, enu } if (!amd_imc_force) - programmer_may_write = 0; + programmer_may_write = false; msg_pinfo("Writes have been disabled for safety reasons because the presence of the IMC\n" "was detected and it could interfere with accessing flash memory. Flashrom will\n" "try to disable it temporarily but even then this might not be safe:\n" |