From: Uwe Hermann Date: Fri, 10 May 2013 17:06:47 +0000 (+0200) Subject: zeroplus: Use std_dev_clear(). X-Git-Tag: libsigrok-0.2.1~93 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=d6445cb0da6e6406f6cbf24f89bd570850d44fb1;p=libsigrok.git zeroplus: Use std_dev_clear(). --- diff --git a/hardware/zeroplus-logic-cube/api.c b/hardware/zeroplus-logic-cube/api.c index 273fb53a..13c649df 100644 --- a/hardware/zeroplus-logic-cube/api.c +++ b/hardware/zeroplus-logic-cube/api.c @@ -240,31 +240,7 @@ SR_PRIV int zp_set_samplerate(struct dev_context *devc, uint64_t samplerate) static int clear_instances(void) { - GSList *l; - struct sr_dev_inst *sdi; - struct drv_context *drvc; - struct dev_context *devc; - struct sr_usb_dev_inst *usb; - - drvc = di->priv; - for (l = drvc->instances; l; l = l->next) { - sdi = l->data; - if (!(devc = sdi->priv)) { - /* Log error, but continue cleaning up the rest. */ - sr_err("%s: sdi->priv was NULL, continuing", __func__); - continue; - } - usb = sdi->conn; - sr_usb_dev_inst_free(usb); - /* Properly close all devices... */ - hw_dev_close(sdi); - /* ...and free all their memory. */ - sr_dev_inst_free(sdi); - } - g_slist_free(drvc->instances); - drvc->instances = NULL; - - return SR_OK; + return std_dev_clear(di, NULL); } static int hw_init(struct sr_context *sr_ctx) @@ -487,14 +463,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi) static int hw_cleanup(void) { - struct drv_context *drvc; - - if (!(drvc = di->priv)) - return SR_OK; - - clear_instances(); - - return SR_OK; + return clear_instances(); } static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)