]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/scpi-pps/api.c
sr_dev_close(): Factor out SR_ERR_DEV_CLOSED check.
[libsigrok.git] / src / hardware / scpi-pps / api.c
index 5bce3af0d3f092bb35b861c06c5b1f60b9d5d6c4..2746dc4019dc01b5c1f9a56446b536a882a724b8 100644 (file)
@@ -43,9 +43,8 @@ static const struct pps_channel_instance pci[] = {
 };
 
 static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi,
-                                       int (*get_hw_id)(struct sr_scpi_dev_inst *scpi,
-                                                       struct sr_scpi_hw_info **scpi_response)
-                          )
+               int (*get_hw_id)(struct sr_scpi_dev_inst *scpi,
+               struct sr_scpi_hw_info **scpi_response))
 {
        struct dev_context *devc;
        struct sr_dev_inst *sdi;
@@ -281,9 +280,6 @@ static int dev_close(struct sr_dev_inst *sdi)
        struct sr_scpi_dev_inst *scpi;
        struct dev_context *devc;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
        scpi = sdi->conn;
        if (scpi) {
@@ -451,9 +447,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);
@@ -643,9 +636,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct pps_channel *pch;
        int cmd, ret;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
        scpi = sdi->conn;
 
@@ -679,9 +669,6 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
        struct sr_scpi_dev_inst *scpi;
        float f;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        scpi = sdi->conn;
 
        /*