tree/: Drop const from opaque data ptr in master definitions [alt]

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.

flashrom-stable:
Add cast in bitbang_spi to avoid compiler warning.

Change-Id: I686c3c79547e35d48f3fd0b524fc98c176dcea6e
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/49131
Original-Reviewed-by: Sam McNally <sammc@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/71336
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
diff --git a/bitbang_spi.c b/bitbang_spi.c
index ac50e67..6d14961 100644
--- a/bitbang_spi.c
+++ b/bitbang_spi.c
@@ -101,7 +101,8 @@
 		return ERROR_FLASHROM_BUG;
 	}
 
-	mst.data = master;
+	/* Cast away `const`, but local code must ensure it's still treated as such. */
+	mst.data = (struct bitbang_spi_master *)master;
 	register_spi_master(&mst);
 
 	/* Only mess with the bus if we're sure nobody else uses it. */