Draw struct flashchip into struct flashprog_flashctx
We used to have a reference to a dynamically allocated struct flashchip
inside the flash context. But now that we only ever allocate both in one
go, we can let go of the reference and make it a single structure.
Change-Id: I857acb1def6d133a5cbc28fc7a99b7b1a22b55e0
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/494
diff --git a/sfdp.c b/sfdp.c
index b1d7777..bb01e79 100644
--- a/sfdp.c
+++ b/sfdp.c
@@ -453,7 +453,7 @@
msg_cdbg("Length of the mandatory JEDEC SFDP "
"parameter table is wrong (%d B), "
"skipping it.\n", len);
- } else if (sfdp_fill_flash(flash->chip, tbuf, len) == 0)
+ } else if (sfdp_fill_flash(&flash->chip, tbuf, len) == 0)
ret = 0;
}
free(tbuf);
@@ -466,7 +466,7 @@
if (ret)
return ret;
- if (selfcheck_chip(flash->chip, -1)) {
+ if (selfcheck_chip(&flash->chip, -1)) {
msg_cerr("SFDP parsing resulted in invalid chip structure.\n");
return SPI_FLASHPROG_BUG;
}
@@ -489,8 +489,8 @@
/* Chain preparation in case we replaced the .prepare_access
pointer, e.g. spi_prepare_io() is needed for 4BA mode. */
- if (flash->chip->prepare_access != spi_prepare_sfdp)
- ret = flash->chip->prepare_access(flash);
+ if (flash->chip.prepare_access != spi_prepare_sfdp)
+ ret = flash->chip.prepare_access(flash);
return ret;
}