From: Uwe Hermann Date: Fri, 10 May 2013 15:54:53 +0000 (+0200) Subject: mic-985xx: Use std_dev_clear(). X-Git-Tag: libsigrok-0.2.1~99 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=25e7adada7a398542eeca703d23972a9eb81cc7a;p=libsigrok.git mic-985xx: Use std_dev_clear(). --- diff --git a/hardware/mic-985xx/api.c b/hardware/mic-985xx/api.c index 4bed67ba..e2cc9171 100644 --- a/hardware/mic-985xx/api.c +++ b/hardware/mic-985xx/api.c @@ -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)