diff options
author | Anastasia Klimchuk <aklm@chromium.org> | 2021-07-06 16:03:11 +1000 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2021-08-17 09:39:18 +0000 |
commit | 0a7f036610673f6664c9d1492912abfdfbdf9f20 (patch) | |
tree | ca67f6d90b777debae831039267adfcab01c18d9 /dummyflasher.c | |
parent | 5a97be363a269b364569be8223369d9a5bf92292 (diff) | |
download | flashrom-0a7f036610673f6664c9d1492912abfdfbdf9f20.tar.gz flashrom-0a7f036610673f6664c9d1492912abfdfbdf9f20.tar.bz2 flashrom-0a7f036610673f6664c9d1492912abfdfbdf9f20.zip |
spi_master: Move shutdown function above spi_master struct
This patch prepares spi masters to use new API which allows to
register shutdown function in spi_master struct. See also later
patch in this chain, where spi masters are converted to new API.
BUG=b:185191942
TEST=builds and ninja test
Comparing flashrom binary before and after the patch,
make clean && make CONFIG_EVERYTHING=yes VERSION=none
binary is the same
Change-Id: I50716686552b4ddcc6089d5afadb19ef59d9f9b4
Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/56101
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'dummyflasher.c')
-rw-r--r-- | dummyflasher.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/dummyflasher.c b/dummyflasher.c index 049f9d5a..23115764 100644 --- a/dummyflasher.c +++ b/dummyflasher.c @@ -580,7 +580,23 @@ static int dummy_spi_send_command(const struct flashctx *flash, unsigned int wri return 0; } - +static int dummy_shutdown(void *data) +{ + msg_pspew("%s\n", __func__); + struct emu_data *emu_data = (struct emu_data *)data; + if (emu_data->emu_chip != EMULATE_NONE) { + if (emu_data->emu_persistent_image && emu_data->emu_modified) { + msg_pdbg("Writing %s\n", emu_data->emu_persistent_image); + write_buf_to_file(emu_data->flashchip_contents, + emu_data->emu_chip_size, + emu_data->emu_persistent_image); + } + free(emu_data->emu_persistent_image); + free(emu_data->flashchip_contents); + } + free(data); + return 0; +} static const struct spi_master spi_master_dummyflasher = { .features = SPI_MASTER_4BA, @@ -604,24 +620,6 @@ static const struct par_master par_master_dummyflasher = { .chip_writen = dummy_chip_writen, }; -static int dummy_shutdown(void *data) -{ - msg_pspew("%s\n", __func__); - struct emu_data *emu_data = (struct emu_data *)data; - if (emu_data->emu_chip != EMULATE_NONE) { - if (emu_data->emu_persistent_image && emu_data->emu_modified) { - msg_pdbg("Writing %s\n", emu_data->emu_persistent_image); - write_buf_to_file(emu_data->flashchip_contents, - emu_data->emu_chip_size, - emu_data->emu_persistent_image); - } - free(emu_data->emu_persistent_image); - free(emu_data->flashchip_contents); - } - free(data); - return 0; -} - static int init_data(struct emu_data *data, enum chipbustype *dummy_buses_supported) { |