mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-02 14:33:18 +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:
@ -340,7 +340,7 @@ static int parse_voltage(char *voltage)
|
||||
return millivolt;
|
||||
}
|
||||
|
||||
static struct spi_master spi_master_pickit2 = {
|
||||
static const struct spi_master spi_master_pickit2 = {
|
||||
.max_data_read = 40,
|
||||
.max_data_write = 40,
|
||||
.command = pickit2_spi_send_command,
|
||||
@ -477,7 +477,6 @@ int pickit2_spi_init(void)
|
||||
return 1;
|
||||
}
|
||||
pickit2_data->pickit2_handle = pickit2_handle;
|
||||
spi_master_pickit2.data = pickit2_data;
|
||||
|
||||
if (pickit2_get_firmware_version(pickit2_handle))
|
||||
goto init_err_cleanup_exit;
|
||||
@ -501,7 +500,7 @@ int pickit2_spi_init(void)
|
||||
|
||||
if (register_shutdown(pickit2_shutdown, pickit2_data))
|
||||
goto init_err_cleanup_exit;
|
||||
register_spi_master(&spi_master_pickit2, NULL);
|
||||
register_spi_master(&spi_master_pickit2, pickit2_data);
|
||||
|
||||
return 0;
|
||||
|
||||
|
Reference in New Issue
Block a user