From 90739d147f1d9b90789873fdbe74da6c616cad6b Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Tue, 11 May 2021 17:53:34 +0200 Subject: programmer: Make use of new register_spi_master() API Pass pointers to dynamically allocated data to register_spi_master(). This way we can avoid some mutable globals. Change-Id: Id7821f1db3284b7b5b3d0abfd878b979c53870a1 Signed-off-by: Nico Huber Reviewed-on: https://review.coreboot.org/c/flashrom/+/54067 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons --- lspcon_i2c_spi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lspcon_i2c_spi.c') diff --git a/lspcon_i2c_spi.c b/lspcon_i2c_spi.c index 6b8dfe66..7f5e3efd 100644 --- a/lspcon_i2c_spi.c +++ b/lspcon_i2c_spi.c @@ -408,7 +408,7 @@ static int lspcon_i2c_spi_write_aai(struct flashctx *flash, const uint8_t *buf, return SPI_GENERIC_ERROR; } -static struct spi_master spi_master_i2c_lspcon = { +static const struct spi_master spi_master_i2c_lspcon = { .max_data_read = 16, .max_data_write = 12, .command = lspcon_i2c_spi_send_command, @@ -454,10 +454,9 @@ int lspcon_i2c_spi_init(void) } data->fd = fd; - spi_master_i2c_lspcon.data = data; ret |= register_shutdown(lspcon_i2c_spi_shutdown, data); - ret |= register_spi_master(&spi_master_i2c_lspcon, NULL); + ret |= register_spi_master(&spi_master_i2c_lspcon, data); return ret; } -- cgit v1.2.3