]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/ikalogic-scanaplus/api.c
sr_dev_close(): Factor out SR_ERR_DEV_CLOSED check.
[libsigrok.git] / src / hardware / ikalogic-scanaplus / api.c
index 2105bce130ed937ef4a9da75070a0c2c7f3b750f..1bc17b73528c226979a9b0d353004fa2302dd0b1 100644 (file)
@@ -218,22 +218,13 @@ err_dev_open_close_ftdic:
 
 static int dev_close(struct sr_dev_inst *sdi)
 {
-       int ret;
        struct dev_context *devc;
 
-       ret = SR_OK;
        devc = sdi->priv;
 
-       if (sdi->status == SR_ST_ACTIVE) {
-               sr_dbg("Status ACTIVE, closing device.");
-               ret = scanaplus_close(devc);
-       } else {
-               sr_spew("Status not ACTIVE, nothing to do.");
-       }
-
        sdi->status = SR_ST_INACTIVE;
 
-       return ret;
+       return scanaplus_close(devc);
 }
 
 static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
@@ -261,9 +252,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) {