]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/hameg-hmo/api.c
clear_helper(): Use a cast to shorten all implementations.
[libsigrok.git] / src / hardware / hameg-hmo / api.c
index 20b5779c1968badbbfb29e4cca0902aabdb8946a..22fcbc54b3c07472689c18bd61a3c16ed86870d4 100644 (file)
@@ -110,23 +110,16 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        return sr_scpi_scan(di->context, options, hmo_probe_serial_device);
 }
 
-static void clear_helper(void *priv)
+static void clear_helper(struct dev_context *devc)
 {
-       struct dev_context *devc;
-
-       devc = priv;
-
        hmo_scope_state_free(devc->model_state);
-
        g_free(devc->analog_groups);
        g_free(devc->digital_groups);
-
-       g_free(devc);
 }
 
 static int dev_clear(const struct sr_dev_driver *di)
 {
-       return std_dev_clear(di, clear_helper);
+       return std_dev_clear_with_callback(di, (std_dev_clear_callback)clear_helper);
 }
 
 static int dev_open(struct sr_dev_inst *sdi)
@@ -137,18 +130,12 @@ static int dev_open(struct sr_dev_inst *sdi)
        if (hmo_scope_state_get(sdi) != SR_OK)
                return SR_ERR;
 
-       sdi->status = SR_ST_ACTIVE;
-
        return SR_OK;
 }
 
 static int dev_close(struct sr_dev_inst *sdi)
 {
-       sr_scpi_close(sdi->conn);
-
-       sdi->status = SR_ST_INACTIVE;
-
-       return SR_OK;
+       return sr_scpi_close(sdi->conn);
 }
 
 static int check_channel_group(struct dev_context *devc,