drivers: Random SR_CONF_LIMIT_* cleanups.
Drop unneeded variables and checks (performed by the wrappers already).
This commit is contained in:
parent
697fb6ddfc
commit
50ccb36f20
|
@ -206,11 +206,7 @@ static int config_set(uint32_t key, GVariant *data,
|
||||||
ret = sigma_set_samplerate(sdi, g_variant_get_uint64(data));
|
ret = sigma_set_samplerate(sdi, g_variant_get_uint64(data));
|
||||||
break;
|
break;
|
||||||
case SR_CONF_LIMIT_MSEC:
|
case SR_CONF_LIMIT_MSEC:
|
||||||
tmp = g_variant_get_uint64(data);
|
devc->limit_msec = g_variant_get_uint64(data);
|
||||||
if (tmp > 0)
|
|
||||||
devc->limit_msec = g_variant_get_uint64(data);
|
|
||||||
else
|
|
||||||
ret = SR_ERR;
|
|
||||||
break;
|
break;
|
||||||
case SR_CONF_LIMIT_SAMPLES:
|
case SR_CONF_LIMIT_SAMPLES:
|
||||||
tmp = g_variant_get_uint64(data);
|
tmp = g_variant_get_uint64(data);
|
||||||
|
|
|
@ -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)
|
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
uint64_t tmp_u64;
|
|
||||||
int tmp, ret, idx;
|
int tmp, ret, idx;
|
||||||
|
|
||||||
(void)cg;
|
(void)cg;
|
||||||
|
@ -207,9 +206,7 @@ static int config_set(uint32_t key, GVariant *data,
|
||||||
ret = SR_OK;
|
ret = SR_OK;
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_LIMIT_SAMPLES:
|
case SR_CONF_LIMIT_SAMPLES:
|
||||||
tmp_u64 = g_variant_get_uint64(data);
|
devc->limit_samples = g_variant_get_uint64(data);
|
||||||
devc->limit_samples = tmp_u64;
|
|
||||||
ret = SR_OK;
|
|
||||||
break;
|
break;
|
||||||
case SR_CONF_DATALOG:
|
case SR_CONF_DATALOG:
|
||||||
ret = cem_dt_885x_recording_set(sdi, g_variant_get_boolean(data));
|
ret = cem_dt_885x_recording_set(sdi, g_variant_get_boolean(data));
|
||||||
|
|
|
@ -325,13 +325,9 @@ static int config_set(uint32_t key, GVariant *data,
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
break;
|
break;
|
||||||
case SR_CONF_LIMIT_MSEC:
|
case SR_CONF_LIMIT_MSEC:
|
||||||
if (g_variant_get_uint64(data) == 0)
|
|
||||||
return SR_ERR_ARG;
|
|
||||||
devc->limit_msec = g_variant_get_uint64(data);
|
devc->limit_msec = g_variant_get_uint64(data);
|
||||||
break;
|
break;
|
||||||
case SR_CONF_LIMIT_SAMPLES:
|
case SR_CONF_LIMIT_SAMPLES:
|
||||||
if (g_variant_get_uint64(data) == 0)
|
|
||||||
return SR_ERR_ARG;
|
|
||||||
devc->limit_samples = g_variant_get_uint64(data);
|
devc->limit_samples = g_variant_get_uint64(data);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -348,8 +348,6 @@ static int config_set(uint32_t key, GVariant *data,
|
||||||
/* TODO: Implement. */
|
/* TODO: Implement. */
|
||||||
return SR_ERR_NA;
|
return SR_ERR_NA;
|
||||||
case SR_CONF_LIMIT_SAMPLES:
|
case SR_CONF_LIMIT_SAMPLES:
|
||||||
if (g_variant_get_uint64(data) == 0)
|
|
||||||
return SR_ERR_ARG;
|
|
||||||
devc->limit_samples = g_variant_get_uint64(data);
|
devc->limit_samples = g_variant_get_uint64(data);
|
||||||
break;
|
break;
|
||||||
case SR_CONF_SAMPLERATE:
|
case SR_CONF_SAMPLERATE:
|
||||||
|
|
|
@ -236,13 +236,9 @@ static int config_set(uint32_t key, GVariant *data,
|
||||||
/* Nothing to do, the ScanaPLUS samplerate is always 100MHz. */
|
/* Nothing to do, the ScanaPLUS samplerate is always 100MHz. */
|
||||||
break;
|
break;
|
||||||
case SR_CONF_LIMIT_MSEC:
|
case SR_CONF_LIMIT_MSEC:
|
||||||
if (g_variant_get_uint64(data) == 0)
|
|
||||||
return SR_ERR_ARG;
|
|
||||||
devc->limit_msec = g_variant_get_uint64(data);
|
devc->limit_msec = g_variant_get_uint64(data);
|
||||||
break;
|
break;
|
||||||
case SR_CONF_LIMIT_SAMPLES:
|
case SR_CONF_LIMIT_SAMPLES:
|
||||||
if (g_variant_get_uint64(data) == 0)
|
|
||||||
return SR_ERR_ARG;
|
|
||||||
devc->limit_samples = g_variant_get_uint64(data);
|
devc->limit_samples = g_variant_get_uint64(data);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -255,8 +255,6 @@ static int config_set(uint32_t key, GVariant *data,
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_LIMIT_SAMPLES:
|
case SR_CONF_LIMIT_SAMPLES:
|
||||||
devc->limit_samples = g_variant_get_uint64(data);
|
devc->limit_samples = g_variant_get_uint64(data);
|
||||||
sr_dbg("Setting sample limit to %" PRIu64 ".",
|
|
||||||
devc->limit_samples);
|
|
||||||
break;
|
break;
|
||||||
case SR_CONF_SAMPLE_INTERVAL:
|
case SR_CONF_SAMPLE_INTERVAL:
|
||||||
if ((idx = std_u64_tuple_idx(data, ARRAY_AND_SIZE(kecheng_kc_330b_sample_intervals))) < 0)
|
if ((idx = std_u64_tuple_idx(data, ARRAY_AND_SIZE(kecheng_kc_330b_sample_intervals))) < 0)
|
||||||
|
|
|
@ -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)
|
const struct sr_channel_group *cg)
|
||||||
{
|
{
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
uint64_t tmp_u64;
|
|
||||||
int ret, idx;
|
int ret, idx;
|
||||||
|
|
||||||
(void)cg;
|
(void)cg;
|
||||||
|
@ -171,9 +170,7 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
|
||||||
ret = SR_OK;
|
ret = SR_OK;
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case SR_CONF_LIMIT_SAMPLES:
|
case SR_CONF_LIMIT_SAMPLES:
|
||||||
tmp_u64 = g_variant_get_uint64(data);
|
devc->limit_samples = g_variant_get_uint64(data);
|
||||||
devc->limit_samples = tmp_u64;
|
|
||||||
ret = SR_OK;
|
|
||||||
break;
|
break;
|
||||||
case SR_CONF_SPL_WEIGHT_FREQ:
|
case SR_CONF_SPL_WEIGHT_FREQ:
|
||||||
if ((idx = std_str_idx(data, ARRAY_AND_SIZE(weight_freq))) < 0)
|
if ((idx = std_str_idx(data, ARRAY_AND_SIZE(weight_freq))) < 0)
|
||||||
|
|
|
@ -666,9 +666,9 @@ static int check_key(const struct sr_dev_driver *driver,
|
||||||
const char *opstr;
|
const char *opstr;
|
||||||
|
|
||||||
if (sdi && cg)
|
if (sdi && cg)
|
||||||
suffix = " for this device and channel group";
|
suffix = " for this device instance and channel group";
|
||||||
else if (sdi)
|
else if (sdi)
|
||||||
suffix = " for this device";
|
suffix = " for this device instance";
|
||||||
else
|
else
|
||||||
suffix = "";
|
suffix = "";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue