+static void clear_instances(void)
+{
+ GSList *l;
+ struct sr_dev_inst *sdi;
+ struct drv_context *drvc;
+ struct dev_context *devc;
+
+ drvc = adi->priv;
+
+ /* Properly close all devices. */
+ for (l = drvc->instances; l; l = l->next) {
+ if (!(sdi = l->data)) {
+ /* Log error, but continue cleaning up the rest. */
+ sr_err("sigma: %s: sdi was NULL, continuing", __func__);
+ continue;
+ }
+ if (sdi->priv) {
+ devc = sdi->priv;
+ ftdi_free(&devc->ftdic);
+ }
+ sr_dev_inst_free(sdi);
+ }
+ g_slist_free(drvc->instances);
+ drvc->instances = NULL;
+
+}
+
+static int hw_init(void)
+{
+ struct drv_context *drvc;
+
+ if (!(drvc = g_try_malloc0(sizeof(struct drv_context)))) {
+ sr_err("asix-sigma: driver context malloc failed.");
+ return SR_ERR;
+ }
+ adi->priv = drvc;
+
+ return SR_OK;
+}
+
+static GSList *hw_scan(GSList *options)