mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-01 14:11:15 +02:00
programmer: Smoothen register_spi_master() API
It was impossible to register a const struct spi_master that would point to dynamically allocated `data`. Fix that so that we won't have to create more mutable globals. Change-Id: I0c753b3db050fb87d4bbe2301a7ead854f28456f Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/54066 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
4
spi.c
4
spi.c
@ -131,7 +131,7 @@ int spi_aai_write(struct flashctx *flash, const uint8_t *buf, unsigned int start
|
||||
return flash->mst->spi.write_aai(flash, buf, start, len);
|
||||
}
|
||||
|
||||
int register_spi_master(const struct spi_master *mst)
|
||||
int register_spi_master(const struct spi_master *mst, void *data)
|
||||
{
|
||||
struct registered_master rmst = {0};
|
||||
|
||||
@ -148,5 +148,7 @@ int register_spi_master(const struct spi_master *mst)
|
||||
|
||||
rmst.buses_supported = BUS_SPI;
|
||||
rmst.spi = *mst;
|
||||
if (data)
|
||||
rmst.spi.data = data;
|
||||
return register_master(&rmst);
|
||||
}
|
||||
|
Reference in New Issue
Block a user