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 <lars@metafoo.de>
This commit is contained in:
parent
cd0de200b1
commit
eabfed20f7
|
@ -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,
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue