summaryrefslogtreecommitdiffstats
path: root/opaque.c
diff options
context:
space:
mode:
authorAnastasia Klimchuk <aklm@chromium.org>2021-08-03 14:08:02 +1000
committerNico Huber <nico.h@gmx.de>2021-08-17 16:30:46 +0000
commitc845e64b4f20b024e17827fe79853e799f76d858 (patch)
tree85a84fe848434a0240b87c6c8d8516c50d5440f0 /opaque.c
parentc87a770f5d7072122bc9d3c501a34905052daa7f (diff)
downloadflashrom-c845e64b4f20b024e17827fe79853e799f76d858.tar.gz
flashrom-c845e64b4f20b024e17827fe79853e799f76d858.tar.bz2
flashrom-c845e64b4f20b024e17827fe79853e799f76d858.zip
opaque_master: Add shutdown function in opaque_master struct
With this, register_opaque_master can take care of register_shutdown as well, and every opaque master only needs to call register_opaque_master instead of calling both register_opaque_master and register_shutdown. Next patches in the chain convert opaque masters to use new API. BUG=b:185191942 TEST=builds and ninja test from CB:56413 Change-Id: I34183e6bafc787eec54ee4a26b73a40803f3ce99 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/56823 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Diffstat (limited to 'opaque.c')
-rw-r--r--opaque.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/opaque.c b/opaque.c
index f098ffc15..7704ec7a7 100644
--- a/opaque.c
+++ b/opaque.c
@@ -50,6 +50,13 @@ int register_opaque_master(const struct opaque_master *mst, void *data)
{
struct registered_master rmst = {0};
+ if (mst->shutdown) {
+ if (register_shutdown(mst->shutdown, data)) {
+ mst->shutdown(data); /* cleanup */
+ return 1;
+ }
+ }
+
if (!mst->probe || !mst->read || !mst->write || !mst->erase) {
msg_perr("%s called with incomplete master definition. "
"Please report a bug at flashrom@flashrom.org\n",