]> sigrok.org Git - libsigrok.git/commitdiff
norma-dmm: Remove unused version field from state struct
authorLars-Peter Clausen <redacted>
Wed, 4 May 2016 09:44:04 +0000 (11:44 +0200)
committerLars-Peter Clausen <redacted>
Sat, 28 May 2016 10:52:05 +0000 (12:52 +0200)
The version field in the norma-dmm driver state struct is initialized, but
never read and the same information is also already available in the
sr_dev_inst struct version field. So remove it to simplify the code.

This allows to get rid of the custom dev_close() callback and just use the
standard std_serial_dev_close() instead.

Signed-off-by: Lars-Peter Clausen <redacted>
src/hardware/norma-dmm/api.c
src/hardware/norma-dmm/protocol.h

index 2d154a408914e69dbda876741c9f7435be30f0a0..04e16a5537d42311726affd85f4a2bf7ef6e1814 100644 (file)
@@ -133,7 +133,6 @@ static GSList *scan(struct sr_dev_driver *drv, GSList *options)
                        devc = g_malloc0(sizeof(struct dev_context));
                        sr_sw_limits_init(&devc->limits);
                        devc->type = auxtype;
-                       devc->version = g_strdup(&buf[9]);
                        sdi->conn = serial;
                        sdi->priv = devc;
                        sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
@@ -162,21 +161,6 @@ static GSList *scan(struct sr_dev_driver *drv, GSList *options)
        return std_scan_complete(drv, devices);
 }
 
-static int dev_close(struct sr_dev_inst *sdi)
-{
-       struct dev_context *devc;
-
-       std_serial_dev_close(sdi);
-
-       /* Free dynamically allocated resources. */
-       if ((devc = sdi->priv) && devc->version) {
-               g_free(devc->version);
-               devc->version = NULL;
-       }
-
-       return SR_OK;
-}
-
 static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
                const struct sr_channel_group *cg)
 {
@@ -237,7 +221,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
 
 static int dev_acquisition_stop(struct sr_dev_inst *sdi)
 {
-       return std_serial_dev_acquisition_stop(sdi, dev_close,
+       return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close,
                        sdi->conn, LOG_PREFIX);
 }
 
@@ -254,7 +238,7 @@ static struct sr_dev_driver norma_dmm_driver_info = {
        .config_set = config_set,
        .config_list = config_list,
        .dev_open = std_serial_dev_open,
-       .dev_close = dev_close,
+       .dev_close = std_serial_dev_close,
        .dev_acquisition_start = dev_acquisition_start,
        .dev_acquisition_stop = dev_acquisition_stop,
        .context = NULL,
@@ -274,7 +258,7 @@ static struct sr_dev_driver siemens_b102x_driver_info = {
        .config_set = config_set,
        .config_list = config_list,
        .dev_open = std_serial_dev_open,
-       .dev_close = dev_close,
+       .dev_close = std_serial_dev_close,
        .dev_acquisition_start = dev_acquisition_start,
        .dev_acquisition_stop = dev_acquisition_stop,
        .context = NULL,
index 9a43dca27693cc9d9ad0066cacc5e803d2e21abf..7ce7911f95986f6a45f0f2375e9a54bfe2f7c7c7 100644 (file)
@@ -57,7 +57,6 @@ extern const struct nmadmm_req nmadmm_requests[];
 /** Private, per-device-instance driver context. */
 struct dev_context {
        /* Model-specific information */
-       char *version;          /**< Version string */
        int type;               /**< DM9x0, e.g. 5 = DM950 */
 
        /* Acquisition settings */