From 5cff668d1ad152e3f70f725e667b23690e2d9f1a Mon Sep 17 00:00:00 2001 From: Edward O'Callaghan Date: Wed, 23 Nov 2022 22:37:19 +1100 Subject: tree/: Convert printlock func ptr into enumerate values Converting the printlock 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: I9131348f72c1010e2c213dca4dc4b675a8d8681e Signed-off-by: Edward O'Callaghan Reviewed-on: https://review.coreboot.org/c/flashrom/+/69934 Tested-by: build bot (Jenkins) Reviewed-by: Sam McNally Reviewed-by: Nikolai Artemiev --- flashrom.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'flashrom.c') diff --git a/flashrom.c b/flashrom.c index c5b795c1..b135e580 100644 --- a/flashrom.c +++ b/flashrom.c @@ -1179,9 +1179,11 @@ notfound: /* Flash registers may more likely not be mapped if the chip was forced. * Lock info may be stored in registers, so avoid lock info printing. */ - if (!force) - if (flash->chip->printlock) - flash->chip->printlock(flash); + if (!force) { + printlockfunc_t *printlock = lookup_printlock_func_ptr(flash); + if (printlock) + printlock(flash); + } /* Get out of the way for later runs. */ unmap_flash(flash); -- cgit v1.2.3