From: Uwe Hermann Date: Fri, 28 Jul 2017 19:51:34 +0000 (+0200) Subject: drivers: Random SR_CONF_LIMIT_* cleanups. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=50ccb36f201bd6b2326822f585c01498fe6fd86a;p=libsigrok.git drivers: Random SR_CONF_LIMIT_* cleanups. Drop unneeded variables and checks (performed by the wrappers already). --- diff --git a/src/hardware/asix-sigma/api.c b/src/hardware/asix-sigma/api.c index 41201c56..d2667f09 100644 --- a/src/hardware/asix-sigma/api.c +++ b/src/hardware/asix-sigma/api.c @@ -206,11 +206,7 @@ static int config_set(uint32_t key, GVariant *data, ret = sigma_set_samplerate(sdi, g_variant_get_uint64(data)); break; case SR_CONF_LIMIT_MSEC: - tmp = g_variant_get_uint64(data); - if (tmp > 0) - devc->limit_msec = g_variant_get_uint64(data); - else - ret = SR_ERR; + devc->limit_msec = g_variant_get_uint64(data); break; case SR_CONF_LIMIT_SAMPLES: tmp = g_variant_get_uint64(data); diff --git a/src/hardware/cem-dt-885x/api.c b/src/hardware/cem-dt-885x/api.c index 1976bd4f..c2177b30 100644 --- a/src/hardware/cem-dt-885x/api.c +++ b/src/hardware/cem-dt-885x/api.c @@ -197,7 +197,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc; - uint64_t tmp_u64; int tmp, ret, idx; (void)cg; @@ -207,9 +206,7 @@ static int config_set(uint32_t key, GVariant *data, ret = SR_OK; switch (key) { case SR_CONF_LIMIT_SAMPLES: - tmp_u64 = g_variant_get_uint64(data); - devc->limit_samples = tmp_u64; - ret = SR_OK; + devc->limit_samples = g_variant_get_uint64(data); break; case SR_CONF_DATALOG: ret = cem_dt_885x_recording_set(sdi, g_variant_get_boolean(data)); diff --git a/src/hardware/chronovu-la/api.c b/src/hardware/chronovu-la/api.c index 94b5b42a..a20697a3 100644 --- a/src/hardware/chronovu-la/api.c +++ b/src/hardware/chronovu-la/api.c @@ -325,13 +325,9 @@ static int config_set(uint32_t key, GVariant *data, return SR_ERR; break; case SR_CONF_LIMIT_MSEC: - if (g_variant_get_uint64(data) == 0) - return SR_ERR_ARG; devc->limit_msec = g_variant_get_uint64(data); break; case SR_CONF_LIMIT_SAMPLES: - if (g_variant_get_uint64(data) == 0) - return SR_ERR_ARG; devc->limit_samples = g_variant_get_uint64(data); break; default: diff --git a/src/hardware/ftdi-la/api.c b/src/hardware/ftdi-la/api.c index 1a6c3f35..2ad2f447 100644 --- a/src/hardware/ftdi-la/api.c +++ b/src/hardware/ftdi-la/api.c @@ -348,8 +348,6 @@ static int config_set(uint32_t key, GVariant *data, /* TODO: Implement. */ return SR_ERR_NA; case SR_CONF_LIMIT_SAMPLES: - if (g_variant_get_uint64(data) == 0) - return SR_ERR_ARG; devc->limit_samples = g_variant_get_uint64(data); break; case SR_CONF_SAMPLERATE: diff --git a/src/hardware/ikalogic-scanaplus/api.c b/src/hardware/ikalogic-scanaplus/api.c index fbbacd12..fe77104d 100644 --- a/src/hardware/ikalogic-scanaplus/api.c +++ b/src/hardware/ikalogic-scanaplus/api.c @@ -236,13 +236,9 @@ static int config_set(uint32_t key, GVariant *data, /* Nothing to do, the ScanaPLUS samplerate is always 100MHz. */ break; case SR_CONF_LIMIT_MSEC: - if (g_variant_get_uint64(data) == 0) - return SR_ERR_ARG; devc->limit_msec = g_variant_get_uint64(data); break; case SR_CONF_LIMIT_SAMPLES: - if (g_variant_get_uint64(data) == 0) - return SR_ERR_ARG; devc->limit_samples = g_variant_get_uint64(data); break; default: diff --git a/src/hardware/kecheng-kc-330b/api.c b/src/hardware/kecheng-kc-330b/api.c index 15c84b65..1b92b3cd 100644 --- a/src/hardware/kecheng-kc-330b/api.c +++ b/src/hardware/kecheng-kc-330b/api.c @@ -255,8 +255,6 @@ static int config_set(uint32_t key, GVariant *data, switch (key) { case SR_CONF_LIMIT_SAMPLES: devc->limit_samples = g_variant_get_uint64(data); - sr_dbg("Setting sample limit to %" PRIu64 ".", - devc->limit_samples); break; case SR_CONF_SAMPLE_INTERVAL: if ((idx = std_u64_tuple_idx(data, ARRAY_AND_SIZE(kecheng_kc_330b_sample_intervals))) < 0) diff --git a/src/hardware/pce-322a/api.c b/src/hardware/pce-322a/api.c index ef6023da..eb86f3a7 100644 --- a/src/hardware/pce-322a/api.c +++ b/src/hardware/pce-322a/api.c @@ -161,7 +161,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd const struct sr_channel_group *cg) { struct dev_context *devc; - uint64_t tmp_u64; int ret, idx; (void)cg; @@ -171,9 +170,7 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd ret = SR_OK; switch (key) { case SR_CONF_LIMIT_SAMPLES: - tmp_u64 = g_variant_get_uint64(data); - devc->limit_samples = tmp_u64; - ret = SR_OK; + devc->limit_samples = g_variant_get_uint64(data); break; case SR_CONF_SPL_WEIGHT_FREQ: if ((idx = std_str_idx(data, ARRAY_AND_SIZE(weight_freq))) < 0) diff --git a/src/hwdriver.c b/src/hwdriver.c index fe86fadb..8da425c8 100644 --- a/src/hwdriver.c +++ b/src/hwdriver.c @@ -666,9 +666,9 @@ static int check_key(const struct sr_dev_driver *driver, const char *opstr; if (sdi && cg) - suffix = " for this device and channel group"; + suffix = " for this device instance and channel group"; else if (sdi) - suffix = " for this device"; + suffix = " for this device instance"; else suffix = "";