]> sigrok.org Git - libsigrok.git/blobdiff - hardware/victor-dmm/api.c
Fix silly copy-paste error.
[libsigrok.git] / hardware / victor-dmm / api.c
index 06b47a57486727ac9840ff83a083be545f8f5efc..97e5f7bd95cbe180340844a9a1cfa3e72116e0c1 100644 (file)
@@ -33,7 +33,6 @@
 
 SR_PRIV struct sr_dev_driver victor_dmm_driver_info;
 static struct sr_dev_driver *di = &victor_dmm_driver_info;
-static int dev_close(struct sr_dev_inst *sdi);
 static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data);
 
 static const int32_t hwopts[] = {
@@ -47,37 +46,14 @@ static const int32_t hwcaps[] = {
        SR_CONF_CONTINUOUS,
 };
 
-/* Properly close and free all devices. */
-static int clear_instances(void)
+static int dev_clear(void)
 {
-       struct sr_dev_inst *sdi;
-       struct drv_context *drvc;
-       struct dev_context *devc;
-       GSList *l;
-
-       if (!(drvc = di->priv))
-               /* Can get called on an unused driver, doesn't matter. */
-               return SR_OK;
-
-       for (l = drvc->instances; l; l = l->next) {
-               if (!(sdi = l->data))
-                       continue;
-               if (!(devc = sdi->priv))
-                       continue;
-               dev_close(sdi);
-               sr_usb_dev_inst_free(sdi->conn);
-               sr_dev_inst_free(sdi);
-       }
-
-       g_slist_free(drvc->instances);
-       drvc->instances = NULL;
-
-       return SR_OK;
+       return std_dev_clear(di, NULL);
 }
 
 static int init(struct sr_context *sr_ctx)
 {
-       return std_hw_init(sr_ctx, di, LOG_PREFIX);
+       return std_init(sr_ctx, di, LOG_PREFIX);
 }
 
 static GSList *scan(GSList *options)
@@ -215,24 +191,28 @@ static int dev_close(struct sr_dev_inst *sdi)
 
 static int cleanup(void)
 {
+       int ret;
        struct drv_context *drvc;
 
        if (!(drvc = di->priv))
                /* Can get called on an unused driver, doesn't matter. */
                return SR_OK;
 
-       clear_instances();
+       ret = dev_clear();
        g_free(drvc);
        di->priv = NULL;
 
-       return SR_OK;
+       return ret;
 }
 
-static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
+static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
+               const struct sr_probe_group *probe_group)
 {
        struct sr_usb_dev_inst *usb;
        char str[128];
 
+       (void)probe_group;
+
        switch (id) {
        case SR_CONF_CONN:
                if (!sdi || !sdi->conn)
@@ -248,12 +228,15 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
        return SR_OK;
 }
 
-static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
+static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
+               const struct sr_probe_group *probe_group)
 {
        struct dev_context *devc;
        gint64 now;
        int ret;
 
+       (void)probe_group;
+
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
 
@@ -284,10 +267,11 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
        return ret;
 }
 
-static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
+static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
+               const struct sr_probe_group *probe_group)
 {
-
        (void)sdi;
+       (void)probe_group;
 
        switch (key) {
        case SR_CONF_SCAN_OPTIONS:
@@ -466,7 +450,7 @@ SR_PRIV struct sr_dev_driver victor_dmm_driver_info = {
        .cleanup = cleanup,
        .scan = scan,
        .dev_list = dev_list,
-       .dev_clear = clear_instances,
+       .dev_clear = dev_clear,
        .config_get = config_get,
        .config_set = config_set,
        .config_list = config_list,