summaryrefslogtreecommitdiffstats
path: root/flashrom.c
diff options
context:
space:
mode:
authorEdward O'Callaghan <quasisec@google.com>2022-11-23 22:36:53 +1100
committerEdward O'Callaghan <quasisec@chromium.org>2023-03-20 00:36:56 +0000
commit0c774d6b6a075f37f21ca9c3506141cb0d4ae34b (patch)
tree695a252de5954213b1ceeffecef302394f26c2e6 /flashrom.c
parent028099dbfd92e62eb0c6227d1194ff714f55e67c (diff)
downloadflashrom-0c774d6b6a075f37f21ca9c3506141cb0d4ae34b.tar.gz
flashrom-0c774d6b6a075f37f21ca9c3506141cb0d4ae34b.tar.bz2
flashrom-0c774d6b6a075f37f21ca9c3506141cb0d4ae34b.zip
tree/: Convert unlock func ptr into enumerate values
Converting the blockprotect unlock function pointer within the flashchip struct into enum values allows for the flashchips db to be turn into pure, declarative data. A nice side-effect of this is to reduce link-time symbol space of chipdrivers and increase modularity of the spi25_statusreg.c and related implementations. BUG=none TEST=ninja test. Change-Id: Ie5c5db1b09d07e1a549990d6f5a622fae4c83233 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/69933 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Sam McNally <sammc@google.com> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Diffstat (limited to 'flashrom.c')
-rw-r--r--flashrom.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/flashrom.c b/flashrom.c
index 3cf67f1d0..c5b795c19 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -2080,9 +2080,9 @@ int prepare_flash_access(struct flashctx *const flash,
if (ret)
msg_cerr("Failed to unlock flash status reg with wp support.\n");
}
- if (ret && flash->chip->unlock) {
- flash->chip->unlock(flash);
- }
+ blockprotect_func_t *bp_func = lookup_blockprotect_func_ptr(flash->chip);
+ if (ret && bp_func)
+ bp_func(flash);
flash->address_high_byte = -1;
flash->in_4ba_mode = false;