Edward O'Callaghan submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Edward O'Callaghan: Looks good to me, approved
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>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/57154
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
---
M programmer.c
M programmer.h
2 files changed, 8 insertions(+), 0 deletions(-)

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);

To view, visit change 57154. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I0fee15d548cdd16678e551eeb351e659812ddf76
Gerrit-Change-Number: 57154
Gerrit-PatchSet: 2
Gerrit-Owner: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter@mailbox.org>
Gerrit-MessageType: merged