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/spi25_statusreg.c b/spi25_statusreg.c
index 6ba4e45..e7aef36 100644
--- a/spi25_statusreg.c
+++ b/spi25_statusreg.c
@@ -59,7 +59,7 @@
int spi_write_register(const struct flashctx *flash, enum flash_reg reg,
uint8_t value, enum wrsr_target target)
{
- int feature_bits = flash->chip->feature_bits;
+ int feature_bits = flash->chip.feature_bits;
uint8_t write_cmd[4];
size_t write_cmd_len = 0;
@@ -195,7 +195,7 @@
int spi_read_register(const struct flashctx *flash, enum flash_reg reg, uint8_t *value)
{
- int feature_bits = flash->chip->feature_bits;
+ int feature_bits = flash->chip.feature_bits;
uint8_t read_cmd;
switch (reg) {
@@ -323,8 +323,8 @@
if ((status & bp_mask) != 0) {
msg_cerr("Block protection could not be disabled!\n");
- if (flash->chip->printlock)
- flash->chip->printlock(flash);
+ if (flash->chip.printlock)
+ flash->chip.printlock(flash);
return 1;
}
msg_cdbg("disabled.\n");
@@ -864,7 +864,7 @@
spi_prettyprint_status_register_hex(status);
spi_prettyprint_status_register_srwd(status);
- if (flash->chip->total_size <= 32 / 8 * 1024) /* N25Q16 and N25Q32: reserved */
+ if (flash->chip.total_size <= 32 / 8 * 1024) /* N25Q16 and N25Q32: reserved */
spi_prettyprint_status_register_bit(status, 6);
else
msg_cdbg("Chip status register: Block Protect 3 (BP3) is %sset\n",