Nico Huber submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved
raiden_debug_spi: Move shutdown function above spi_master struct

This patch prepares the programmer to use new API which allows to
register shutdown function in spi_master struct. See also later
patch in this chain, where the programmer is converted to new API.

BUG=b:185191942
TEST=test in CB:57918

Change-Id: I567e24c9d39e24a4a1634ddcbdd05930760afcdc
Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/57974
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
---
M raiden_debug_spi.c
1 file changed, 31 insertions(+), 31 deletions(-)

diff --git a/raiden_debug_spi.c b/raiden_debug_spi.c
index 6a79000..a2fddb4 100644
--- a/raiden_debug_spi.c
+++ b/raiden_debug_spi.c
@@ -1258,6 +1258,37 @@
return status;
}

+static int raiden_debug_spi_shutdown(void * data)
+{
+ struct raiden_debug_spi_data *ctx_data = (struct raiden_debug_spi_data *)data;
+ struct spi_master *spi_config = ctx_data->spi_config;
+
+ int ret = LIBUSB(libusb_control_transfer(
+ ctx_data->dev->handle,
+ LIBUSB_ENDPOINT_OUT |
+ LIBUSB_REQUEST_TYPE_VENDOR |
+ LIBUSB_RECIPIENT_INTERFACE,
+ RAIDEN_DEBUG_SPI_REQ_DISABLE,
+ 0,
+ ctx_data->dev->interface_descriptor->bInterfaceNumber,
+ NULL,
+ 0,
+ TRANSFER_TIMEOUT_MS));
+ if (ret != 0) {
+ msg_perr("Raiden: Failed to disable SPI bridge\n");
+ free(ctx_data);
+ free(spi_config);
+ return ret;
+ }
+
+ usb_device_free(ctx_data->dev);
+ libusb_exit(NULL);
+ free(ctx_data);
+ free(spi_config);
+
+ return 0;
+}
+
static const struct spi_master spi_master_raiden_debug = {
.features = SPI_MASTER_4BA,
.max_data_read = 0,
@@ -1375,37 +1406,6 @@
return 0;
}

-static int raiden_debug_spi_shutdown(void * data)
-{
- struct raiden_debug_spi_data *ctx_data = (struct raiden_debug_spi_data *)data;
- struct spi_master *spi_config = ctx_data->spi_config;
-
- int ret = LIBUSB(libusb_control_transfer(
- ctx_data->dev->handle,
- LIBUSB_ENDPOINT_OUT |
- LIBUSB_REQUEST_TYPE_VENDOR |
- LIBUSB_RECIPIENT_INTERFACE,
- RAIDEN_DEBUG_SPI_REQ_DISABLE,
- 0,
- ctx_data->dev->interface_descriptor->bInterfaceNumber,
- NULL,
- 0,
- TRANSFER_TIMEOUT_MS));
- if (ret != 0) {
- msg_perr("Raiden: Failed to disable SPI bridge\n");
- free(ctx_data);
- free(spi_config);
- return ret;
- }
-
- usb_device_free(ctx_data->dev);
- libusb_exit(NULL);
- free(ctx_data);
- free(spi_config);
-
- return 0;
-}
-
static int get_ap_request_type(void)
{
int ap_request = RAIDEN_DEBUG_SPI_REQ_ENABLE_AP;

1 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one.

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

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I567e24c9d39e24a4a1634ddcbdd05930760afcdc
Gerrit-Change-Number: 57974
Gerrit-PatchSet: 3
Gerrit-Owner: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Nikolai Artemiev <nartemiev@google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter@mailbox.org>
Gerrit-MessageType: merged