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/dirtyjtag_spi.c b/dirtyjtag_spi.c
index c9e921f..e7d8664 100644
--- a/dirtyjtag_spi.c
+++ b/dirtyjtag_spi.c
@@ -189,7 +189,7 @@
 	return dirtyjtag_djtag1_spi_send_command(djtag_data, writecnt, readcnt, writearr, readarr);
 }
 
-static struct spi_master spi_master_dirtyjtag_spi = {
+static const struct spi_master spi_master_dirtyjtag_spi = {
 	.features	= SPI_MASTER_4BA,
 	.max_data_read	= MAX_DATA_READ_UNLIMITED,
 	.max_data_write	= MAX_DATA_WRITE_UNLIMITED,
@@ -300,8 +300,7 @@
 	if (register_shutdown(dirtyjtag_spi_shutdown, djtag_data))
 		goto cleanup_libusb_handle;
 
-	spi_master_dirtyjtag_spi.data = djtag_data;
-	return register_spi_master(&spi_master_dirtyjtag_spi, NULL);
+	return register_spi_master(&spi_master_dirtyjtag_spi, djtag_data);
 
 cleanup_libusb_handle:
 	libusb_attach_kernel_driver(handle, 0);