Daniel Kurtz has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/47655 )
Change subject: it85spi.c: Refactor singleton states into reentrant pattern ......................................................................
Patch Set 10:
(1 comment)
https://review.coreboot.org/c/flashrom/+/47655/10/it85spi.c File it85spi.c:
https://review.coreboot.org/c/flashrom/+/47655/10/it85spi.c@240 PS10, Line 240: struct it85spi_data *data = (struct it85spi_data *) flash->mst->spi.data;
@Daniel, this is a reply to your comment - for some reasons I can't reply to it because I don't see […]
Take away here is... yes, `const`-ification causes one to think a bit harder about what parameters / objects should be being modified and where. This is generally a good thing, but takes more time and effort to get just right.
I think I was only actually partially incorrect in the earlier analysis. The `const struct flashctx *flash` may not be the issue, but rather the fact that `struct spi_master` itself defines a `const void *data`:
https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/thir...
This suggests that the current intention is that spi_master's `data` fields are immutable state, and should not be modified at runtime.
This sounds like a more fundamental issue with this patch series. I suggest forking off a separate stand-alone preliminary patch to de-constify's `data` in the common code, before this patch that re-purposes it for use to point to modifiable runtime state in this spi_master driver.