From: Uwe Hermann Date: Fri, 31 May 2013 12:00:30 +0000 (+0200) Subject: brymen-dmm: Use std_dev_clear(). X-Git-Tag: libsigrok-0.2.1~87 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=40bbc64293f7a93cc25e594801315c6990b3bb03;p=libsigrok.git brymen-dmm: Use std_dev_clear(). --- diff --git a/hardware/brymen-dmm/api.c b/hardware/brymen-dmm/api.c index 3db7d337..ac0ad86b 100644 --- a/hardware/brymen-dmm/api.c +++ b/hardware/brymen-dmm/api.c @@ -39,31 +39,9 @@ static int init(struct sr_context *sr_ctx) return std_hw_init(sr_ctx, di, LOG_PREFIX); } -static void free_instance(void *inst) -{ - struct sr_dev_inst *sdi; - struct sr_serial_dev_inst *serial; - - if (!(sdi = inst)) - return; - - serial = sdi->conn; - sr_serial_dev_inst_free(serial); - sr_dev_inst_free(sdi); -} - -/* Properly close and free all devices. */ static int clear_instances(void) { - struct drv_context *drvc; - - if (!(drvc = di->priv)) - return SR_OK; - - g_slist_free_full(drvc->instances, free_instance); - drvc->instances = NULL; - - return SR_OK; + return std_dev_clear(di, NULL); } static GSList *brymen_scan(const char *conn, const char *serialcomm) @@ -199,9 +177,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)