par_master: Use new API to register shutdown function
This allows par masters to register shutdown function in par_master
struct, which means there is no need to call register_shutdown in init
function, since this call is now a part of register_par_master.
As a consequence of using new API, this patch also fixes propagation
of register_par_master() return values.
Tested: builds and ninja test
Change-Id: Ief7be907f53878b4b6567b52889735e5fff64ead
Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/57156
Original-Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/72233
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/nicrealtek.c b/nicrealtek.c
index 16ede42..4f39bc3 100644
--- a/nicrealtek.c
+++ b/nicrealtek.c
@@ -37,6 +37,7 @@
static void nicrealtek_chip_writeb(const struct flashctx *flash, uint8_t val, chipaddr addr);
static uint8_t nicrealtek_chip_readb(const struct flashctx *flash, const chipaddr addr);
+static int nicrealtek_shutdown(void *data);
static const struct par_master par_master_nicrealtek = {
.chip_readb = nicrealtek_chip_readb,
.chip_readw = fallback_chip_readw,
@@ -46,6 +47,7 @@
.chip_writew = fallback_chip_writew,
.chip_writel = fallback_chip_writel,
.chip_writen = fallback_chip_writen,
+ .shutdown = nicrealtek_shutdown,
};
static int nicrealtek_shutdown(void *data)
@@ -83,12 +85,7 @@
break;
}
- if (register_shutdown(nicrealtek_shutdown, NULL))
- return 1;
-
- register_par_master(&par_master_nicrealtek, BUS_PARALLEL, NULL);
-
- return 0;
+ return register_par_master(&par_master_nicrealtek, BUS_PARALLEL, NULL);
}
static void nicrealtek_chip_writeb(const struct flashctx *flash, uint8_t val, chipaddr addr)