]> sigrok.org Git - libsigrok.git/commitdiff
mic-985xx: Use std_dev_clear().
authorUwe Hermann <redacted>
Fri, 10 May 2013 15:54:53 +0000 (17:54 +0200)
committerUwe Hermann <redacted>
Fri, 10 May 2013 15:54:53 +0000 (17:54 +0200)
hardware/mic-985xx/api.c

index 4bed67ba81cc11bd1145c9bda676855acf9e71e3..e2cc91714e4d493dda68087d0f53815a4bcd1bdc 100644 (file)
@@ -51,32 +51,7 @@ SR_PRIV const struct mic_dev_info mic_devs[] = {
 
 static int clear_instances(int idx)
 {
-       struct sr_dev_inst *sdi;
-       struct drv_context *drvc;
-       struct dev_context *devc;
-       struct sr_serial_dev_inst *serial;
-       GSList *l;
-       struct sr_dev_driver *di;
-
-       di = mic_devs[idx].di;
-
-       if (!(drvc = di->priv))
-               return SR_OK;
-
-       for (l = drvc->instances; l; l = l->next) {
-               if (!(sdi = l->data))
-                       continue;
-               if (!(devc = sdi->priv))
-                       continue;
-               serial = sdi->conn;
-               sr_serial_dev_inst_free(serial);
-               sr_dev_inst_free(sdi);
-       }
-
-       g_slist_free(drvc->instances);
-       drvc->instances = NULL;
-
-       return SR_OK;
+       return std_dev_clear(mic_devs[idx].di, NULL);
 }
 
 static int hw_init(struct sr_context *sr_ctx, int idx)
@@ -210,9 +185,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
 
 static int hw_cleanup(int idx)
 {
-       clear_instances(idx);
-
-       return SR_OK;
+       return clear_instances(idx);
 }
 
 static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)