drivers: Random SR_CONF_LIMIT_* cleanups.

Drop unneeded variables and checks (performed by the wrappers already).
This commit is contained in:
Uwe Hermann 2017-07-28 21:51:34 +02:00
parent 697fb6ddfc
commit 50ccb36f20
8 changed files with 5 additions and 27 deletions

View File

@ -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);

View File

@ -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));

View File

@ -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:

View File

@ -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:

View File

@ -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:

View File

@ -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)

View File

@ -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)

View File

@ -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 = "";