1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-02 22:43:17 +02:00

spi_master: Make use of new register_spi_master() API

Some more spi masters are now ready to get the advantage of new API
and pass pointers to dynamically allocated data to
register_spi_master(). This way we can avoid some mutable globals.

BUG=b:185191942
TEST=./flashrom --programmer raiden_debug_spi -r $(mktemp)
./flashrom --programmer raiden_debug_spi -v /tmp/tmp.Fch5QLVb4R

Change-Id: If72f54c28a95b402b3565fd14ea481f734e1c970
Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/54889
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Anastasia Klimchuk
2021-05-25 13:53:25 +10:00
committed by Edward O'Callaghan
parent 89a16e4df6
commit 45e0a071f1
4 changed files with 8 additions and 12 deletions

View File

@ -397,7 +397,7 @@ mec1308_spi_send_command_exit:
return rc;
}
static struct spi_master spi_master_mec1308 = {
static const struct spi_master spi_master_mec1308 = {
.max_data_read = 256, /* FIXME: should be MAX_DATA_READ_UNLIMITED? */
.max_data_write = 256, /* FIXME: should be MAX_DATA_WRITE_UNLIMITED? */
.command = mec1308_spi_send_command,
@ -505,11 +505,10 @@ int mec1308_init(void)
goto init_err_cleanup_exit;
internal_buses_supported |= BUS_LPC; /* for LPC <--> SPI bridging */
spi_master_mec1308.data = ctx_data;
if (register_shutdown(mec1308_shutdown, ctx_data))
goto init_err_cleanup_exit;
register_spi_master(&spi_master_mec1308, NULL);
register_spi_master(&spi_master_mec1308, ctx_data);
msg_pdbg("%s(): successfully initialized mec1308\n", __func__);
return 0;