diff options
author | Nico Huber <nico.h@gmx.de> | 2021-05-11 17:53:34 +0200 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2021-05-13 14:37:43 +0000 |
commit | 90739d147f1d9b90789873fdbe74da6c616cad6b (patch) | |
tree | 019d727f7b3289a0d71c831374e2f33c3ae1b66a /wbsio_spi.c | |
parent | 7e4968525d37d87e8b6f8b848e4f2f9696926237 (diff) | |
download | flashrom-90739d147f1d9b90789873fdbe74da6c616cad6b.tar.gz flashrom-90739d147f1d9b90789873fdbe74da6c616cad6b.tar.bz2 flashrom-90739d147f1d9b90789873fdbe74da6c616cad6b.zip |
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>
Diffstat (limited to 'wbsio_spi.c')
-rw-r--r-- | wbsio_spi.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/wbsio_spi.c b/wbsio_spi.c index 9eed495c..d17d49dc 100644 --- a/wbsio_spi.c +++ b/wbsio_spi.c @@ -177,7 +177,7 @@ static int wbsio_spi_read(struct flashctx *flash, uint8_t *buf, return 0; } -static struct spi_master spi_master_wbsio = { +static const struct spi_master spi_master_wbsio = { .max_data_read = MAX_DATA_UNSPECIFIED, .max_data_write = MAX_DATA_UNSPECIFIED, .command = wbsio_spi_send_command, @@ -215,8 +215,7 @@ int wbsio_check_for_spi(void) data->spibase = wbsio_spibase; register_shutdown(wbsio_spi_shutdown, data); - spi_master_wbsio.data = data; - register_spi_master(&spi_master_wbsio, NULL); + register_spi_master(&spi_master_wbsio, data); return 0; } |