X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fagilent-dmm%2Fapi.c;fp=hardware%2Fagilent-dmm%2Fapi.c;h=a7f3beb58e351128ee3ebfde2b80751b7dfa5135;hb=676c28a846ed8854c35e4d9b8914ff9a0f5a9b26;hp=58c82f709738178f3a57cdab6595097cf9e0c2c3;hpb=8d18d266f5cff373287e7bb122fa63581a4f88af;p=libsigrok.git diff --git a/hardware/agilent-dmm/api.c b/hardware/agilent-dmm/api.c index 58c82f70..a7f3beb5 100644 --- a/hardware/agilent-dmm/api.c +++ b/hardware/agilent-dmm/api.c @@ -61,32 +61,9 @@ static const struct agdmm_profile supported_agdmm[] = { SR_PRIV struct sr_dev_driver agdmm_driver_info; static struct sr_dev_driver *di = &agdmm_driver_info; -/* Properly close and free all devices. */ static int clear_instances(void) { - struct sr_dev_inst *sdi; - struct drv_context *drvc; - struct dev_context *devc; - struct sr_serial_dev_inst *serial; - GSList *l; - - if (!(drvc = di->priv)) - return SR_OK; - - drvc = di->priv; - 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(di, NULL); } static int init(struct sr_context *sr_ctx) @@ -220,10 +197,7 @@ static int dev_close(struct sr_dev_inst *sdi) static int cleanup(void) { - - clear_instances(); - - return SR_OK; + return clear_instances(); } static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)