1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-02 22:43:17 +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

@ -611,7 +611,7 @@ static int dummy_spi_send_command(const struct flashctx *flash, unsigned int wri
static struct spi_master spi_master_dummyflasher = {
static const struct spi_master spi_master_dummyflasher = {
.features = SPI_MASTER_4BA,
.max_data_read = MAX_DATA_READ_UNLIMITED,
.max_data_write = MAX_DATA_UNSPECIFIED,
@ -674,7 +674,6 @@ int dummy_init(void)
}
data->emu_chip = EMULATE_NONE;
data->delay_us = 0;
spi_master_dummyflasher.data = data;
par_master_dummy.data = data;
msg_pspew("%s\n", __func__);
@ -1030,7 +1029,7 @@ dummy_init_out:
register_par_master(&par_master_dummy,
dummy_buses_supported & (BUS_PARALLEL | BUS_LPC | BUS_FWH));
if (dummy_buses_supported & BUS_SPI)
register_spi_master(&spi_master_dummyflasher, NULL);
register_spi_master(&spi_master_dummyflasher, data);
return 0;
}