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/amd_spi100.c b/amd_spi100.c
index b112bfe..43d2623 100644
--- a/amd_spi100.c
+++ b/amd_spi100.c
@@ -96,7 +96,7 @@
const unsigned int writecnt, const unsigned int readcnt,
const unsigned char *const writearr, unsigned char *const readarr)
{
- const struct spi100 *const spi100 = flash->mst->spi.data;
+ const struct spi100 *const spi100 = flash->mst.spi->data;
int ret = spi100_check_readwritecnt(writecnt, readcnt);
if (ret)
@@ -139,7 +139,7 @@
static int spi100_read(struct flashctx *const flash, uint8_t *buf, unsigned int start, unsigned int len)
{
- const struct spi100 *const spi100 = flash->mst->spi.data;
+ const struct spi100 *const spi100 = flash->mst.spi->data;
const chipsize_t chip_size = flashprog_flash_getsize(flash);
/* Don't consider memory mapping at all