Felix Singer has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/67887 )
Change subject: jlink_spi.c: Move serial number vars to struct `jlink_spi_parameters` ......................................................................
jlink_spi.c: Move serial number vars to struct `jlink_spi_parameters`
Signed-off-by: Felix Singer felixsinger@posteo.net Change-Id: Ib22224cca4c02f82a643488c118b88cba6b6a50a --- M jlink_spi.c 1 file changed, 19 insertions(+), 9 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/87/67887/1
diff --git a/jlink_spi.c b/jlink_spi.c index e7e5913..c93b084 100644 --- a/jlink_spi.c +++ b/jlink_spi.c @@ -195,6 +195,8 @@
struct jlink_spi_parameters { unsigned long speed; + uint32_t serial_number; + bool use_serial_number; };
static int jlink_spi_init(const struct programmer_cfg *cfg) @@ -229,8 +231,6 @@ }
int ret; - bool use_serial_number = false; - uint32_t serial_number;
param_str = extract_programmer_param_str(cfg, "serial");
@@ -241,7 +241,7 @@ return 1; }
- ret = jaylink_parse_serial_number(param_str, &serial_number); + ret = jaylink_parse_serial_number(param_str, ¶meters.serial_number);
if (ret == JAYLINK_ERR) { msg_perr("Invalid serial number specified: %s.\n", param_str); @@ -253,7 +253,7 @@ return 1; }
- use_serial_number = true; + parameters.use_serial_number = true; free(param_str); }
@@ -315,7 +315,7 @@ goto init_err; }
- if (!use_serial_number) + if (!parameters.use_serial_number) msg_pdbg("No device selected, using first device.\n");
size_t i; @@ -323,7 +323,7 @@ bool device_found = false;
for (i = 0; devs[i]; i++) { - if (use_serial_number) { + if (parameters.use_serial_number) { uint32_t tmp;
ret = jaylink_device_get_serial_number(devs[i], &tmp); @@ -336,7 +336,7 @@ continue; }
- if (serial_number != tmp) + if (parameters.serial_number != tmp) continue; }
@@ -371,10 +371,10 @@ free(firmware_version); }
- ret = jaylink_device_get_serial_number(dev, &serial_number); + ret = jaylink_device_get_serial_number(dev, ¶meters.serial_number);
if (ret == JAYLINK_OK) { - msg_pdbg("S/N: %" PRIu32 "\n", serial_number); + msg_pdbg("S/N: %" PRIu32 "\n", parameters.serial_number); } else if (ret == JAYLINK_ERR_NOT_AVAILABLE) { msg_pdbg("S/N: N/A\n"); } else {