mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-01 14:11:15 +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:
@ -155,7 +155,7 @@ static int jlink_spi_send_command(const struct flashctx *flash, unsigned int wri
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct spi_master spi_master_jlink_spi = {
|
||||
static const struct spi_master spi_master_jlink_spi = {
|
||||
/* Maximum data read size in one go (excluding opcode+address). */
|
||||
.max_data_read = JTAG_MAX_TRANSFER_SIZE - 5,
|
||||
/* Maximum data write size in one go (excluding opcode+address). */
|
||||
@ -464,7 +464,6 @@ int jlink_spi_init(void)
|
||||
jlink_data->ctx = jaylink_ctx;
|
||||
jlink_data->devh = jaylink_devh;
|
||||
jlink_data->reset_cs = reset_cs;
|
||||
spi_master_jlink_spi.data = jlink_data;
|
||||
|
||||
/* Ensure that the CS signal is not active initially. */
|
||||
if (!deassert_cs(jlink_data))
|
||||
@ -472,7 +471,7 @@ int jlink_spi_init(void)
|
||||
|
||||
if (register_shutdown(jlink_spi_shutdown, jlink_data))
|
||||
goto init_err;
|
||||
register_spi_master(&spi_master_jlink_spi, NULL);
|
||||
register_spi_master(&spi_master_jlink_spi, jlink_data);
|
||||
|
||||
return 0;
|
||||
|
||||
|
Reference in New Issue
Block a user