]> sigrok.org Git - libsigrok.git/commitdiff
sr_config_set(): Factor out SR_ERR_DEV_CLOSED check.
authorUwe Hermann <redacted>
Thu, 6 Jul 2017 18:05:43 +0000 (20:05 +0200)
committerUwe Hermann <redacted>
Fri, 7 Jul 2017 19:51:19 +0000 (21:51 +0200)
This ensures consistent checks and log messages across all drivers
and reduces the per-driver boilerplate.

54 files changed:
src/hardware/agilent-dmm/api.c
src/hardware/appa-55ii/api.c
src/hardware/arachnid-labs-re-load-pro/api.c
src/hardware/asix-sigma/api.c
src/hardware/atten-pps3xxx/api.c
src/hardware/baylibre-acme/api.c
src/hardware/beaglelogic/api.c
src/hardware/brymen-bm86x/api.c
src/hardware/brymen-dmm/api.c
src/hardware/cem-dt-885x/api.c
src/hardware/center-3xx/api.c
src/hardware/chronovu-la/api.c
src/hardware/colead-slm/api.c
src/hardware/conrad-digi-35-cpu/api.c
src/hardware/demo/api.c
src/hardware/dreamsourcelab-dslogic/api.c
src/hardware/fluke-dmm/api.c
src/hardware/ftdi-la/api.c
src/hardware/fx2lafw/api.c
src/hardware/gmc-mh-1x-2x/protocol.c
src/hardware/gwinstek-gds-800/api.c
src/hardware/hantek-6xxx/api.c
src/hardware/hantek-dso/api.c
src/hardware/hp-3457a/api.c
src/hardware/hung-chang-dso-2100/api.c
src/hardware/ikalogic-scanalogic2/api.c
src/hardware/ikalogic-scanaplus/api.c
src/hardware/kecheng-kc-330b/api.c
src/hardware/kern-scale/api.c
src/hardware/korad-kaxxxxp/api.c
src/hardware/lascar-el-usb/api.c
src/hardware/lecroy-logicstudio/api.c
src/hardware/link-mso19/api.c
src/hardware/manson-hcs-3xxx/api.c
src/hardware/maynuo-m97/api.c
src/hardware/mic-985xx/api.c
src/hardware/motech-lps-30x/api.c
src/hardware/norma-dmm/api.c
src/hardware/openbench-logic-sniffer/api.c
src/hardware/pce-322a/api.c
src/hardware/pipistrello-ols/api.c
src/hardware/rigol-ds/api.c
src/hardware/rohde-schwarz-sme-0x/api.c
src/hardware/saleae-logic-pro/api.c
src/hardware/saleae-logic16/api.c
src/hardware/scpi-pps/api.c
src/hardware/serial-dmm/api.c
src/hardware/teleinfo/api.c
src/hardware/testo/api.c
src/hardware/tondaj-sl-814/api.c
src/hardware/uni-t-ut32x/api.c
src/hardware/victor-dmm/api.c
src/hardware/zeroplus-logic-cube/api.c
src/hwdriver.c

index ea67039dfce7da8305a04d7ab76fe54e89d3453c..ab5daaa5518498dc84b968aac65e3121934f96a3 100644 (file)
@@ -227,9 +227,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        ret = SR_OK;
index c287134f63173f3105c10c2104b91c5867f8d389..0bd40bad316d2989ab3143e4c83b933e15656a60 100644 (file)
@@ -139,9 +139,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        switch (key) {
index 88e8f52e01e30c4489047e89268ee26cac5ee4aa..7a6e6bcd6b47006df14171886b3819e308ddc03b 100644 (file)
@@ -278,9 +278,6 @@ static int config_set(uint32_t key, GVariant *data,
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        ret = SR_OK;
index 30d32da4e343c5eb5b697da4e28cd0c64c40b9f0..62cfaa9bc4d5e393b912d55c5490da5fd131abde 100644 (file)
@@ -212,9 +212,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        ret = SR_OK;
index 9c43a78cc6b5d3f2acfda10b63153e9c9dcbf1ff..6458ebf4b3bf4e04f6cf5ac80bdc737cbe962b36 100644 (file)
@@ -261,9 +261,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
        const char *sval;
        gboolean bval;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        ret = SR_OK;
        devc = sdi->priv;
        if (!cg) {
index a1f149fc8b7aa91b5103bfbd0d41b3c6231e2d31..c00c37985fa6e538378d0effea684c333d7c33d6 100644 (file)
@@ -193,9 +193,6 @@ static int config_set(uint32_t key, GVariant *data,
        uint64_t samplerate;
        int ret;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        ret = SR_OK;
index 734f477f9f62cdb48d42fac7febfffda71d78265..09fcf0bdb5577459d49b2f7602b8ba03aaa0ff51 100644 (file)
@@ -210,9 +210,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        switch (key) {
        case SR_CONF_SAMPLERATE:
                devc->cur_samplerate = g_variant_get_uint64(data);
index 2edade93d28688b87821c1d7cff5f67eb3048413..def7b642dda7e5aa8c1a1469c1a5fbf7fea1307c 100644 (file)
@@ -176,9 +176,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        return sr_sw_limits_config_set(&devc->sw_limits, key, data);
index 9c7b273e9410dca1b11e42c929ef077c22cc80ae..2c43bb3aaf796dc8085f155daa4189dd6b8ccad4 100644 (file)
@@ -125,9 +125,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        return sr_sw_limits_config_set(&devc->sw_limits, key, data);
index 7ad8e610a83940b4c42adaeb87e45be3e523685e..709e92c91c4b753afeaafbc177f8604a4cc0ea01 100644 (file)
@@ -208,9 +208,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        ret = SR_OK;
index e826c59dabfc220fd106fbfa8e3c48fe785db608..9e618777a8bcaae462bcb1e6482b0d7f9f4d6fc8 100644 (file)
@@ -127,9 +127,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        return sr_sw_limits_config_set(&devc->sw_limits, key, data);
index e8a4afc38d9892078aaa4af4e276f548d912205c..d85c6c9a281adf9bebaf914402986f117a34bc45 100644 (file)
@@ -337,9 +337,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        switch (key) {
index f7a1c16ffc20ce8343f0a1fa5c3b74f428851e73..338462f3fd5abe280e4f7aa542e43ca34370d8d4 100644 (file)
@@ -88,9 +88,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        return sr_sw_limits_config_set(&devc->limits, key, data);
index ec134d308b32aa1eedea958afcda6de2b183d56c..cc5e4ebf35d02b2de3894b64c73819475f65b756 100644 (file)
@@ -103,9 +103,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        switch (key) {
        case SR_CONF_VOLTAGE:
                dblval = g_variant_get_double(data);
index 92de2ce1492e40ebadcad726a7c0abfbac33a95d..236bb316225898f04e4a860c6cc7a0ab6f200e0a 100644 (file)
@@ -288,9 +288,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        devc = sdi->priv;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        ret = SR_OK;
        switch (key) {
        case SR_CONF_SAMPLERATE:
index 84564d763e37af5bfaf2409e7644bb00ba1765a5..e9e4450272631b2e68807ade9c325049153b1d05 100644 (file)
@@ -505,9 +505,6 @@ static int config_set(uint32_t key, GVariant *data,
        if (!sdi)
                return SR_ERR_ARG;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR;
-
        devc = sdi->priv;
 
        ret = SR_OK;
index a706675a771bd4eb7121dcef7fd86fd4f8cd2906..75b0954de5a2716c5104e140078cb5768e7e676e 100644 (file)
@@ -186,9 +186,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        return sr_sw_limits_config_set(&devc->limits, key, data);
index 7adbb7a3796d23a6c69740879f733b8f1ff681fa..9aac98aebb87b3cbd0d87d8943d54330f7e32ec4 100644 (file)
@@ -369,9 +369,6 @@ static int config_set(uint32_t key, GVariant *data,
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        ret = SR_OK;
index 6c7d776f8e9109c2bb1a5b3b11e044d8cee47978..879fdf04ae1bfce2d4d05c49411657b9043e7d2d 100644 (file)
@@ -504,9 +504,6 @@ static int config_set(uint32_t key, GVariant *data,
        if (!sdi)
                return SR_ERR_ARG;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR;
-
        devc = sdi->priv;
 
        ret = SR_OK;
index 2911b82f8ae91e34dc343cc00578f87a5ad4de44..5820a0ec89aa1e1429490cb976fa61f3dfd53c5e 100644 (file)
@@ -1505,9 +1505,6 @@ SR_PRIV int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *s
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        switch (key) {
index d8b00f9abcf86af42a34248e3c01e3f0d4aa5602..d64d43eb43dd3a73f10ce9efbef66744aae87d59 100644 (file)
@@ -153,9 +153,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
        if (!sdi)
                return SR_ERR_ARG;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        switch (key) {
index e4e20e0a84da803a6adc9cc22cfcaa8add5e66a6..a17ec668987d6537cd307e4078df0fe20e277973 100644 (file)
@@ -401,9 +401,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
        unsigned int i;
        const char *tmp_str;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        ret = SR_OK;
        devc = sdi->priv;
        if (!cg) {
index 119e8274e517b5804b4ce9c1f0dea423bb1f6120..84ee45b85f3f3d03dd1a4d96b9f707a62a0e1562 100644 (file)
@@ -491,9 +491,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
        unsigned int i;
        const char *tmp_str;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        ret = SR_OK;
        devc = sdi->priv;
        if (!cg) {
index b3a91353131c31bb74c3b4ea93690c645b2ef202..df8d2a58d834e801a91e18a244ae099c4160b9ef 100644 (file)
@@ -263,9 +263,6 @@ static int config_set(uint32_t key, GVariant *data,
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        ret = SR_OK;
index 70b094a605e023b0fa71ef8ac063f9f881a1a992..159c8f6ac6457f83e5f144c60100e11adf0d80de 100644 (file)
@@ -434,9 +434,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
        if (cg) /* sr_config_set will validate cg using config_list */
                ch = ((struct sr_channel *)cg->channels->data)->index;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        ret = SR_OK;
        switch (key) {
        case SR_CONF_LIMIT_FRAMES:
index 6acf435237ad5b02a943527191244884db198114..66be858fac2376fbf093e90e58f1c45d66876012 100644 (file)
@@ -288,9 +288,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        switch (key) {
        case SR_CONF_LIMIT_SAMPLES:
                limit_samples = g_variant_get_uint64(data);
index 2105bce130ed937ef4a9da75070a0c2c7f3b750f..eb33a4508dbc8884ce159044535a15a747f7135e 100644 (file)
@@ -261,9 +261,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        switch (key) {
index e99e0b19d612133d9cd65a5226904a738cd0563d..07d71f48f06d7ce4b7d74ad9a960f5c6b05738e9 100644 (file)
@@ -261,9 +261,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
        ret = SR_OK;
        switch (key) {
index 0f7b8709016febe4df42797d9818a25dfb69e804..421ab7981cf06d903c6df3127d1298304856af76 100644 (file)
@@ -117,9 +117,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        return sr_sw_limits_config_set(&devc->limits, key, data);
index c9b677661311de01f25ebaa16f4ada4dae5f02ed..3ee69b724a9fbac783ad14e19130d56522f6559d 100644 (file)
@@ -220,9 +220,6 @@ static int config_set(uint32_t key, GVariant *data,
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        switch (key) {
index 4a58f2804370c9893e7b25a62954fa8b666a99c5..44d7643f08cd2aaf656227c5044dd57e8b1b83fc 100644 (file)
@@ -164,9 +164,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
        ret = SR_OK;
        switch (key) {
index ebb92e1eac18d15c0fd6f611d901446b5f4c067c..dfa13284273c8fcf6205b10327d797a11eace342 100644 (file)
@@ -390,9 +390,6 @@ static int config_set(uint32_t key, GVariant *data,
 
        devc = sdi->priv;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        switch (key) {
        case SR_CONF_SAMPLERATE:
                return lls_set_samplerate(sdi, g_variant_get_uint64(data));
index cf6514fb0ece71ccbb11f831e288b6c0aaa990f1..241d5e0a6d2f798c363a8995f02bc531e27836f1 100644 (file)
@@ -238,9 +238,6 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
 
        devc = sdi->priv;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        switch (key) {
        case SR_CONF_SAMPLERATE:
                // FIXME
index 1808e033bb6b4c2c584ea958129ee698ca77f283..7bae92917e79b3334db9fac302412453df36263c 100644 (file)
@@ -233,9 +233,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        switch (key) {
index 5c3a73c72b38b6ac476703dc90f3764a1d8aaeb3..aae0d094a4a23a15e123c4011b9f0bf381752b42 100644 (file)
@@ -332,9 +332,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        modbus = sdi->conn;
        devc = sdi->priv;
 
index 3a924072557f25c9dd1b4e8116ad65e6763188bd..492f4b7930395c86a4a121a1e878748df1077335 100644 (file)
@@ -134,9 +134,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        return sr_sw_limits_config_set(&devc->limits, key, data);
index d5b55a81b9b97f476481ab9fc541b585de31addd..5ec71e68dfc2910ddcfae67f9f64f188d88b4ca2 100644 (file)
@@ -576,9 +576,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
        int idx;
        gboolean found;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        /* Cannot change settings while acquisition active, would cause a mess with commands.
index 1d1247e309422b51e3ea92f5c05b21f4b3d12c30..c9399402fcc29300ba4a5b475e2a14327e5fa186 100644 (file)
@@ -168,9 +168,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        return sr_sw_limits_config_set(&devc->limits, key, data);
index 5cf87c2380392157befe9298ce9a96554e47ab25..93fa3bd7e57618209b19655f65aed554df708c29 100644 (file)
@@ -237,9 +237,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        switch (key) {
index e6c6fda04bf004531c26529022127295b786e23f..5dd4d7b837ace809c5e9ba43bae9ae01b1b80ec8 100644 (file)
@@ -180,9 +180,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        ret = SR_OK;
index 33d965e58c9abf36d3e589994f43cc2201f35f24..21b7185fb6bfa0eb1ace1d380b84da58829cbf93 100644 (file)
@@ -257,9 +257,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        switch (key) {
index a2e32297ca25450ea2fb493278c1a5590a9871a9..40d87bda0f63c26892de3f1a77d9997eea9392bc 100644 (file)
@@ -670,9 +670,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        devc = sdi->priv;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        /* If a channel group is specified, it must be a valid one. */
        if (cg && !g_slist_find(sdi->channel_groups, cg)) {
                sr_err("Invalid channel group specified.");
index 68c57ea9077c88e77d9c0526c1c6aca67ade97a0..95a6d01d6e6999ee2bd5ccd1fc7376f31de5c85e 100644 (file)
@@ -215,9 +215,6 @@ static int config_set(uint32_t key, GVariant *data,
        if (!sdi)
                return SR_ERR_ARG;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        switch (key) {
        case SR_CONF_OUTPUT_FREQUENCY:
                value_f = g_variant_get_double(data);
index f448533ef9be8b6a2c7242f44c477eda2ff66006..a456d0b652fb20a0de97da9d1c2dca3c22286720 100644 (file)
@@ -259,8 +259,6 @@ static int config_set(uint32_t key, GVariant *data,
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
        devc = sdi->priv;
 
        ret = SR_OK;
index 6538b75fe04806d535ddfa0c5a134950b5707d67..a8d32cf896086403a9661e90a0076cb952c90301 100644 (file)
@@ -460,9 +460,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        ret = SR_OK;
index bdf4bffe55233c0fe0e582517e43c3ad54d7170c..0136ca90b58e5c47ee183dfd41f4bf3c6620e180 100644 (file)
@@ -450,9 +450,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
        if (!sdi)
                return SR_ERR_ARG;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        if (cg)
                /* Channel group specified. */
                select_channel(sdi, cg->channels->data);
index a11a9b365d51bc5a230754f99559d29b1ad45261..ad063679fb61fd08522b2a1e90b4a1046c31bc13 100644 (file)
@@ -144,9 +144,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        return sr_sw_limits_config_set(&devc->limits, key, data);
index 41537f1bb53f0852cf4bb50fdea560cf9c783d3d..5e786295be2602cab7d4a1b19d2cc274dac92e7c 100644 (file)
@@ -128,9 +128,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        return sr_sw_limits_config_set(&devc->sw_limits, key, data);
index 0ebab5d7dd8be85eafda66672383402740cb0470..bc21f0f97d1f105bfc9065acc790cfd50657e81d 100644 (file)
@@ -218,9 +218,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        return sr_sw_limits_config_set(&devc->sw_limits, key, data);
 }
 
index 804b57b31f64306ba907a71d7d80edcef9f191de..bdad1f604fbca5978ad8a900e0ce4c39bf140db3 100644 (file)
@@ -98,9 +98,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        return sr_sw_limits_config_set(&devc->limits, key, data);
index a4d906d0e41945217235e15c69aa7348e61f804c..b340e40fcf860597df1c5400993d9e4493a2f7bb 100644 (file)
@@ -182,9 +182,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        switch (key) {
index 58a11f84cda4e109df946aaa60822cd5280817a5..0b96a5d298d644507f85962577f2eabec956e5e7 100644 (file)
@@ -177,9 +177,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        return sr_sw_limits_config_set(&devc->limits, key, data);
index c36e06aea727cdd7daacb2a5460bd845f1269b7e..0e31ddf7dcea07898ae6a304f88051cb8a2f7bbf 100644 (file)
@@ -376,9 +376,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        switch (key) {
index b16dcd34f6f28af0ed8317397f483a74d84eacdb..dfa09961efdf49cde4576ba6995bd4468da7eb92 100644 (file)
@@ -805,7 +805,11 @@ SR_API int sr_config_set(const struct sr_dev_inst *sdi,
                ret = SR_ERR;
        else if (!sdi->driver->config_set)
                ret = SR_ERR_ARG;
-       else if (check_key(sdi->driver, sdi, cg, key, SR_CONF_SET, data) != SR_OK)
+       else if (sdi->status != SR_ST_ACTIVE) {
+               sr_err("%s: Device instance not active, can't set config.",
+                       sdi->driver->name);
+               ret = SR_ERR_DEV_CLOSED;
+       } else if (check_key(sdi->driver, sdi, cg, key, SR_CONF_SET, data) != SR_OK)
                return SR_ERR_ARG;
        else if ((ret = sr_variant_type_check(key, data)) == SR_OK) {
                log_key(sdi, cg, key, SR_CONF_SET, data);