programmer: Make use of new register_par_master() API

Pass pointers to dynamically allocated data to register_par_master().
This way we can avoid a mutable global.

BUG=b:185191942
TEST=builds

Change-Id: I76572e43d01f8a5e1aa73b1b9e8a187465ed8fef
Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/54172
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
diff --git a/dummyflasher.c b/dummyflasher.c
index c1c393c..d549607 100644
--- a/dummyflasher.c
+++ b/dummyflasher.c
@@ -622,7 +622,7 @@
 	.write_aai	= default_spi_write_aai,
 };
 
-static struct par_master par_master_dummy = {
+static const struct par_master par_master_dummy = {
 		.chip_readb		= dummy_chip_readb,
 		.chip_readw		= dummy_chip_readw,
 		.chip_readl		= dummy_chip_readl,
@@ -674,7 +674,6 @@
 	}
 	data->emu_chip = EMULATE_NONE;
 	data->delay_us = 0;
-	par_master_dummy.data = data;
 
 	msg_pspew("%s\n", __func__);
 
@@ -1028,7 +1027,7 @@
 	if (dummy_buses_supported & BUS_NONSPI)
 		register_par_master(&par_master_dummy,
 				    dummy_buses_supported & BUS_NONSPI,
-				    NULL);
+				    data);
 	if (dummy_buses_supported & BUS_SPI)
 		register_spi_master(&spi_master_dummyflasher, data);