From: Lars-Peter Clausen Date: Wed, 4 May 2016 09:44:04 +0000 (+0200) Subject: norma-dmm: Remove unused version field from state struct X-Git-Tag: libsigrok-0.5.0~364 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=eabfed20f7cce56a8e92161264817d268216d1aa;p=libsigrok.git norma-dmm: Remove unused version field from state struct 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 --- diff --git a/src/hardware/norma-dmm/api.c b/src/hardware/norma-dmm/api.c index 2d154a40..04e16a55 100644 --- a/src/hardware/norma-dmm/api.c +++ b/src/hardware/norma-dmm/api.c @@ -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, diff --git a/src/hardware/norma-dmm/protocol.h b/src/hardware/norma-dmm/protocol.h index 9a43dca2..7ce7911f 100644 --- a/src/hardware/norma-dmm/protocol.h +++ b/src/hardware/norma-dmm/protocol.h @@ -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 */