Felix Singer has uploaded this change for review.

View Change

jlink_spi.c: Move reset_cs variable into struct `jlink_spi_parameters`

Signed-off-by: Felix Singer <felixsinger@posteo.net>
Change-Id: I79f9009b407bc5601fa03878b6fe53c190214c3f
---
M jlink_spi.c
1 file changed, 16 insertions(+), 7 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/88/67888/1
diff --git a/jlink_spi.c b/jlink_spi.c
index 8b4a83b..24ab466 100644
--- a/jlink_spi.c
+++ b/jlink_spi.c
@@ -197,6 +197,7 @@
unsigned long speed;
uint32_t serial_number;
bool use_serial_number;
+ bool reset_cs;
};

static int jlink_spi_init(const struct programmer_cfg *cfg)
@@ -204,7 +205,6 @@
char *param_str;
struct jaylink_context *jaylink_ctx = NULL;
struct jaylink_device_handle *jaylink_devh = NULL;
- bool reset_cs;
struct jlink_spi_data *jlink_data = NULL;
struct jlink_spi_parameters parameters = { 0 };
bool enable_target_power;
@@ -256,14 +256,13 @@
free(param_str);
}

- reset_cs = true;
+ parameters.reset_cs = true;
param_str = extract_programmer_param_str(cfg, "cs");
-
if (param_str) {
if (!strcasecmp(param_str, "reset")) {
- reset_cs = true;
+ parameters.reset_cs = true;
} else if (!strcasecmp(param_str, "trst")) {
- reset_cs = false;
+ parameters.reset_cs = false;
} else {
msg_perr("Invalid chip select pin specified: '%s'.\n", param_str);
free(param_str);
@@ -272,7 +271,7 @@
free(param_str);
}

- if (reset_cs)
+ if (parameters.reset_cs)
msg_pdbg("Using RESET as chip select signal.\n");
else
msg_pdbg("Using TRST as chip select signal.\n");
@@ -504,7 +503,7 @@
/* jaylink_ctx, jaylink_devh are allocated by jaylink_init and jaylink_open */
jlink_data->ctx = jaylink_ctx;
jlink_data->devh = jaylink_devh;
- jlink_data->reset_cs = reset_cs;
+ jlink_data->reset_cs = parameters.reset_cs;
jlink_data->enable_target_power = enable_target_power;

/* Ensure that the CS signal is not active initially. */

To view, visit change 67888. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I79f9009b407bc5601fa03878b6fe53c190214c3f
Gerrit-Change-Number: 67888
Gerrit-PatchSet: 1
Gerrit-Owner: Felix Singer <felixsinger@posteo.net>
Gerrit-MessageType: newchange