Start implementing struct flashprog_programmer
Our libflashprog API was already prepared for a programmer level context
stored in an opaque `struct flashprog_programmer`. We start filling this
struct with a pointer to the programmer driver (entry in the programmer
table) and a mutable copy of the parameter string.
Change-Id: If9a795627b1e50ea6006569e723f400ff337be20
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/72525
diff --git a/cli_classic.c b/cli_classic.c
index 1ffe4dd..79159c3 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -594,10 +594,11 @@
}
}
- if (programmer_init(prog, pparam)) {
+ struct flashprog_programmer *flashprog;
+ if (flashprog_programmer_init(&flashprog, prog->name, pparam)) {
msg_perr("Error: Programmer initialization failed.\n");
ret = 1;
- goto out_shutdown;
+ goto out;
}
tempstr = flashbuses_to_text(get_buses_supported());
msg_pdbg("The following protocols are supported: %s.\n", tempstr);
@@ -789,7 +790,7 @@
flashprog_layout_release(layout);
out_shutdown:
- flashprog_programmer_shutdown(NULL);
+ flashprog_programmer_shutdown(flashprog);
out:
for (i = 0; i < chipcount; i++) {
flashprog_layout_release(flashes[i].default_layout);