Anastasia Klimchuk has submitted this change. ( https://review.coreboot.org/c/flashrom/+/66885 )
Change subject: tree: Retype variable `programmer_may_write` with bool ......................................................................
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 --- M chipset_enable.c M flashrom.c M gfxnvidia.c M include/programmer.h M sb600spi.c 5 files changed, 26 insertions(+), 6 deletions(-)
Approvals: build bot (Jenkins): Verified Angel Pons: Looks good to me, approved Anastasia Klimchuk: Looks good to me, approved
diff --git a/chipset_enable.c b/chipset_enable.c index e205a83..ae06989 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 @@
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 a1e4d23..b68ba55 100644 --- a/flashrom.c +++ b/flashrom.c @@ -50,7 +50,7 @@ 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 @@ /* 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 941f0e8..ff510ef 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 @@ 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 776ac21..abb7cfd 100644 --- a/include/programmer.h +++ b/include/programmer.h @@ -286,7 +286,7 @@ }; // 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 40a6dbb..8b02b51 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 @@ }
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"