+static int hw_dev_acquisition_stop(const struct sr_dev_inst *sdi,
+ void *cb_data);
+
+static void clear_instances(void)
+{
+ GSList *l;
+ struct sr_dev_inst *sdi;
+ struct context *ctx;
+
+ /* Properly close all devices. */
+ 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__);
+ continue;
+ }
+ if (sdi->priv) {
+ ctx = sdi->priv;
+ ftdi_free(ctx->ftdic);
+ g_free(ctx);
+ }
+ sr_dev_inst_free(sdi);
+ }
+ g_slist_free(cdi->instances);
+ cdi->instances = NULL;
+
+}