]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/ikalogic-scanaplus/api.c
Simplify single device list handling
[libsigrok.git] / src / hardware / ikalogic-scanaplus / api.c
index 9b4af07de364754aa143bc8165f583814833cc93..520bf6fe94da19b3f29010a23ef555401daf88fa 100644 (file)
@@ -68,7 +68,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        struct sr_dev_inst *sdi;
        struct drv_context *drvc;
        struct dev_context *devc;
-       GSList *devices;
        unsigned int i;
        int ret;
 
@@ -76,8 +75,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
 
        drvc = di->context;
 
-       devices = NULL;
-
        /* Allocate memory for our private device context. */
        devc = g_malloc0(sizeof(struct dev_context));
 
@@ -115,19 +112,15 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        sdi->status = SR_ST_INACTIVE;
        sdi->vendor = g_strdup(USB_VENDOR_NAME);
        sdi->model = g_strdup(USB_MODEL_NAME);
-       sdi->driver = di;
        sdi->priv = devc;
 
        for (i = 0; i < ARRAY_SIZE(channel_names); i++)
                sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, channel_names[i]);
 
-       devices = g_slist_append(devices, sdi);
-       drvc->instances = g_slist_append(drvc->instances, sdi);
-
        /* Close device. We'll reopen it again when we need it. */
        scanaplus_close(devc);
 
-       return devices;
+       return std_scan_complete(di, g_slist_append(NULL, sdi));
 
        scanaplus_close(devc);
 err_free_ftdic: