NULL,
};
-/* TODO need a way to keep these local to the static library */
-SR_PRIV GSList *genericdmm_dev_insts = NULL;
+SR_PRIV struct sr_dev_driver genericdmm_driver_info;
+static struct sr_dev_driver *gdi = &genericdmm_driver_info;
+/* TODO need a way to keep this local to the static library */
SR_PRIV libusb_context *genericdmm_usb_context = NULL;
struct sr_dev_inst *sdi;
struct context *ctx;
- if (!(sdi = sr_dev_inst_get(genericdmm_dev_insts, dev_index))) {
+ if (!(sdi = sr_dev_inst_get(gdi->instances, dev_index))) {
sr_err("genericdmm: sdi was NULL.");
return SR_ERR_BUG;
}
struct sr_dev_inst *sdi;
struct context *ctx;
- if (!(sdi = sr_dev_inst_get(genericdmm_dev_insts, dev_index))) {
+ if (!(sdi = sr_dev_inst_get(gdi->instances, dev_index))) {
sr_err("genericdmm: %s: sdi was NULL.", __func__);
return SR_ERR_BUG;
}
struct context *ctx;
/* Properly close and free all devices. */
- for (l = genericdmm_dev_insts; l; l = l->next) {
+ for (l = gdi->instances; l; l = l->next) {
if (!(sdi = l->data)) {
/* Log error, but continue cleaning up the rest. */
sr_err("genericdmm: sdi was NULL, continuing.");
sr_dev_inst_free(sdi);
}
- g_slist_free(genericdmm_dev_insts);
- genericdmm_dev_insts = NULL;
+ g_slist_free(gdi->instances);
+ gdi->instances = NULL;
if (genericdmm_usb_context)
libusb_exit(genericdmm_usb_context);
struct context *ctx;
const void *info;
- if (!(sdi = sr_dev_inst_get(genericdmm_dev_insts, dev_index))) {
+ if (!(sdi = sr_dev_inst_get(gdi->instances, dev_index))) {
sr_err("genericdmm: sdi was NULL.");
return NULL;
}
{
struct sr_dev_inst *sdi;
- if (!(sdi = sr_dev_inst_get(genericdmm_dev_insts, dev_index))) {
+ if (!(sdi = sr_dev_inst_get(gdi->instances, dev_index))) {
sr_err("genericdmm: sdi was NULL, device not found.");
return SR_ST_NOT_FOUND;
}
struct context *ctx;
int i;
- if (!(sdi = sr_dev_inst_get(genericdmm_dev_insts, dev_index))) {
+ if (!(sdi = sr_dev_inst_get(gdi->instances, dev_index))) {
sr_err("genericdmm: sdi was NULL.");
return SR_ERR_BUG;
}
struct sr_dev_inst *sdi;
struct context *ctx;
- if (!(sdi = sr_dev_inst_get(genericdmm_dev_insts, dev_index))) {
+ if (!(sdi = sr_dev_inst_get(gdi->instances, dev_index))) {
sr_err("genericdmm: sdi was NULL.");
return SR_ERR_BUG;
}
.dev_config_set = hw_dev_config_set,
.dev_acquisition_start = hw_dev_acquisition_start,
.dev_acquisition_stop = hw_dev_acquisition_stop,
+ .instances = NULL,
};