Felix Singer has uploaded this change for review.
realtek_mst_i2c_spi.c: Move variable `reset` into parameters struct
Signed-off-by: Felix Singer <felixsinger@posteo.net>
Change-Id: I471ce9e6fedc5ec7f3d2bf54a0e1633dbac3cfd5
---
M realtek_mst_i2c_spi.c
1 file changed, 22 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/95/67895/1
diff --git a/realtek_mst_i2c_spi.c b/realtek_mst_i2c_spi.c
index 74458c8..6221134 100644
--- a/realtek_mst_i2c_spi.c
+++ b/realtek_mst_i2c_spi.c
@@ -54,6 +54,10 @@
bool reset;
};
+struct realtek_mst_i2c_spi_parameters {
+ bool reset;
+};
+
static int realtek_mst_i2c_spi_write_data(int fd, uint16_t addr, void *buf, uint16_t len)
{
i2c_buffer_t data;
@@ -444,7 +448,7 @@
.probe_opcode = default_spi_probe_opcode,
};
-static int get_params(const struct programmer_cfg *cfg, bool *reset, bool *enter_isp, bool *allow_brick)
+static int get_params(const struct programmer_cfg *cfg, bool *enter_isp, bool *allow_brick, struct realtek_mst_i2c_spi_parameters *parameters)
{
char *param_str;
int ret = 0;
@@ -461,13 +465,13 @@
}
free(param_str);
- *reset = false; /* Default behaviour is no MCU reset on tear-down. */
+ parameters->reset = false; /* Default behaviour is no MCU reset on tear-down. */
param_str = extract_programmer_param_str(cfg, "reset_mcu");
if (param_str) {
if (param_str[0] == '1') {
- *reset = true;
+ parameters->reset = true;
} else if (param_str[0] == '0') {
- *reset = false;
+ parameters->reset = false;
} else {
msg_perr("%s: Incorrect param format, reset_mcu=1 or 0.\n", __func__);
ret = SPI_GENERIC_ERROR;
@@ -495,9 +499,10 @@
static int realtek_mst_i2c_spi_init(const struct programmer_cfg *cfg)
{
int ret = 0;
- bool reset, enter_isp, allow_brick;
+ bool enter_isp, allow_brick;
+ struct realtek_mst_i2c_spi_parameters parameters = { 0 };
- if (get_params(cfg, &reset, &enter_isp, &allow_brick))
+ if (get_params(cfg, &enter_isp, &allow_brick, ¶meters))
return SPI_GENERIC_ERROR;
/*
@@ -535,7 +540,7 @@
}
data->fd = fd;
- data->reset = reset;
+ data->reset = parameters.reset;
return register_spi_master(&spi_master_i2c_realtek_mst, data);
}
To view, visit change 67895. To unsubscribe, or for help writing mail filters, visit settings.