Removal of sdi->index, step 4: fix trivial sr_dev_inst_new() calls
This commit is contained in:
parent
f220936473
commit
aed4ad0bea
|
@ -137,7 +137,7 @@ static GSList *scan(GSList *options)
|
|||
for (i = 0; supported_agdmm[i].model; i++) {
|
||||
if (strcmp(supported_agdmm[i].modelname, tokens[1]))
|
||||
continue;
|
||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, "Agilent",
|
||||
if (!(sdi = sr_dev_inst_new(SR_ST_INACTIVE, "Agilent",
|
||||
tokens[1], tokens[3])))
|
||||
return NULL;
|
||||
if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {
|
||||
|
|
|
@ -96,7 +96,7 @@ static GSList *scan(GSList *options)
|
|||
|
||||
sr_info("Found device on port %s.", conn);
|
||||
|
||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, "APPA", "55II", NULL)))
|
||||
if (!(sdi = sr_dev_inst_new(SR_ST_INACTIVE, "APPA", "55II", NULL)))
|
||||
goto scan_cleanup;
|
||||
|
||||
if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {
|
||||
|
|
|
@ -377,7 +377,7 @@ static GSList *scan(GSList *options)
|
|||
devc->use_triggers = 0;
|
||||
|
||||
/* Register SIGMA device. */
|
||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_INITIALIZING, USB_VENDOR_NAME,
|
||||
if (!(sdi = sr_dev_inst_new(SR_ST_INITIALIZING, USB_VENDOR_NAME,
|
||||
USB_MODEL_NAME, NULL))) {
|
||||
sr_err("%s: sdi was NULL", __func__);
|
||||
goto free;
|
||||
|
|
|
@ -161,7 +161,7 @@ static GSList *scan(GSList *options, int modelid)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, "Atten", model->name, NULL);
|
||||
sdi = sr_dev_inst_new(SR_ST_INACTIVE, "Atten", model->name, NULL);
|
||||
sdi->driver = di;
|
||||
sdi->inst_type = SR_INST_SERIAL;
|
||||
sdi->conn = serial;
|
||||
|
|
|
@ -97,7 +97,7 @@ static GSList *scan(GSList *options)
|
|||
if (!g_file_test(BEAGLELOGIC_DEV_NODE, G_FILE_TEST_EXISTS))
|
||||
return NULL;
|
||||
|
||||
sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, NULL, "BeagleLogic", "1.0");
|
||||
sdi = sr_dev_inst_new(SR_ST_INACTIVE, NULL, "BeagleLogic", "1.0");
|
||||
sdi->driver = di;
|
||||
|
||||
/* Unless explicitly specified, keep max channels to 8 only */
|
||||
|
|
|
@ -73,7 +73,7 @@ static GSList *scan(GSList *options)
|
|||
for (l = usb_devices; l; l = l->next) {
|
||||
usb = l->data;
|
||||
|
||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE,
|
||||
if (!(sdi = sr_dev_inst_new(SR_ST_INACTIVE,
|
||||
"Brymen", "BM869", NULL))) {
|
||||
sr_err("sr_dev_inst_new returned NULL.");
|
||||
return NULL;
|
||||
|
|
|
@ -75,7 +75,7 @@ static GSList *brymen_scan(const char *conn, const char *serialcomm)
|
|||
|
||||
sr_info("Found device on port %s.", conn);
|
||||
|
||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, "Brymen", "BM85x", NULL)))
|
||||
if (!(sdi = sr_dev_inst_new(SR_ST_INACTIVE, "Brymen", "BM85x", NULL)))
|
||||
goto scan_cleanup;
|
||||
|
||||
if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {
|
||||
|
|
|
@ -106,7 +106,7 @@ static GSList *scan(GSList *options)
|
|||
while (g_get_monotonic_time() - start < MAX_SCAN_TIME) {
|
||||
if (serial_read_nonblocking(serial, &c, 1) == 1 && c == 0xa5) {
|
||||
/* Found one. */
|
||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, "CEM",
|
||||
if (!(sdi = sr_dev_inst_new(SR_ST_INACTIVE, "CEM",
|
||||
"DT-885x", NULL)))
|
||||
return NULL;
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ static GSList *center_scan(const char *conn, const char *serialcomm, int idx)
|
|||
|
||||
sr_info("Found device on port %s.", conn);
|
||||
|
||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, center_devs[idx].vendor,
|
||||
if (!(sdi = sr_dev_inst_new(SR_ST_INACTIVE, center_devs[idx].vendor,
|
||||
center_devs[idx].device, NULL)))
|
||||
goto scan_cleanup;
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ static int add_device(int idx, int model, GSList **devices)
|
|||
devc->cur_samplerate = devc->prof->max_samplerate;
|
||||
|
||||
/* Register the device with libsigrok. */
|
||||
sdi = sr_dev_inst_new(0, SR_ST_INITIALIZING,
|
||||
sdi = sr_dev_inst_new(SR_ST_INITIALIZING,
|
||||
"ChronoVu", devc->prof->modelname, NULL);
|
||||
if (!sdi) {
|
||||
sr_err("Failed to create device instance.");
|
||||
|
|
|
@ -82,7 +82,7 @@ static GSList *scan(GSList *options)
|
|||
if (!serialcomm)
|
||||
serialcomm = SERIALCOMM;
|
||||
|
||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, "Colead",
|
||||
if (!(sdi = sr_dev_inst_new(SR_ST_INACTIVE, "Colead",
|
||||
"SL-5868P", NULL)))
|
||||
return NULL;
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ static GSList *scan(GSList *options)
|
|||
|
||||
sr_spew("Conrad DIGI 35 CPU assumed at %s.", conn);
|
||||
|
||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_ACTIVE, "Conrad", "DIGI 35 CPU", NULL)))
|
||||
if (!(sdi = sr_dev_inst_new(SR_ST_ACTIVE, "Conrad", "DIGI 35 CPU", NULL)))
|
||||
return NULL;
|
||||
|
||||
sdi->conn = serial;
|
||||
|
|
|
@ -287,7 +287,7 @@ static GSList *scan(GSList *options)
|
|||
}
|
||||
|
||||
devices = NULL;
|
||||
sdi = sr_dev_inst_new(0, SR_ST_ACTIVE, "Demo device", NULL, NULL);
|
||||
sdi = sr_dev_inst_new(SR_ST_ACTIVE, "Demo device", NULL, NULL);
|
||||
if (!sdi) {
|
||||
sr_err("Device instance creation failed.");
|
||||
return NULL;
|
||||
|
|
|
@ -122,7 +122,7 @@ static GSList *fluke_scan(const char *conn, const char *serialcomm)
|
|||
continue;
|
||||
/* Skip leading spaces in version number. */
|
||||
for (s = 0; tokens[1][s] == ' '; s++);
|
||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, "Fluke",
|
||||
if (!(sdi = sr_dev_inst_new(SR_ST_INACTIVE, "Fluke",
|
||||
tokens[0] + 6, tokens[1] + s)))
|
||||
return NULL;
|
||||
if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {
|
||||
|
|
|
@ -238,7 +238,7 @@ static GSList *scan(GSList *options)
|
|||
if (!prof)
|
||||
continue;
|
||||
|
||||
sdi = sr_dev_inst_new(0, SR_ST_INITIALIZING,
|
||||
sdi = sr_dev_inst_new(SR_ST_INITIALIZING,
|
||||
prof->vendor, prof->model, prof->model_version);
|
||||
if (!sdi)
|
||||
return NULL;
|
||||
|
|
|
@ -223,7 +223,7 @@ static GSList *scan_1x_2x_rs232(GSList *options)
|
|||
|
||||
if (model != METRAHIT_NONE) {
|
||||
sr_spew("%s %s detected!", VENDOR_GMC, gmc_model_str(model));
|
||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, VENDOR_GMC,
|
||||
if (!(sdi = sr_dev_inst_new(SR_ST_INACTIVE, VENDOR_GMC,
|
||||
gmc_model_str(model), NULL)))
|
||||
return NULL;
|
||||
if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {
|
||||
|
@ -303,7 +303,7 @@ static GSList *scan_2x_bd232(GSList *options)
|
|||
goto exit_err;
|
||||
}
|
||||
|
||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, VENDOR_GMC, NULL, NULL)))
|
||||
if (!(sdi = sr_dev_inst_new(SR_ST_INACTIVE, VENDOR_GMC, NULL, NULL)))
|
||||
goto exit_err;
|
||||
|
||||
sdi->priv = devc;
|
||||
|
@ -354,7 +354,7 @@ static GSList *scan_2x_bd232(GSList *options)
|
|||
goto exit_err;
|
||||
}
|
||||
|
||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, VENDOR_GMC, NULL, NULL)))
|
||||
if (!(sdi = sr_dev_inst_new(SR_ST_INACTIVE, VENDOR_GMC, NULL, NULL)))
|
||||
goto exit_err;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -75,7 +75,7 @@ static struct sr_dev_inst *hmo_probe_serial_device(struct sr_scpi_dev_inst *scpi
|
|||
if (check_manufacturer(hw_info->manufacturer) != SR_OK)
|
||||
goto fail;
|
||||
|
||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_ACTIVE,
|
||||
if (!(sdi = sr_dev_inst_new(SR_ST_ACTIVE,
|
||||
hw_info->manufacturer, hw_info->model,
|
||||
hw_info->firmware_version))) {
|
||||
goto fail;
|
||||
|
|
|
@ -166,7 +166,7 @@ static struct sr_dev_inst *dso_dev_new(const struct dso_profile *prof)
|
|||
struct dev_context *devc;
|
||||
int i;
|
||||
|
||||
sdi = sr_dev_inst_new(0, SR_ST_INITIALIZING,
|
||||
sdi = sr_dev_inst_new(SR_ST_INITIALIZING,
|
||||
prof->vendor, prof->model, NULL);
|
||||
if (!sdi)
|
||||
return NULL;
|
||||
|
|
|
@ -123,7 +123,7 @@ static GSList *scan(GSList *options)
|
|||
}
|
||||
|
||||
/* Register the device with libsigrok. */
|
||||
sdi = sr_dev_inst_new(0, SR_ST_INITIALIZING,
|
||||
sdi = sr_dev_inst_new(SR_ST_INITIALIZING,
|
||||
USB_VENDOR_NAME, USB_MODEL_NAME, NULL);
|
||||
if (!sdi) {
|
||||
sr_err("Failed to create device instance.");
|
||||
|
|
|
@ -129,7 +129,7 @@ static GSList *scan(GSList *options)
|
|||
for (l = usb_devices; l; l = l->next) {
|
||||
if (scan_kecheng(l->data, &model) != SR_OK)
|
||||
continue;
|
||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, VENDOR,
|
||||
if (!(sdi = sr_dev_inst_new(SR_ST_INACTIVE, VENDOR,
|
||||
model, NULL)))
|
||||
return NULL;
|
||||
g_free(model);
|
||||
|
|
|
@ -323,7 +323,7 @@ static struct sr_dev_inst *lascar_identify(unsigned char *config)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, LASCAR_VENDOR,
|
||||
if (!(sdi = sr_dev_inst_new(SR_ST_INACTIVE, LASCAR_VENDOR,
|
||||
profile->modelname, firmware)))
|
||||
return NULL;
|
||||
sdi->driver = di;
|
||||
|
|
|
@ -203,7 +203,7 @@ static GSList *scan(GSList *options)
|
|||
return devices;
|
||||
}
|
||||
|
||||
struct sr_dev_inst *sdi = sr_dev_inst_new(0, SR_ST_INACTIVE,
|
||||
struct sr_dev_inst *sdi = sr_dev_inst_new(SR_ST_INACTIVE,
|
||||
manufacturer, product, hwrev);
|
||||
|
||||
if (!sdi) {
|
||||
|
|
|
@ -150,7 +150,7 @@ static GSList *scan(GSList *options)
|
|||
}
|
||||
|
||||
/* Init device instance, etc. */
|
||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, "Manson",
|
||||
if (!(sdi = sr_dev_inst_new(SR_ST_INACTIVE, "Manson",
|
||||
models[model_id].name, NULL))) {
|
||||
sr_err("Failed to create device instance.");
|
||||
return NULL;
|
||||
|
|
|
@ -84,7 +84,7 @@ static GSList *mic_scan(const char *conn, const char *serialcomm, int idx)
|
|||
sr_info("Found device on port %s.", conn);
|
||||
|
||||
/* TODO: Fill in version from protocol response. */
|
||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, mic_devs[idx].vendor,
|
||||
if (!(sdi = sr_dev_inst_new(SR_ST_INACTIVE, mic_devs[idx].vendor,
|
||||
mic_devs[idx].device, NULL)))
|
||||
goto scan_cleanup;
|
||||
|
||||
|
|
|
@ -444,7 +444,7 @@ static GSList *do_scan(lps_modelid modelid, struct sr_dev_driver *drv, GSList *o
|
|||
Therefore just print an error message, but do not exit with error. */
|
||||
sr_err("Failed to query for hardware version: %d %s", errno, strerror(errno));
|
||||
|
||||
sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, VENDOR_MOTECH, models[modelid].modelstr, verstr);
|
||||
sdi = sr_dev_inst_new(SR_ST_INACTIVE, VENDOR_MOTECH, models[modelid].modelstr, verstr);
|
||||
sdi->driver = drv;
|
||||
sdi->inst_type = SR_INST_SERIAL;
|
||||
sdi->conn = serial;
|
||||
|
|
|
@ -144,7 +144,7 @@ static GSList *do_scan(struct sr_dev_driver* drv, GSList *options)
|
|||
auxtype = xgittoint(buf[7]);
|
||||
sr_spew("%s %s DMM %s detected!", get_brandstr(drv), get_typestr(auxtype, drv), buf + 9);
|
||||
|
||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE,
|
||||
if (!(sdi = sr_dev_inst_new(SR_ST_INACTIVE,
|
||||
get_brandstr(drv), get_typestr(auxtype, drv), buf + 9)))
|
||||
return NULL;
|
||||
if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {
|
||||
|
|
|
@ -177,7 +177,7 @@ static GSList *scan(GSList *options)
|
|||
} else {
|
||||
/* Not an OLS -- some other board that uses the sump protocol. */
|
||||
sr_info("Device does not support metadata.");
|
||||
sdi = sr_dev_inst_new(0, SR_ST_INACTIVE,
|
||||
sdi = sr_dev_inst_new(SR_ST_INACTIVE,
|
||||
"Sump", "Logic Analyzer", "v1.0");
|
||||
sdi->driver = di;
|
||||
for (i = 0; i < 32; i++) {
|
||||
|
|
|
@ -145,7 +145,7 @@ SR_PRIV struct sr_dev_inst *get_metadata(struct sr_serial_dev_inst *serial)
|
|||
GString *tmp_str, *devname, *version;
|
||||
guchar tmp_c;
|
||||
|
||||
sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, NULL, NULL, NULL);
|
||||
sdi = sr_dev_inst_new(SR_ST_INACTIVE, NULL, NULL, NULL);
|
||||
sdi->driver = di;
|
||||
devc = ols_dev_new();
|
||||
sdi->priv = devc;
|
||||
|
|
|
@ -226,7 +226,7 @@ SR_PRIV struct sr_dev_inst *p_ols_get_metadata(uint8_t *buf, int bytes_read, str
|
|||
guchar tmp_c;
|
||||
int index, i;
|
||||
|
||||
sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, NULL, NULL, NULL);
|
||||
sdi = sr_dev_inst_new(SR_ST_INACTIVE, NULL, NULL, NULL);
|
||||
sdi->driver = di;
|
||||
sdi->priv = devc;
|
||||
|
||||
|
|
|
@ -291,7 +291,7 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
|
|||
}
|
||||
}
|
||||
|
||||
if (!model || !(sdi = sr_dev_inst_new(0, SR_ST_ACTIVE,
|
||||
if (!model || !(sdi = sr_dev_inst_new(SR_ST_ACTIVE,
|
||||
model->series->vendor->name,
|
||||
model->name,
|
||||
hw_info->firmware_version))) {
|
||||
|
|
|
@ -198,7 +198,7 @@ static GSList *scan(GSList *options)
|
|||
if (des.idVendor != LOGIC16_VID || des.idProduct != LOGIC16_PID)
|
||||
continue;
|
||||
|
||||
sdi = sr_dev_inst_new(0, SR_ST_INITIALIZING,
|
||||
sdi = sr_dev_inst_new(SR_ST_INITIALIZING,
|
||||
"Saleae", "Logic16", NULL);
|
||||
if (!sdi)
|
||||
return NULL;
|
||||
|
|
|
@ -83,7 +83,7 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
sdi = sr_dev_inst_new(0, SR_ST_ACTIVE, vendor, hw_info->model,
|
||||
sdi = sr_dev_inst_new(SR_ST_ACTIVE, vendor, hw_info->model,
|
||||
hw_info->firmware_version);
|
||||
sdi->conn = scpi;
|
||||
sdi->driver = di;
|
||||
|
|
|
@ -397,7 +397,7 @@ static GSList *sdmm_scan(const char *conn, const char *serialcomm, int dmm)
|
|||
|
||||
sr_info("Found device on port %s.", conn);
|
||||
|
||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, dmms[dmm].vendor,
|
||||
if (!(sdi = sr_dev_inst_new(SR_ST_INACTIVE, dmms[dmm].vendor,
|
||||
dmms[dmm].device, NULL)))
|
||||
goto scan_cleanup;
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ static GSList *scan(GSList *options)
|
|||
|
||||
sr_info("Found device on port %s.", conn);
|
||||
|
||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, "EDF", "Teleinfo", NULL)))
|
||||
if (!(sdi = sr_dev_inst_new(SR_ST_INACTIVE, "EDF", "Teleinfo", NULL)))
|
||||
goto scan_cleanup;
|
||||
|
||||
if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {
|
||||
|
|
|
@ -84,7 +84,7 @@ static GSList *scan(GSList *options)
|
|||
if (!serialcomm)
|
||||
serialcomm = SERIALCOMM;
|
||||
|
||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, "Tondaj",
|
||||
if (!(sdi = sr_dev_inst_new(SR_ST_INACTIVE, "Tondaj",
|
||||
"SL-814", NULL))) {
|
||||
sr_err("Failed to create device instance.");
|
||||
return NULL;
|
||||
|
|
|
@ -212,7 +212,7 @@ static GSList *scan(GSList *options, int dmm)
|
|||
|
||||
devc->first_run = TRUE;
|
||||
|
||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE,
|
||||
if (!(sdi = sr_dev_inst_new(SR_ST_INACTIVE,
|
||||
udmms[dmm].vendor, udmms[dmm].device, NULL))) {
|
||||
sr_err("sr_dev_inst_new returned NULL.");
|
||||
return NULL;
|
||||
|
|
|
@ -79,7 +79,7 @@ static GSList *scan(GSList *options)
|
|||
/* We have a list of sr_usb_dev_inst matching the connection
|
||||
* string. Wrap them in sr_dev_inst and we're done. */
|
||||
for (l = usb_devices; l; l = l->next) {
|
||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, VENDOR,
|
||||
if (!(sdi = sr_dev_inst_new(SR_ST_INACTIVE, VENDOR,
|
||||
MODEL, NULL)))
|
||||
return NULL;
|
||||
sdi->driver = di;
|
||||
|
|
|
@ -62,7 +62,7 @@ static struct sr_dev_inst *probe_usbtmc_device(struct sr_scpi_dev_inst *scpi)
|
|||
if (dlm_model_get(hw_info->model, &model_name, &model_index) != SR_OK)
|
||||
goto fail;
|
||||
|
||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_ACTIVE, MANUFACTURER_NAME,
|
||||
if (!(sdi = sr_dev_inst_new(SR_ST_ACTIVE, MANUFACTURER_NAME,
|
||||
model_name, NULL)))
|
||||
goto fail;
|
||||
|
||||
|
|
|
@ -221,7 +221,7 @@ static GSList *scan(GSList *options)
|
|||
sr_info("Found ZEROPLUS %s.", prof->model_name);
|
||||
|
||||
/* Register the device with libsigrok. */
|
||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_INACTIVE,
|
||||
if (!(sdi = sr_dev_inst_new(SR_ST_INACTIVE,
|
||||
VENDOR_NAME, prof->model_name, NULL))) {
|
||||
sr_err("%s: sr_dev_inst_new failed", __func__);
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in New Issue