X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fipdbg-la%2Fapi.c;h=599960938c7b41fa998893379ceca14b137d8dc4;hb=4838c6ca5acbfa9cf6263d6b71846d83e5663833;hp=62d0616e35077fdc95a31aacedbca821d2c0235b;hpb=77b6b98d1c3790b8feb55105f243cec63418ab0f;p=libsigrok.git diff --git a/src/hardware/ipdbg-la/api.c b/src/hardware/ipdbg-la/api.c index 62d0616e..59996093 100644 --- a/src/hardware/ipdbg-la/api.c +++ b/src/hardware/ipdbg-la/api.c @@ -97,11 +97,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) return NULL; struct sr_dev_inst *sdi = g_malloc0(sizeof(struct sr_dev_inst)); - if (!sdi) { - sr_err("no possible to allocate sr_dev_inst"); - return NULL; - } - sdi->status = SR_ST_INACTIVE; sdi->vendor = g_strdup("ipdbg.org"); sdi->model = g_strdup("IPDBG LA"); @@ -158,8 +153,6 @@ static int dev_clear(const struct sr_dev_driver *di) static int dev_open(struct sr_dev_inst *sdi) { - sdi->status = SR_ST_INACTIVE; - struct ipdbg_la_tcp *tcp = sdi->conn; if (!tcp) @@ -168,21 +161,18 @@ static int dev_open(struct sr_dev_inst *sdi) if (ipdbg_la_tcp_open(tcp) != SR_OK) return SR_ERR; - sdi->status = SR_ST_ACTIVE; - return SR_OK; } static int dev_close(struct sr_dev_inst *sdi) { - // Should be called before a new call to scan() + /* Should be called before a new call to scan(). */ struct ipdbg_la_tcp *tcp = sdi->conn; if (tcp) ipdbg_la_tcp_close(tcp); sdi->conn = NULL; - sdi->status = SR_ST_INACTIVE; return SR_OK; } @@ -215,9 +205,6 @@ static int config_set(uint32_t key, GVariant *data, (void)cg; - if (sdi->status != SR_ST_ACTIVE) - return SR_ERR_DEV_CLOSED; - switch (key) { case SR_CONF_CAPTURE_RATIO: devc->capture_ratio = g_variant_get_uint64(data); @@ -261,9 +248,6 @@ static GSList *dev_list(const struct sr_dev_driver *di) static int dev_acquisition_start(const struct sr_dev_inst *sdi) { - if (sdi->status != SR_ST_ACTIVE) - return SR_ERR_DEV_CLOSED; - struct ipdbg_la_tcp *tcp = sdi->conn; struct dev_context *devc = sdi->priv;