Anastasia Klimchuk has submitted this change. ( https://review.coreboot.org/c/flashrom/+/66654 )
Change subject: tree: Change signature of extract_programmer_param_str() ......................................................................
tree: Change signature of extract_programmer_param_str()
Results can be reproduced with the following invocation; ``` $ find -name '*.c' -exec sed -i 's/extract_programmer_param_str(/extract_programmer_param_str(NULL, /g' '{}' ; ```
This allows for a pointer to the actual programmer parameters to be passed instead of a global.
Change-Id: I781a328fa280e0a9601050dd99a75af72c39c899 Signed-off-by: Edward O'Callaghan quasisec@google.com Reviewed-on: https://review.coreboot.org/c/flashrom/+/66654 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Felix Singer felixsinger@posteo.net Reviewed-by: Anastasia Klimchuk aklm@chromium.org --- M atavia.c M buspirate_spi.c M chipset_enable.c M dediprog.c M developerbox_spi.c M digilent_spi.c M dummyflasher.c M flashrom.c M ft2232_spi.c M i2c_helper_linux.c M ichspi.c M include/programmer.h M internal.c M it87spi.c M jlink_spi.c M linux_mtd.c M linux_spi.c M mediatek_i2c_spi.c M mstarddc_spi.c M ni845x_spi.c M ogp_spi.c M parade_lspcon.c M pcidev.c M pickit2_spi.c M pony_spi.c M raiden_debug_spi.c M rayer_spi.c M realtek_mst_i2c_spi.c M sb600spi.c M serprog.c M stlinkv3_spi.c M usb_device.c 32 files changed, 110 insertions(+), 83 deletions(-)
Approvals: build bot (Jenkins): Verified Felix Singer: Looks good to me, approved Anastasia Klimchuk: Looks good to me, approved
diff --git a/atavia.c b/atavia.c index bce7138..fe86664 100644 --- a/atavia.c +++ b/atavia.c @@ -145,7 +145,7 @@
static int atavia_init(void) { - char *arg = extract_programmer_param_str("offset"); + char *arg = extract_programmer_param_str(NULL, "offset"); if (arg) { if (strlen(arg) == 0) { msg_perr("Missing argument for offset.\n"); diff --git a/buspirate_spi.c b/buspirate_spi.c index f905a96..2fcf445 100644 --- a/buspirate_spi.c +++ b/buspirate_spi.c @@ -332,7 +332,7 @@ unsigned char *bp_commbuf; int bp_commbufsize;
- dev = extract_programmer_param_str("dev"); + dev = extract_programmer_param_str(NULL, "dev"); if (dev && !strlen(dev)) { free(dev); dev = NULL; @@ -342,7 +342,7 @@ return 1; }
- tmp = extract_programmer_param_str("spispeed"); + tmp = extract_programmer_param_str(NULL, "spispeed"); if (tmp) { for (i = 0; spispeeds[i].name; i++) { if (!strncasecmp(spispeeds[i].name, tmp, strlen(spispeeds[i].name))) { @@ -356,7 +356,7 @@ free(tmp);
/* Extract serialspeed parameter */ - tmp = extract_programmer_param_str("serialspeed"); + tmp = extract_programmer_param_str(NULL, "serialspeed"); if (tmp) { for (i = 0; serialspeeds[i].name; i++) { if (!strncasecmp(serialspeeds[i].name, tmp, strlen(serialspeeds[i].name))) { @@ -369,7 +369,7 @@ } free(tmp);
- tmp = extract_programmer_param_str("pullups"); + tmp = extract_programmer_param_str(NULL, "pullups"); if (tmp) { if (strcasecmp("on", tmp) == 0) pullup = 1; @@ -380,7 +380,7 @@ } free(tmp);
- tmp = extract_programmer_param_str("psus"); + tmp = extract_programmer_param_str(NULL, "psus"); if (tmp) { if (strcasecmp("on", tmp) == 0) psu = 1; diff --git a/chipset_enable.c b/chipset_enable.c index 9790bc9..5f46fbf 100644 --- a/chipset_enable.c +++ b/chipset_enable.c @@ -428,7 +428,7 @@ break; }
- char *idsel = extract_programmer_param_str("fwh_idsel"); + char *idsel = extract_programmer_param_str(NULL, "fwh_idsel"); if (idsel && strlen(idsel)) { if (!implemented) { msg_perr("Error: fwh_idsel= specified, but (yet) unsupported on this chipset.\n"); diff --git a/dediprog.c b/dediprog.c index e5bf84e..86d72aa 100644 --- a/dediprog.c +++ b/dediprog.c @@ -1087,7 +1087,7 @@ long target = FLASH_TYPE_APPLICATION_FLASH_1; int i, ret;
- param_str = extract_programmer_param_str("spispeed"); + param_str = extract_programmer_param_str(NULL, "spispeed"); if (param_str) { for (i = 0; spispeeds[i].name; ++i) { if (!strcasecmp(spispeeds[i].name, param_str)) { @@ -1103,7 +1103,7 @@ free(param_str); }
- param_str = extract_programmer_param_str("voltage"); + param_str = extract_programmer_param_str(NULL, "voltage"); if (param_str) { millivolt = parse_voltage(param_str); free(param_str); @@ -1112,7 +1112,7 @@ msg_pinfo("Setting voltage to %i mV\n", millivolt); }
- param_str = extract_programmer_param_str("id"); + param_str = extract_programmer_param_str(NULL, "id"); if (param_str) { char prefix0, prefix1; if (sscanf(param_str, "%c%c%d", &prefix0, &prefix1, &id) != 3) { @@ -1135,7 +1135,7 @@ } free(param_str);
- param_str = extract_programmer_param_str("device"); + param_str = extract_programmer_param_str(NULL, "device"); if (param_str) { char *dev_suffix; if (id != -1) { @@ -1162,7 +1162,7 @@ } free(param_str);
- param_str = extract_programmer_param_str("target"); + param_str = extract_programmer_param_str(NULL, "target"); if (param_str) { char *target_suffix; errno = 0; diff --git a/developerbox_spi.c b/developerbox_spi.c index 6308da6..d585418 100644 --- a/developerbox_spi.c +++ b/developerbox_spi.c @@ -152,7 +152,7 @@ return 1; }
- char *serialno = extract_programmer_param_str("serial"); + char *serialno = extract_programmer_param_str(NULL, "serial"); if (serialno) msg_pdbg("Looking for serial number commencing %s\n", serialno); cp210x_handle = usb_dev_get_by_vid_pid_serial(usb_ctx, diff --git a/digilent_spi.c b/digilent_spi.c index d251f09..a16ae7b 100644 --- a/digilent_spi.c +++ b/digilent_spi.c @@ -408,7 +408,7 @@ goto close_handle; }
- param_str = extract_programmer_param_str("spispeed"); + param_str = extract_programmer_param_str(NULL, "spispeed"); if (param_str) { for (i = 0; spispeeds[i].name; ++i) { if (!strcasecmp(spispeeds[i].name, param_str)) { @@ -424,7 +424,7 @@ free(param_str); }
- param_str = extract_programmer_param_str("reset"); + param_str = extract_programmer_param_str(NULL, "reset"); if (param_str && strlen(param_str)) reset_board = (param_str[0] == '1'); else diff --git a/dummyflasher.c b/dummyflasher.c index 93ad31c..03c7f27 100644 --- a/dummyflasher.c +++ b/dummyflasher.c @@ -957,7 +957,7 @@ char *status = NULL; int size = -1; /* size for VARIABLE_SIZE chip device */
- bustext = extract_programmer_param_str("bus"); + bustext = extract_programmer_param_str(NULL, "bus"); msg_pdbg("Requested buses are: %s\n", bustext ? bustext : "default"); if (!bustext) bustext = strdup("parallel+lpc+fwh+spi+prog"); @@ -989,7 +989,7 @@ msg_pdbg("Support for all flash bus types disabled.\n"); free(bustext);
- tmp = extract_programmer_param_str("spi_write_256_chunksize"); + tmp = extract_programmer_param_str(NULL, "spi_write_256_chunksize"); if (tmp) { data->spi_write_256_chunksize = strtoul(tmp, &endptr, 0); if (*endptr != '\0' || data->spi_write_256_chunksize < 1) { @@ -1000,7 +1000,7 @@ } free(tmp);
- tmp = extract_programmer_param_str("spi_blacklist"); + tmp = extract_programmer_param_str(NULL, "spi_blacklist"); if (tmp) { i = strlen(tmp); if (!strncmp(tmp, "0x", 2)) { @@ -1036,7 +1036,7 @@ } free(tmp);
- tmp = extract_programmer_param_str("spi_ignorelist"); + tmp = extract_programmer_param_str(NULL, "spi_ignorelist"); if (tmp) { i = strlen(tmp); if (!strncmp(tmp, "0x", 2)) { @@ -1073,7 +1073,7 @@ free(tmp);
/* frequency to emulate in Hz (default), KHz, or MHz */ - tmp = extract_programmer_param_str("freq"); + tmp = extract_programmer_param_str(NULL, "freq"); if (tmp) { unsigned long int freq; char *units = tmp; @@ -1123,7 +1123,7 @@ } free(tmp);
- tmp = extract_programmer_param_str("size"); + tmp = extract_programmer_param_str(NULL, "size"); if (tmp) { size = strtol(tmp, NULL, 10); if (size <= 0 || (size % 1024 != 0)) { @@ -1135,7 +1135,7 @@ free(tmp); }
- tmp = extract_programmer_param_str("hwwp"); + tmp = extract_programmer_param_str(NULL, "hwwp"); if (tmp) { if (!strcmp(tmp, "yes")) { msg_pdbg("Emulated chip will have hardware WP enabled\n"); @@ -1150,7 +1150,7 @@ free(tmp); }
- tmp = extract_programmer_param_str("emulate"); + tmp = extract_programmer_param_str(NULL, "emulate"); if (!tmp) { if (size != -1) { msg_perr("%s: size parameter is only valid for VARIABLE_SIZE chip.\n", __func__); @@ -1274,7 +1274,7 @@ free(tmp);
/* Should emulated flash erase to zero (yes/no)? */ - tmp = extract_programmer_param_str("erase_to_zero"); + tmp = extract_programmer_param_str(NULL, "erase_to_zero"); if (tmp) { if (data->emu_chip != EMULATE_VARIABLE_SIZE) { msg_perr("%s: erase_to_zero parameter is not valid for real chip.\n", __func__); @@ -1294,7 +1294,7 @@ } free(tmp);
- status = extract_programmer_param_str("spi_status"); + status = extract_programmer_param_str(NULL, "spi_status"); if (status) { unsigned int emu_status;
@@ -1370,7 +1370,7 @@ memset(data->flashchip_contents, data->erase_to_zero ? 0x00 : 0xff, data->emu_chip_size);
/* Will be freed by shutdown function if necessary. */ - data->emu_persistent_image = extract_programmer_param_str("image"); + data->emu_persistent_image = extract_programmer_param_str(NULL, "image"); if (!data->emu_persistent_image) { /* Nothing else to do. */ goto dummy_init_out; diff --git a/flashrom.c b/flashrom.c index ba363b2..5b7bbbd 100644 --- a/flashrom.c +++ b/flashrom.c @@ -66,6 +66,10 @@ /* Did we change something or was every erase/write skipped (if any)? */ static bool all_skipped = true;
+struct programmer_cfg { + char *params; +}; + /* Register a function to be executed on programmer shutdown. * The advantage over atexit() is that you can supply a void pointer which will * be used as parameter to the registered function upon programmer shutdown. @@ -278,7 +282,7 @@ return opt; }
-char *extract_programmer_param_str(const char *param_name) +char *extract_programmer_param_str(const struct programmer_cfg *cfg, const char *param_name) { return extract_param(&programmer_param, param_name, ","); } diff --git a/ft2232_spi.c b/ft2232_spi.c index bbacc03..7c31013 100644 --- a/ft2232_spi.c +++ b/ft2232_spi.c @@ -340,7 +340,7 @@ struct ftdi_context ftdic; struct ft2232_data *spi_data;
- arg = extract_programmer_param_str("type"); + arg = extract_programmer_param_str(NULL, "type"); if (arg) { if (!strcasecmp(arg, "2232H")) { ft2232_type = FTDI_FT2232H_PID; @@ -447,7 +447,7 @@ /* Remember reserved pins before pindir gets modified. */ const uint8_t rsv_bits = pindir & 0xf0;
- arg = extract_programmer_param_str("port"); + arg = extract_programmer_param_str(NULL, "port"); if (arg) { switch (toupper((unsigned char)*arg)) { case 'A': @@ -480,7 +480,7 @@ } free(arg);
- arg = extract_programmer_param_str("divisor"); + arg = extract_programmer_param_str(NULL, "divisor"); if (arg && strlen(arg)) { unsigned int temp = 0; char *endptr; @@ -496,7 +496,7 @@ free(arg);
bool csgpiol_set = false; - arg = extract_programmer_param_str("csgpiol"); + arg = extract_programmer_param_str(NULL, "csgpiol"); if (arg) { csgpiol_set = true; msg_pwarn("Deprecation warning: `csgpiol` is deprecated and will be removed " @@ -529,7 +529,7 @@ for (int pin = 0; pin < 4; pin++) { char gpiol_param[7]; snprintf(gpiol_param, sizeof(gpiol_param), "gpiol%d", pin); - arg = extract_programmer_param_str(gpiol_param); + arg = extract_programmer_param_str(NULL, gpiol_param);
if (!arg) continue; @@ -602,8 +602,8 @@ msg_perr("Unable to select channel (%s).\n", ftdi_get_error_string(&ftdic)); }
- arg = extract_programmer_param_str("serial"); - arg2 = extract_programmer_param_str("description"); + arg = extract_programmer_param_str(NULL, "serial"); + arg2 = extract_programmer_param_str(NULL, "description");
f = ftdi_usb_open_desc(&ftdic, ft2232_vid, ft2232_type, arg2, arg);
diff --git a/i2c_helper_linux.c b/i2c_helper_linux.c index f527c4e..29fdfd4 100644 --- a/i2c_helper_linux.c +++ b/i2c_helper_linux.c @@ -100,8 +100,8 @@ { int fd = -1;
- char *bus_str = extract_programmer_param_str("bus"); - char *device_path = extract_programmer_param_str("devpath"); + char *bus_str = extract_programmer_param_str(NULL, "bus"); + char *device_path = extract_programmer_param_str(NULL, "devpath");
if (device_path != NULL && bus_str != NULL) { msg_perr("%s: only one of bus and devpath may be specified\n", __func__); diff --git a/ichspi.c b/ichspi.c index 030cd92..78c446f 100644 --- a/ichspi.c +++ b/ichspi.c @@ -1874,7 +1874,7 @@
static int get_ich_spi_mode_param(enum ich_spi_mode *ich_spi_mode) { - char *const arg = extract_programmer_param_str("ich_spi_mode"); + char *const arg = extract_programmer_param_str(NULL, "ich_spi_mode"); if (!arg) { return 0; } else if (!strcmp(arg, "hwseq")) { diff --git a/include/programmer.h b/include/programmer.h index f5ce556..c58459f 100644 --- a/include/programmer.h +++ b/include/programmer.h @@ -29,6 +29,7 @@ USB, OTHER, }; +struct programmer_cfg;
struct dev_entry { uint16_t vendor_id; @@ -287,7 +288,7 @@ extern int programmer_may_write; extern unsigned long flashbase; unsigned int count_max_decode_exceedings(const struct flashctx *flash); -char *extract_programmer_param_str(const char *param_name); +char *extract_programmer_param_str(const struct programmer_cfg *cfg, const char *param_name);
/* spi.c */ #define MAX_DATA_UNSPECIFIED 0 diff --git a/internal.c b/internal.c index 57412a2..8e267cd 100644 --- a/internal.c +++ b/internal.c @@ -128,7 +128,7 @@ *board_vendor = NULL; *board_model = NULL;
- arg = extract_programmer_param_str("boardenable"); + arg = extract_programmer_param_str(NULL, "boardenable"); if (arg && !strcmp(arg,"force")) { *boardenable = 1; } else if (arg && !strlen(arg)) { @@ -142,7 +142,7 @@ } free(arg);
- arg = extract_programmer_param_str("boardmismatch"); + arg = extract_programmer_param_str(NULL, "boardmismatch"); if (arg && !strcmp(arg,"force")) { *boardmismatch = 1; } else if (arg && !strlen(arg)) { @@ -156,7 +156,7 @@ } free(arg);
- arg = extract_programmer_param_str("laptop"); + arg = extract_programmer_param_str(NULL, "laptop"); if (arg && !strcmp(arg, "force_I_want_a_brick")) *force_laptop = 1; else if (arg && !strcmp(arg, "this_is_not_a_laptop")) @@ -172,7 +172,7 @@ } free(arg);
- arg = extract_programmer_param_str("mainboard"); + arg = extract_programmer_param_str(NULL, "mainboard"); if (arg && strlen(arg)) { if (board_parse_parameter(arg, board_vendor, board_model)) { free(arg); diff --git a/it87spi.c b/it87spi.c index 56a85f2..568d714 100644 --- a/it87spi.c +++ b/it87spi.c @@ -328,7 +328,7 @@
enter_conf_mode_ite(port);
- char *param = extract_programmer_param_str("dualbiosindex"); + char *param = extract_programmer_param_str(NULL, "dualbiosindex"); if (param != NULL) { sio_write(port, 0x07, 0x07); /* Select GPIO LDN */ tmp = sio_read(port, 0xEF); @@ -394,7 +394,7 @@ flashport |= sio_read(port, 0x65); msg_pdbg("Serial flash port 0x%04x\n", flashport); /* Non-default port requested? */ - param = extract_programmer_param_str("it87spiport"); + param = extract_programmer_param_str(NULL, "it87spiport"); if (param) { char *endptr = NULL; unsigned long forced_flashport; diff --git a/jlink_spi.c b/jlink_spi.c index deab8da..eba8dbc 100644 --- a/jlink_spi.c +++ b/jlink_spi.c @@ -203,7 +203,7 @@ struct jlink_spi_data *jlink_data = NULL; bool enable_target_power;
- arg = extract_programmer_param_str("spispeed"); + arg = extract_programmer_param_str(NULL, "spispeed");
if (arg) { char *endptr; @@ -230,7 +230,7 @@ bool use_serial_number; uint32_t serial_number;
- arg = extract_programmer_param_str("serial"); + arg = extract_programmer_param_str(NULL, "serial");
if (arg) { if (!strlen(arg)) { @@ -259,7 +259,7 @@ free(arg);
reset_cs = true; - arg = extract_programmer_param_str("cs"); + arg = extract_programmer_param_str(NULL, "cs");
if (arg) { if (!strcasecmp(arg, "reset")) { @@ -281,7 +281,7 @@ msg_pdbg("Using TRST as chip select signal.\n");
enable_target_power = false; - arg = extract_programmer_param_str("power"); + arg = extract_programmer_param_str(NULL, "power");
if (arg) { if (!strcasecmp(arg, "on")) { diff --git a/linux_mtd.c b/linux_mtd.c index dd86466..414a6b4 100644 --- a/linux_mtd.c +++ b/linux_mtd.c @@ -500,7 +500,7 @@ int ret = 1; struct linux_mtd_data *data = NULL;
- param_str = extract_programmer_param_str("dev"); + param_str = extract_programmer_param_str(NULL, "dev"); if (param_str) { char *endptr;
diff --git a/linux_spi.c b/linux_spi.c index 6ed4f68..cef7909 100644 --- a/linux_spi.c +++ b/linux_spi.c @@ -177,7 +177,7 @@ size_t max_kernel_buf_size; struct linux_spi_data *spi_data;
- param_str = extract_programmer_param_str("spispeed"); + param_str = extract_programmer_param_str(NULL, "spispeed"); if (param_str && strlen(param_str)) { speed_hz = (uint32_t)strtoul(param_str, &endp, 10) * 1000; if (param_str == endp || speed_hz == 0) { @@ -192,7 +192,7 @@ } free(param_str);
- param_str = extract_programmer_param_str("dev"); + param_str = extract_programmer_param_str(NULL, "dev"); if (!param_str || !strlen(param_str)) { msg_perr("No SPI device given. Use flashrom -p " "linux_spi:dev=/dev/spidevX.Y\n"); diff --git a/mediatek_i2c_spi.c b/mediatek_i2c_spi.c index 4929fbf..4133edb 100644 --- a/mediatek_i2c_spi.c +++ b/mediatek_i2c_spi.c @@ -470,7 +470,7 @@ int ret = 0;
*allow_brick = false; /* Default behaviour is to bail. */ - brick_str = extract_programmer_param_str("allow_brick"); + brick_str = extract_programmer_param_str(NULL, "allow_brick"); if (brick_str) { if (!strcmp(brick_str, "yes")) { *allow_brick = true; diff --git a/mstarddc_spi.c b/mstarddc_spi.c index c59f943..50a75d3 100644 --- a/mstarddc_spi.c +++ b/mstarddc_spi.c @@ -159,7 +159,7 @@ struct mstarddc_spi_data *mstarddc_data;
// Get device, address from command-line - char *i2c_device = extract_programmer_param_str("dev"); + char *i2c_device = extract_programmer_param_str(NULL, "dev"); if (i2c_device != NULL && strlen(i2c_device) > 0) { char *i2c_address = strchr(i2c_device, ':'); if (i2c_address != NULL) { @@ -182,7 +182,7 @@ msg_pinfo("Info: Will try to use device %s and address 0x%02x.\n", i2c_device, mstarddc_addr);
// Get noreset=1 option from command-line - char *noreset = extract_programmer_param_str("noreset"); + char *noreset = extract_programmer_param_str(NULL, "noreset"); if (noreset != NULL && noreset[0] == '1') mstarddc_doreset = 0; free(noreset); diff --git a/ni845x_spi.c b/ni845x_spi.c index 14bebce..f75c399 100644 --- a/ni845x_spi.c +++ b/ni845x_spi.c @@ -553,7 +553,7 @@ int32 tmp = 0;
// read the cs parameter (which Chip select should we use) - CS_str = extract_programmer_param_str("cs"); + CS_str = extract_programmer_param_str(NULL, "cs"); if (CS_str) { CS_number = CS_str[0] - '0'; free(CS_str); @@ -563,7 +563,7 @@ } }
- voltage = extract_programmer_param_str("voltage"); + voltage = extract_programmer_param_str(NULL, "voltage"); if (voltage != NULL) { requested_io_voltage_mV = parse_voltage(voltage); free(voltage); @@ -571,9 +571,9 @@ return 1; }
- serial_number = extract_programmer_param_str("serial"); + serial_number = extract_programmer_param_str(NULL, "serial");
- speed_str = extract_programmer_param_str("spispeed"); + speed_str = extract_programmer_param_str(NULL, "spispeed"); if (speed_str) { spi_speed_KHz = strtoul(speed_str, &endptr, 0); if (*endptr) { @@ -586,7 +586,7 @@ }
ignore_io_voltage_limits = false; - ignore_io_voltage_limits_str = extract_programmer_param_str("ignore_io_voltage_limits"); + ignore_io_voltage_limits_str = extract_programmer_param_str(NULL, "ignore_io_voltage_limits"); if (ignore_io_voltage_limits_str && strcmp(ignore_io_voltage_limits_str, "yes") == 0) { ignore_io_voltage_limits = true; diff --git a/ogp_spi.c b/ogp_spi.c index 27622a6..b3c404c 100644 --- a/ogp_spi.c +++ b/ogp_spi.c @@ -117,7 +117,7 @@ uint32_t ogp_reg__ce; uint32_t ogp_reg_sck;
- type = extract_programmer_param_str("rom"); + type = extract_programmer_param_str(NULL, "rom");
if (!type) { msg_perr("Please use flashrom -p ogp_spi:rom=... to specify " diff --git a/parade_lspcon.c b/parade_lspcon.c index e2d2862..815f398 100644 --- a/parade_lspcon.c +++ b/parade_lspcon.c @@ -446,7 +446,7 @@ int ret = 0;
*allow_brick = false; /* Default behaviour is to bail. */ - brick_str = extract_programmer_param_str("allow_brick"); + brick_str = extract_programmer_param_str(NULL, "allow_brick"); if (brick_str) { if (!strcmp(brick_str, "yes")) { *allow_brick = true; diff --git a/pcidev.c b/pcidev.c index 643b0cd..2fbc1e5 100644 --- a/pcidev.c +++ b/pcidev.c @@ -272,7 +272,7 @@ pci_filter_init(pacc, &filter);
/* Filter by bb:dd.f (if supplied by the user). */ - pcidev_bdf = extract_programmer_param_str("pci"); + pcidev_bdf = extract_programmer_param_str(NULL, "pci"); if (pcidev_bdf != NULL) { if ((msg = pci_filter_parse_slot(&filter, pcidev_bdf))) { msg_perr("Error: %s\n", msg); diff --git a/pickit2_spi.c b/pickit2_spi.c index 9e34a58..7c84d96 100644 --- a/pickit2_spi.c +++ b/pickit2_spi.c @@ -412,7 +412,7 @@ int spispeed_idx = 0; char *param_str;
- param_str = extract_programmer_param_str("spispeed"); + param_str = extract_programmer_param_str(NULL, "spispeed"); if (param_str != NULL) { int i = 0; for (; spispeeds[i].name; i++) { @@ -430,7 +430,7 @@ }
int millivolt = 3500; - param_str = extract_programmer_param_str("voltage"); + param_str = extract_programmer_param_str(NULL, "voltage"); if (param_str != NULL) { millivolt = parse_voltage(param_str); free(param_str); diff --git a/pony_spi.c b/pony_spi.c index 60925e5..50f44da 100644 --- a/pony_spi.c +++ b/pony_spi.c @@ -130,7 +130,7 @@ *have_device = 0;
/* The parameter is in format "dev=/dev/device,type=serbang" */ - arg = extract_programmer_param_str("dev"); + arg = extract_programmer_param_str(NULL, "dev"); if (arg && strlen(arg)) { sp_fd = sp_openserport(arg, 9600); if (sp_fd == SER_INV_FD) @@ -140,7 +140,7 @@ } free(arg);
- arg = extract_programmer_param_str("type"); + arg = extract_programmer_param_str(NULL, "type"); if (arg && !strcasecmp(arg, "serbang")) { *type = TYPE_SERBANG; } else if (arg && !strcasecmp(arg, "si_prog")) { diff --git a/raiden_debug_spi.c b/raiden_debug_spi.c index a291f96..3382b9e 100644 --- a/raiden_debug_spi.c +++ b/raiden_debug_spi.c @@ -1432,7 +1432,7 @@ static int get_ap_request_type(void) { int ap_request = RAIDEN_DEBUG_SPI_REQ_ENABLE_AP; - char *custom_rst_str = extract_programmer_param_str("custom_rst"); + char *custom_rst_str = extract_programmer_param_str(NULL, "custom_rst"); if (custom_rst_str) { if (!strcasecmp(custom_rst_str, "true")) { ap_request = RAIDEN_DEBUG_SPI_REQ_ENABLE_AP_CUSTOM; @@ -1456,7 +1456,7 @@ */ int request_enable = RAIDEN_DEBUG_SPI_REQ_ENABLE;
- char *target_str = extract_programmer_param_str("target"); + char *target_str = extract_programmer_param_str(NULL, "target"); if (target_str) { if (!strcasecmp(target_str, "ap")) request_enable = get_ap_request_type(); @@ -1485,7 +1485,7 @@ static int raiden_debug_spi_init(void) { struct usb_match match; - char *serial = extract_programmer_param_str("serial"); + char *serial = extract_programmer_param_str(NULL, "serial"); struct usb_device *current; struct usb_device *device = NULL; int found = 0; diff --git a/rayer_spi.c b/rayer_spi.c index 3d626b2..82c49b3 100644 --- a/rayer_spi.c +++ b/rayer_spi.c @@ -244,7 +244,7 @@ uint8_t lpt_outbyte;
/* Non-default port requested? */ - arg = extract_programmer_param_str("iobase"); + arg = extract_programmer_param_str(NULL, "iobase"); if (arg) { char *endptr = NULL; unsigned long tmp; @@ -277,7 +277,7 @@ msg_pdbg("Using address 0x%x as I/O base for parallel port access.\n", lpt_iobase);
- arg = extract_programmer_param_str("type"); + arg = extract_programmer_param_str(NULL, "type"); if (arg) { for (; prog->type != NULL; prog++) { if (strcasecmp(arg, prog->type) == 0) { diff --git a/realtek_mst_i2c_spi.c b/realtek_mst_i2c_spi.c index 8d4f86d..6c2b86f 100644 --- a/realtek_mst_i2c_spi.c +++ b/realtek_mst_i2c_spi.c @@ -450,7 +450,7 @@ int ret = 0;
*allow_brick = false; /* Default behaviour is to bail. */ - param_str = extract_programmer_param_str("allow_brick"); + param_str = extract_programmer_param_str(NULL, "allow_brick"); if (param_str) { if (!strcmp(param_str, "yes")) { *allow_brick = true; @@ -462,7 +462,7 @@ free(param_str);
*reset = false; /* Default behaviour is no MCU reset on tear-down. */ - param_str = extract_programmer_param_str("reset_mcu"); + param_str = extract_programmer_param_str(NULL, "reset_mcu"); if (param_str) { if (param_str[0] == '1') { *reset = true; @@ -476,7 +476,7 @@ free(param_str);
*enter_isp = true; /* Default behaviour is enter ISP on setup. */ - param_str = extract_programmer_param_str("enter_isp"); + param_str = extract_programmer_param_str(NULL, "enter_isp"); if (param_str) { if (param_str[0] == '1') { *enter_isp = true; diff --git a/sb600spi.c b/sb600spi.c index f218ca6..df8d726 100644 --- a/sb600spi.c +++ b/sb600spi.c @@ -415,7 +415,7 @@ int16_t spireadmode_idx = -1; char *param_str;
- param_str = extract_programmer_param_str("spispeed"); + param_str = extract_programmer_param_str(NULL, "spispeed"); if (param_str != NULL) { unsigned int i; for (i = 0; i < ARRAY_SIZE(spispeeds); i++) { @@ -439,7 +439,7 @@ free(param_str); }
- param_str = extract_programmer_param_str("spireadmode"); + param_str = extract_programmer_param_str(NULL, "spireadmode"); if (param_str != NULL) { unsigned int i; for (i = 0; i < ARRAY_SIZE(spireadmodes); i++) { @@ -528,7 +528,7 @@ return 0;
bool amd_imc_force = false; - char *param_value = extract_programmer_param_str("amd_imc_force"); + char *param_value = extract_programmer_param_str(NULL, "amd_imc_force"); if (param_value && !strcmp(param_value, "yes")) { amd_imc_force = true; msg_pspew("amd_imc_force enabled.\n"); diff --git a/serprog.c b/serprog.c index ca3a94e..4480285 100644 --- a/serprog.c +++ b/serprog.c @@ -574,7 +574,7 @@ int have_device = 0;
/* the parameter is either of format "dev=/dev/device[:baud]" or "ip=ip:port" */ - device = extract_programmer_param_str("dev"); + device = extract_programmer_param_str(NULL, "dev"); if (device && strlen(device)) { char *baud_str = strstr(device, ":"); if (baud_str != NULL) { @@ -611,7 +611,7 @@ } free(device);
- device = extract_programmer_param_str("ip"); + device = extract_programmer_param_str(NULL, "ip"); if (have_device && device) { msg_perr("Error: Both host and device specified.\n" "Please use either dev= or ip= but not both.\n"); @@ -739,7 +739,7 @@ spi_master_serprog.max_data_read = v; msg_pdbg(MSGHEADER "Maximum read-n length is %d\n", v); } - spispeed = extract_programmer_param_str("spispeed"); + spispeed = extract_programmer_param_str(NULL, "spispeed"); if (spispeed && strlen(spispeed)) { uint32_t f_spi_req, f_spi; uint8_t buf[4]; diff --git a/stlinkv3_spi.c b/stlinkv3_spi.c index 22a0a06..ccba1d9 100644 --- a/stlinkv3_spi.c +++ b/stlinkv3_spi.c @@ -490,7 +490,7 @@ return 1; }
- param_str = extract_programmer_param_str("serial"); + param_str = extract_programmer_param_str(NULL, "serial"); if (param_str) msg_pdbg("Opening STLINK-V3 with serial: %s\n", param_str);
@@ -515,7 +515,7 @@ } free(param_str);
- param_str = extract_programmer_param_str("spispeed"); + param_str = extract_programmer_param_str(NULL, "spispeed"); if (param_str) { sck_freq_kHz = strtoul(param_str, &endptr, 0); if (*endptr || sck_freq_kHz == 0) { diff --git a/usb_device.c b/usb_device.c index b3b44c4..3869bbf 100644 --- a/usb_device.c +++ b/usb_device.c @@ -31,7 +31,7 @@ static void usb_match_value_init(struct usb_match_value *match, char const *parameter) { - char *string = extract_programmer_param_str(parameter); + char *string = extract_programmer_param_str(NULL, parameter);
match->name = parameter;