opaque: Move probing into PREPARE_POST_PROBE hook
To get rid of the flash context in probing, we have to split the
detection of chip parameters out into a preparation step. Below
the opaque-master API, things could actually stay as they are,
we rename `.probe` to `.prepare` though for completeness.
Change-Id: Ic8418e6c5bdc49f5133cdb21efed0bf6dc2f820e
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/449
diff --git a/nicintel_eeprom.c b/nicintel_eeprom.c
index 2839e7b..207782c 100644
--- a/nicintel_eeprom.c
+++ b/nicintel_eeprom.c
@@ -103,7 +103,7 @@
return (device_id & 0xfff0) == 0x1530;
}
-static int nicintel_ee_probe_i210(struct flashctx *flash)
+static int nicintel_ee_prepare_i210(struct flashctx *flash)
{
/* Emulated eeprom has a fixed size of 4 KB */
flash->chip->total_size = 4;
@@ -116,7 +116,7 @@
return 1;
}
-static int nicintel_ee_probe_82580(struct flashctx *flash)
+static int nicintel_ee_prepare_82580(struct flashctx *flash)
{
if (nicintel_pci->device_id == UNPROG_DEVICE)
flash->chip->total_size = 16; /* Fall back to minimum supported size. */
@@ -406,7 +406,7 @@
static int nicintel_ee_shutdown_82580(void *eecp);
static const struct opaque_master opaque_master_nicintel_ee_82580 = {
- .probe = nicintel_ee_probe_82580,
+ .prepare = nicintel_ee_prepare_82580,
.read = nicintel_ee_read,
.write = nicintel_ee_write_82580,
.erase = nicintel_ee_erase_82580,
@@ -416,7 +416,7 @@
static int nicintel_ee_shutdown_i210(void *arg);
static const struct opaque_master opaque_master_nicintel_ee_i210 = {
- .probe = nicintel_ee_probe_i210,
+ .prepare = nicintel_ee_prepare_i210,
.read = nicintel_ee_read,
.write = nicintel_ee_write_i210,
.erase = nicintel_ee_erase_i210,