]> sigrok.org Git - libsigrok.git/blobdiff - src/std.c
Remove unnecessary dev_clear() callbacks
[libsigrok.git] / src / std.c
index d741c80928a62f0a549d5efbe9305f7a69a33454..b66ed8f0b4884c603d4e235a972775c1a1ab40c6 100644 (file)
--- a/src/std.c
+++ b/src/std.c
@@ -63,6 +63,28 @@ SR_PRIV int std_init(struct sr_context *sr_ctx, struct sr_dev_driver *di,
        return SR_OK;
 }
 
+/**
+ * Standard driver cleanup() callback API helper
+ *
+ * @param di The driver instance to use.
+ *
+ * Frees all device instances by calling sr_dev_clear() and then releases any
+ * resources allocated by std_init().
+ *
+ * @retval SR_OK Success
+ * @retval SR_ERR_ARG Invalid driver
+ *
+*/
+SR_PRIV int std_cleanup(const struct sr_dev_driver *di)
+{
+       int ret;
+
+       ret = sr_dev_clear(di);
+       g_free(di->context);
+
+       return ret;
+}
+
 /**
  * Standard API helper for sending an SR_DF_HEADER packet.
  *