From: Uwe Hermann Date: Fri, 31 May 2013 12:17:38 +0000 (+0200) Subject: colead-slm: Use std_dev_clear(). X-Git-Tag: libsigrok-0.2.1~84 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=732899f8cf87798b61d67a1c28e4bb4d46146cae;p=libsigrok.git colead-slm: Use std_dev_clear(). --- diff --git a/hardware/colead-slm/api.c b/hardware/colead-slm/api.c index 96d43afd..a1687276 100644 --- a/hardware/colead-slm/api.c +++ b/hardware/colead-slm/api.c @@ -45,31 +45,9 @@ static const int32_t hwcaps[] = { SR_PRIV struct sr_dev_driver colead_slm_driver_info; static struct sr_dev_driver *di = &colead_slm_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; - - 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) @@ -166,9 +144,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)