diff --git a/hardware/chronovu-la8/api.c b/hardware/chronovu-la8/api.c index 08348e72..7b671ab7 100644 --- a/hardware/chronovu-la8/api.c +++ b/hardware/chronovu-la8/api.c @@ -25,7 +25,8 @@ #include "libsigrok-internal.h" #include "driver.h" -static GSList *dev_insts = NULL; +SR_PRIV struct sr_dev_driver chronovu_la8_driver_info; +static struct sr_dev_driver *cdi = &chronovu_la8_driver_info; /* * The ChronoVu LA8 can have multiple PIDs. Older versions shipped with @@ -115,7 +116,7 @@ static int hw_scan(void) sdi->priv = ctx; - dev_insts = g_slist_append(dev_insts, sdi); + cdi->instances = g_slist_append(cdi->instances, sdi); sr_spew("la8: Device init successful."); @@ -143,7 +144,7 @@ static int hw_dev_open(int dev_index) struct sr_dev_inst *sdi; struct context *ctx; - if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) { + if (!(sdi = sr_dev_inst_get(cdi->instances, dev_index))) { sr_err("la8: %s: sdi was NULL", __func__); return SR_ERR_BUG; } @@ -201,7 +202,7 @@ static int hw_dev_close(int dev_index) struct sr_dev_inst *sdi; struct context *ctx; - if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) { + if (!(sdi = sr_dev_inst_get(cdi->instances, dev_index))) { sr_err("la8: %s: sdi was NULL", __func__); return SR_ERR_BUG; } @@ -236,7 +237,7 @@ static int hw_cleanup(void) int ret = SR_OK; /* Properly close all devices. */ - for (l = dev_insts; l; l = l->next) { + for (l = cdi->instances; l; l = l->next) { if (!(sdi = l->data)) { /* Log error, but continue cleaning up the rest. */ sr_err("la8: %s: sdi was NULL, continuing", __func__); @@ -245,8 +246,8 @@ static int hw_cleanup(void) } sr_dev_inst_free(sdi); /* Returns void. */ } - g_slist_free(dev_insts); /* Returns void. */ - dev_insts = NULL; + g_slist_free(cdi->instances); /* Returns void. */ + cdi->instances = NULL; return ret; } @@ -257,7 +258,7 @@ static const void *hw_dev_info_get(int dev_index, int dev_info_id) struct context *ctx; const void *info; - if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) { + if (!(sdi = sr_dev_inst_get(cdi->instances, dev_index))) { sr_err("la8: %s: sdi was NULL", __func__); return NULL; } @@ -313,7 +314,7 @@ static int hw_dev_status_get(int dev_index) { struct sr_dev_inst *sdi; - if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) { + if (!(sdi = sr_dev_inst_get(cdi->instances, dev_index))) { sr_err("la8: %s: sdi was NULL, device not found", __func__); return SR_ST_NOT_FOUND; } @@ -335,7 +336,7 @@ static int hw_dev_config_set(int dev_index, int hwcap, const void *value) struct sr_dev_inst *sdi; struct context *ctx; - if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) { + if (!(sdi = sr_dev_inst_get(cdi->instances, dev_index))) { sr_err("la8: %s: sdi was NULL", __func__); return SR_ERR_BUG; } @@ -447,7 +448,7 @@ static int hw_dev_acquisition_start(int dev_index, void *cb_data) uint8_t buf[4]; int bytes_written; - if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) { + if (!(sdi = sr_dev_inst_get(cdi->instances, dev_index))) { sr_err("la8: %s: sdi was NULL", __func__); return SR_ERR_BUG; } @@ -526,7 +527,7 @@ static int hw_dev_acquisition_stop(int dev_index, void *cb_data) sr_dbg("la8: Stopping acquisition."); - if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) { + if (!(sdi = sr_dev_inst_get(cdi->instances, dev_index))) { sr_err("la8: %s: sdi was NULL", __func__); return SR_ERR_BUG; } @@ -559,4 +560,5 @@ SR_PRIV struct sr_dev_driver chronovu_la8_driver_info = { .dev_config_set = hw_dev_config_set, .dev_acquisition_start = hw_dev_acquisition_start, .dev_acquisition_stop = hw_dev_acquisition_stop, + .instances = NULL, };