programmer: Make use of new register_spi_master() API

Pass pointers to dynamically allocated data to register_spi_master().
This way we can avoid some mutable globals.

flashrom-stable: Updated `dirtyjtag_spi` and `dediprog`
                 that were added/refactored earlier.

Change-Id: Id7821f1db3284b7b5b3d0abfd878b979c53870a1
Signed-off-by: Nico Huber <nico.h@gmx.de>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/54067
Original-Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/72200
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/jlink_spi.c b/jlink_spi.c
index ffa547d..589447a 100644
--- a/jlink_spi.c
+++ b/jlink_spi.c
@@ -156,7 +156,7 @@
 	return 0;
 }
 
-static struct spi_master spi_master_jlink_spi = {
+static const struct spi_master spi_master_jlink_spi = {
 	/* Maximum data read size in one go (excluding opcode+address). */
 	.max_data_read	= JTAG_MAX_TRANSFER_SIZE - 5,
 	/* Maximum data write size in one go (excluding opcode+address). */
@@ -510,7 +510,6 @@
 	jlink_data->devh = jaylink_devh;
 	jlink_data->reset_cs = reset_cs;
 	jlink_data->enable_target_power = enable_target_power;
-	spi_master_jlink_spi.data = jlink_data;
 
 	/* Ensure that the CS signal is not active initially. */
 	if (!deassert_cs(jlink_data))
@@ -518,7 +517,7 @@
 
 	if (register_shutdown(jlink_spi_shutdown, jlink_data))
 		goto init_err;
-	register_spi_master(&spi_master_jlink_spi, NULL);
+	register_spi_master(&spi_master_jlink_spi, jlink_data);
 
 	return 0;