mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-02 06:23:18 +02:00
parallel.c: Consoldiate parallel master registration logic
This is analogous to spi.c and opaque.c however parallel logic was previously never consoldiated. This free's up flashrom.c from namespace pollution. BUG=b:242246291 TEST=builds with both make and meson. Change-Id: Ie08e2e6c51ccef5281386bf7e3df439b91573974 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66651 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Thomas Heijligen <src@posteo.de>
This commit is contained in:

committed by
Edward O'Callaghan

parent
16744f9e96
commit
8f9e910eb3
29
programmer.c
29
programmer.c
@ -80,35 +80,6 @@ void fallback_chip_readn(const struct flashctx *flash, uint8_t *buf,
|
||||
return;
|
||||
}
|
||||
|
||||
int register_par_master(const struct par_master *mst,
|
||||
const enum chipbustype buses,
|
||||
void *data)
|
||||
{
|
||||
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) {
|
||||
msg_perr("%s called with incomplete master definition. "
|
||||
"Please report a bug at flashrom@flashrom.org\n",
|
||||
__func__);
|
||||
return ERROR_FLASHROM_BUG;
|
||||
}
|
||||
|
||||
rmst.buses_supported = buses;
|
||||
rmst.par = *mst;
|
||||
if (data)
|
||||
rmst.par.data = data;
|
||||
return register_master(&rmst);
|
||||
}
|
||||
|
||||
/* The limit of 4 is totally arbitrary. */
|
||||
#define MASTERS_MAX 4
|
||||
struct registered_master registered_masters[MASTERS_MAX];
|
||||
|
Reference in New Issue
Block a user