1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-06-30 21:52:36 +02:00

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 <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/54067
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Nico Huber
2021-05-11 17:53:34 +02:00
parent 7e4968525d
commit 90739d147f
11 changed files with 22 additions and 35 deletions

View File

@ -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;
}