Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/49107 )
Change subject: tree/: Drop const from opaque data ptr in master definitions ......................................................................
tree/: Drop const from opaque data ptr in master definitions
The opaque data pointer need not necessarily have constant data for the life-time of the specific master. This is because the data field purpose is for the master to use as it sees fit for managing its own internal state and therefore we should not constrain this as being RO data at init time.
BUG=none BRANCH=none TEST=builds
Change-Id: Id6844cd0c3666c0a1b8c5f738e8d6b957e56d1b0 Signed-off-by: Edward O'Callaghan quasisec@google.com --- M bitbang_spi.c M developerbox_spi.c M mcp6x_spi.c M nicintel_spi.c M ogp_spi.c M pony_spi.c M programmer.h M rayer_spi.c 8 files changed, 11 insertions(+), 11 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/07/49107/1
diff --git a/bitbang_spi.c b/bitbang_spi.c index c402119..ed0fd8a 100644 --- a/bitbang_spi.c +++ b/bitbang_spi.c @@ -142,7 +142,7 @@ } #endif
-int register_spi_bitbang_master(const struct bitbang_spi_master *master) +int register_spi_bitbang_master(struct bitbang_spi_master *master) { struct spi_master mst = spi_master_bitbang; /* If someone forgot to initialize a bitbang function, we catch it here. */ diff --git a/developerbox_spi.c b/developerbox_spi.c index 4ff2fb6..931681e 100644 --- a/developerbox_spi.c +++ b/developerbox_spi.c @@ -120,7 +120,7 @@ 1 << DEVELOPERBOX_SPI_SCK | 1 << DEVELOPERBOX_SPI_MOSI); }
-static const struct bitbang_spi_master bitbang_spi_master_cp210x = { +static struct bitbang_spi_master bitbang_spi_master_cp210x = { .set_cs = cp210x_bitbang_set_cs, .set_sck = cp210x_bitbang_set_sck, .set_mosi = cp210x_bitbang_set_mosi, diff --git a/mcp6x_spi.c b/mcp6x_spi.c index b53d07b..a57050c 100644 --- a/mcp6x_spi.c +++ b/mcp6x_spi.c @@ -87,7 +87,7 @@ return (mcp_gpiostate >> MCP6X_SPI_MISO) & 0x1; }
-static const struct bitbang_spi_master bitbang_spi_master_mcp6x = { +static struct bitbang_spi_master bitbang_spi_master_mcp6x = { .set_cs = mcp6x_bitbang_set_cs, .set_sck = mcp6x_bitbang_set_sck, .set_mosi = mcp6x_bitbang_set_mosi, diff --git a/nicintel_spi.c b/nicintel_spi.c index 1173ef7..59f096d 100644 --- a/nicintel_spi.c +++ b/nicintel_spi.c @@ -167,7 +167,7 @@ return tmp; }
-static const struct bitbang_spi_master bitbang_spi_master_nicintel = { +static struct bitbang_spi_master bitbang_spi_master_nicintel = { .set_cs = nicintel_bitbang_set_cs, .set_sck = nicintel_bitbang_set_sck, .set_mosi = nicintel_bitbang_set_mosi, diff --git a/ogp_spi.c b/ogp_spi.c index e603edb..0c04eec 100644 --- a/ogp_spi.c +++ b/ogp_spi.c @@ -82,7 +82,7 @@ return tmp & 0x1; }
-static const struct bitbang_spi_master bitbang_spi_master_ogp = { +static struct bitbang_spi_master bitbang_spi_master_ogp = { .set_cs = ogp_bitbang_set_cs, .set_sck = ogp_bitbang_set_sck, .set_mosi = ogp_bitbang_set_mosi, diff --git a/pony_spi.c b/pony_spi.c index ed9d326..ade0a6e 100644 --- a/pony_spi.c +++ b/pony_spi.c @@ -90,7 +90,7 @@ return tmp; }
-static const struct bitbang_spi_master bitbang_spi_master_pony = { +static struct bitbang_spi_master bitbang_spi_master_pony = { .set_cs = pony_bitbang_set_cs, .set_sck = pony_bitbang_set_sck, .set_mosi = pony_bitbang_set_mosi, diff --git a/programmer.h b/programmer.h index d66d239..fe00031 100644 --- a/programmer.h +++ b/programmer.h @@ -542,7 +542,7 @@ #endif
/* bitbang_spi.c */ -int register_spi_bitbang_master(const struct bitbang_spi_master *master); +int register_spi_bitbang_master(struct bitbang_spi_master *master);
/* buspirate_spi.c */ #if CONFIG_BUSPIRATE_SPI == 1 @@ -634,7 +634,7 @@ int (*read)(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); int (*write_256)(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len); int (*write_aai)(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len); - const void *data; + void *data; };
int default_spi_send_command(const struct flashctx *flash, unsigned int writecnt, unsigned int readcnt, @@ -722,7 +722,7 @@ int (*read) (struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len); int (*write) (struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len); int (*erase) (struct flashctx *flash, unsigned int blockaddr, unsigned int blocklen); - const void *data; + void *data; }; int register_opaque_master(const struct opaque_master *mst);
@@ -745,7 +745,7 @@ uint16_t (*chip_readw) (const struct flashctx *flash, const chipaddr addr); uint32_t (*chip_readl) (const struct flashctx *flash, const chipaddr addr); void (*chip_readn) (const struct flashctx *flash, uint8_t *buf, const chipaddr addr, size_t len); - const void *data; + void *data; }; int register_par_master(const struct par_master *mst, const enum chipbustype buses); struct registered_master { diff --git a/rayer_spi.c b/rayer_spi.c index 8e869e6..2db53d0 100644 --- a/rayer_spi.c +++ b/rayer_spi.c @@ -156,7 +156,7 @@ return tmp; }
-static const struct bitbang_spi_master bitbang_spi_master_rayer = { +static struct bitbang_spi_master bitbang_spi_master_rayer = { .set_cs = rayer_bitbang_set_cs, .set_sck = rayer_bitbang_set_sck, .set_mosi = rayer_bitbang_set_mosi,