]> sigrok.org Git - sigrok-util.git/blobdiff - source/drv-api.c
hw_dev_acquisition_stop no longer takes a const sdi
[sigrok-util.git] / source / drv-api.c
index 671149bd6fa4230d1d88de29632df177760540e6..2750a7996212587460a4c472cdf162a2d8864201 100644 (file)
@@ -22,7 +22,7 @@
 #include "libsigrok-internal.h"
 #include "protocol.h"
 
-SR_PRIV struct sr_dev_driver driver_info;
+SR_PRIV struct sr_dev_driver ${lib}_driver_info;
 static struct sr_dev_driver *di = &${lib}_driver_info;
 
 /* Properly close and free all devices. */
@@ -33,7 +33,9 @@ static int clear_instances(void)
        struct dev_context *devc;
        GSList *l;
 
-       drvc = di->priv;
+       if (!(drvc = di->priv))
+               return SR_OK;
+
        for (l = drvc->instances; l; l = l->next) {
                if (!(sdi = l->data))
                        continue;
@@ -57,7 +59,7 @@ static int hw_init(void)
 
        if (!(drvc = g_try_malloc0(sizeof(struct drv_context)))) {
                sr_err("Driver context malloc failed.");
-               return SR_ERR;
+               return SR_ERR_MALLOC;
        }
 
        /* TODO */
@@ -157,8 +159,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
        return SR_OK;
 }
 
-static int hw_dev_acquisition_stop(const struct sr_dev_inst *sdi,
-                                  void *cb_data)
+static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
 {
        (void)cb_data;