From 45e0a071f13a684166335394c4ea40c9d055e198 Mon Sep 17 00:00:00 2001 From: Anastasia Klimchuk Date: Tue, 25 May 2021 13:53:25 +1000 Subject: spi_master: Make use of new register_spi_master() API Some more spi masters are now ready to get the advantage of new API and pass pointers to dynamically allocated data to register_spi_master(). This way we can avoid some mutable globals. BUG=b:185191942 TEST=./flashrom --programmer raiden_debug_spi -r $(mktemp) ./flashrom --programmer raiden_debug_spi -v /tmp/tmp.Fch5QLVb4R Change-Id: If72f54c28a95b402b3565fd14ea481f734e1c970 Signed-off-by: Anastasia Klimchuk Reviewed-on: https://review.coreboot.org/c/flashrom/+/54889 Reviewed-by: Edward O'Callaghan Tested-by: build bot (Jenkins) --- realtek_mst_i2c_spi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'realtek_mst_i2c_spi.c') diff --git a/realtek_mst_i2c_spi.c b/realtek_mst_i2c_spi.c index f0a6dce91..95c017fa0 100644 --- a/realtek_mst_i2c_spi.c +++ b/realtek_mst_i2c_spi.c @@ -410,7 +410,7 @@ static int realtek_mst_i2c_spi_write_aai(struct flashctx *flash, const uint8_t * return SPI_GENERIC_ERROR; } -static struct spi_master spi_master_i2c_realtek_mst = { +static const struct spi_master spi_master_i2c_realtek_mst = { .max_data_read = 16, .max_data_write = 8, .command = realtek_mst_i2c_spi_send_command, @@ -513,9 +513,7 @@ int realtek_mst_i2c_spi_init(void) data->fd = fd; data->reset = reset; ret |= register_shutdown(realtek_mst_i2c_spi_shutdown, data); - - spi_master_i2c_realtek_mst.data = data; - ret |= register_spi_master(&spi_master_i2c_realtek_mst, NULL); + ret |= register_spi_master(&spi_master_i2c_realtek_mst, data); return ret; } -- cgit v1.2.3