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 /dediprog.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 'dediprog.c')
-rw-r--r-- | dediprog.c | 36 |
1 files changed, 18 insertions, 18 deletions
@@ -992,6 +992,24 @@ static int parse_voltage(char *voltage) return millivolt; } +static int dediprog_shutdown(void *data) +{ + dediprog_devicetype = DEV_UNKNOWN; + + /* URB 28. Command Set SPI Voltage to 0. */ + if (dediprog_set_spi_voltage(0x0)) + return 1; + + if (libusb_release_interface(dediprog_handle, 0)) { + msg_perr("Could not release USB interface!\n"); + return 1; + } + libusb_close(dediprog_handle); + libusb_exit(usb_ctx); + + return 0; +} + static struct spi_master spi_master_dediprog = { .features = SPI_MASTER_NO_4BA_MODES, .max_data_read = 16, /* 18 seems to work fine as well, but 19 times out sometimes with FW 5.15. */ @@ -1037,24 +1055,6 @@ static int dediprog_open(int index) return 0; } -static int dediprog_shutdown(void *data) -{ - dediprog_devicetype = DEV_UNKNOWN; - - /* URB 28. Command Set SPI Voltage to 0. */ - if (dediprog_set_spi_voltage(0x0)) - return 1; - - if (libusb_release_interface(dediprog_handle, 0)) { - msg_perr("Could not release USB interface!\n"); - return 1; - } - libusb_close(dediprog_handle); - libusb_exit(usb_ctx); - - return 0; -} - static int dediprog_init(void) { char *voltage, *id_str, *device, *spispeed, *target_str; |