]> sigrok.org Git - libsigrok.git/commitdiff
drivers: Random SR_CONF_LIMIT_* cleanups.
authorUwe Hermann <redacted>
Fri, 28 Jul 2017 19:51:34 +0000 (21:51 +0200)
committerUwe Hermann <redacted>
Mon, 31 Jul 2017 14:23:31 +0000 (16:23 +0200)
Drop unneeded variables and checks (performed by the wrappers already).

src/hardware/asix-sigma/api.c
src/hardware/cem-dt-885x/api.c
src/hardware/chronovu-la/api.c
src/hardware/ftdi-la/api.c
src/hardware/ikalogic-scanaplus/api.c
src/hardware/kecheng-kc-330b/api.c
src/hardware/pce-322a/api.c
src/hwdriver.c

index 41201c5691eca9a2c33bb67c5590daae9b5d52dd..d2667f09fd5168c1431f7744b738d48e58779cdb 100644 (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);
index 1976bd4f1917efd582153395c31472404e9fe957..c2177b30ed0752738a9959ef861dc932af28b6c1 100644 (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));
index 94b5b42a04b213335c48418ae8367059b882d349..a20697a347d070e65d2cde834b448d787f030bc9 100644 (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:
index 1a6c3f3556ab81fca081659357c95371a59e3a78..2ad2f447ed08e27cc8512943309ba14677dfcffd 100644 (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:
index fbbacd12f0f0dbf8701a36189f90bd21a2417ef1..fe77104d300ef593d46a2b23f214910be9d1637a 100644 (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:
index 15c84b65209ef948cee34e2655f3945c37d68e9f..1b92b3cd0cb1111ceb43cef153d86f8defd8cd0c 100644 (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)
index ef6023daa1243783b85365b4b8604e5be31921de..eb86f3a735127dbb119285db0b8fbd9ba9bdc7b1 100644 (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)
index fe86fadbd27fb51c8736e9b57af3a14654a5b981..8da425c848a86089ac8bb754f136f682832e8ef3 100644 (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 = "";