Nico Huber submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved
raiden_debug_spi: Use spi data in configure_protocol

Spi data for this programmer now contains pointer to spi_master
struct, and can be used in configure_protocol.

This patch is making init code of raiden_debug_spi a bit more
consistent with other programmers, for example it allows to remove
data assignment `spi_config->data = data` from init function. This
assignment was only needed for configure_protocol function, and
now it is not needed anymore.

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

Change-Id: I5df0609efcd1fdb274b8cc84536253d5dbae5270
Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/57973
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, 5 insertions(+), 7 deletions(-)

diff --git a/raiden_debug_spi.c b/raiden_debug_spi.c
index 9cba2a8..6a79000 100644
--- a/raiden_debug_spi.c
+++ b/raiden_debug_spi.c
@@ -1317,15 +1317,14 @@
* is being used by the device USB SPI interface and if needed query the
* device for its capabilities.
*
- * @param spi_config Raiden SPI config which will be modified.
+ * @param ctx_data Raiden SPI data, data contains pointer to config which will be modified.
*
- * @returns Returns status code with 0 on success.
+ * @returns Returns status code with 0 on success.
*/
-static int configure_protocol(struct spi_master *spi_config)
+static int configure_protocol(struct raiden_debug_spi_data *ctx_data)
{
int status = 0;
- struct raiden_debug_spi_data *ctx_data =
- (struct raiden_debug_spi_data *)spi_config->data;
+ struct spi_master *spi_config = ctx_data->spi_config;

ctx_data->protocol_version =
ctx_data->dev->interface_descriptor->bInterfaceProtocol;
@@ -1596,13 +1595,12 @@
data->out_ep = out_endpoint;
data->spi_config = spi_config;

- spi_config->data = data; /* data is needed to configure protocol below */
/*
* The SPI master needs to be configured based on the device connected.
* Using the device protocol interrogation, we will set the limits on
* the write and read sizes and switch command functions.
*/
- ret = configure_protocol(spi_config);
+ ret = configure_protocol(data);
if (ret) {
msg_perr("Raiden: Error configuring protocol\n"
" protocol = %u\n"

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

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I5df0609efcd1fdb274b8cc84536253d5dbae5270
Gerrit-Change-Number: 57973
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