Let the flash context directly point to the used master
We used to have a pointer to a full `registered_master` struct in
our flash context. Beside the used master, this contained a bit
mask of supported buses. Oddly convenient, this bit mask invited
to bypass the chip driver and break the abstraction. It allowed
to place bus-specific details virtually anywhere in flashprog,
making it harder to find a good place for them.
So, get rid of the `buses_supported` bit mask by pointing directly
to the master. Only the chip driver will implicitly know which type
of master is used.
Change-Id: I9ce13d8df0e7ccc67519d888dd9cb2e2ff8d6682
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/72533
diff --git a/dummyflasher.c b/dummyflasher.c
index 6b74ce2..948dc0b 100644
--- a/dummyflasher.c
+++ b/dummyflasher.c
@@ -1149,7 +1149,7 @@
unsigned char *readarr)
{
unsigned int i;
- struct emu_data *emu_data = flash->mst->spi.data;
+ struct emu_data *emu_data = flash->mst.spi->data;
if (!emu_data) {
msg_perr("No data in flash context!\n");
return 1;
@@ -1188,14 +1188,14 @@
static int dummy_spi_write_256(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len)
{
- const struct emu_data *const data = flash->mst->spi.data;
+ const struct emu_data *const data = flash->mst.spi->data;
return spi_write_chunked(flash, buf, start, len, data->spi_write_256_chunksize);
}
static bool dummy_spi_probe_opcode(const struct flashctx *flash, uint8_t opcode)
{
size_t i;
- const struct emu_data *emu_data = flash->mst->spi.data;
+ const struct emu_data *emu_data = flash->mst.spi->data;
for (i = 0; i < emu_data->spi_blacklist_size; i++) {
if (emu_data->spi_blacklist[i] == opcode)
return false;