]> sigrok.org Git - libsigrok.git/blobdiff - hardware/alsa/api.c
std: Drop hw_ from function names.
[libsigrok.git] / hardware / alsa / api.c
index 69a78ad2f022fa545b3a9ae206c008f054c1b7c8..2d4da2631ec4c4dff483795dcc72d43cb74004b9 100644 (file)
@@ -36,22 +36,24 @@ static const int32_t hwcaps[] = {
 SR_PRIV struct sr_dev_driver alsa_driver_info;
 static struct sr_dev_driver *di = &alsa_driver_info;
 
-static int clear_instances(void)
+static void clear_helper(void *priv)
 {
-       struct drv_context *drvc;
+       struct dev_context *devc;
 
-       if (!(drvc = di->priv))
-               return SR_OK;
+       devc = priv;
 
-       g_slist_free_full(drvc->instances, (GDestroyNotify)alsa_dev_inst_clear);
-       drvc->instances = NULL;
+       snd_pcm_hw_params_free(devc->hw_params);
+       g_free((void *)devc->samplerates);
+}
 
-       return SR_OK;
+static int clear_instances(void)
+{
+       return std_dev_clear(di, clear_helper);
 }
 
 static int init(struct sr_context *sr_ctx)
 {
-       return std_hw_init(sr_ctx, di, LOG_PREFIX);
+       return std_init(sr_ctx, di, LOG_PREFIX);
 }
 
 static GSList *scan(GSList *options)
@@ -121,9 +123,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_get(int id, GVariant **data, const struct sr_dev_inst *sdi)