Anastasia Klimchuk has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/57154 )
Change subject: par_master: Add shutdown function in par_master struct ......................................................................
par_master: Add shutdown function in par_master struct
With this, register_par_master can take care of register_shutdown as well, and every par master only needs to call register_par_master instead of calling both register_par_master and register_shutdown.
Next patches in the chain convert par masters to use new API.
BUG=b:185191942 TEST=builds and ninja test
Change-Id: I0fee15d548cdd16678e551eeb351e659812ddf76 Signed-off-by: Anastasia Klimchuk aklm@chromium.org --- M programmer.c M programmer.h 2 files changed, 8 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/54/57154/1
diff --git a/programmer.c b/programmer.c index c276a69..9a67157 100644 --- a/programmer.c +++ b/programmer.c @@ -86,6 +86,13 @@ { struct registered_master rmst = {0};
+ if (mst->shutdown) { + if (register_shutdown(mst->shutdown, data)) { + mst->shutdown(data); /* cleanup */ + return 1; + } + } + if (!mst->chip_writeb || !mst->chip_writew || !mst->chip_writel || !mst->chip_writen || !mst->chip_readb || !mst->chip_readw || !mst->chip_readl || !mst->chip_readn) { diff --git a/programmer.h b/programmer.h index 3de87e5..982343a 100644 --- a/programmer.h +++ b/programmer.h @@ -466,6 +466,7 @@ uint16_t (*chip_readw) (const struct flashctx *flash, const chipaddr addr); uint32_t (*chip_readl) (const struct flashctx *flash, const chipaddr addr); void (*chip_readn) (const struct flashctx *flash, uint8_t *buf, const chipaddr addr, size_t len); + int (*shutdown)(void *data); void *data; }; int register_par_master(const struct par_master *mst, const enum chipbustype buses, void *data);