X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Funi-t-ut32x%2Fapi.c;h=7ed3f88ce8fa1f38d8b159584d92224b02357298;hb=f4b4725bce213c58dd370a6c84ba4b327a89f7a4;hp=13c2a637303e9920a39c0cb40306fc47091f0fdc;hpb=700d6b64d578ce10e57f6a2289e37a5564eccf1c;p=libsigrok.git diff --git a/src/hardware/uni-t-ut32x/api.c b/src/hardware/uni-t-ut32x/api.c index 13c2a637..7ed3f88c 100644 --- a/src/hardware/uni-t-ut32x/api.c +++ b/src/hardware/uni-t-ut32x/api.c @@ -98,23 +98,13 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) return devices; } -static GSList *dev_list(const struct sr_dev_driver *di) -{ - return ((struct drv_context *)(di->context))->instances; -} - static int dev_open(struct sr_dev_inst *sdi) { struct sr_dev_driver *di = sdi->driver; - struct drv_context *drvc; + struct drv_context *drvc = di->context; struct sr_usb_dev_inst *usb; int ret; - if (!(drvc = di->context)) { - sr_err("Driver was not initialized."); - return SR_ERR; - } - usb = sdi->conn; if (sr_usb_open(drvc->sr_ctx->libusb_ctx, usb) != SR_OK) @@ -150,14 +140,8 @@ static int dev_open(struct sr_dev_inst *sdi) static int dev_close(struct sr_dev_inst *sdi) { - struct sr_dev_driver *di = sdi->driver; struct sr_usb_dev_inst *usb; - if (!di->context) { - sr_err("Driver was not initialized."); - return SR_ERR; - } - usb = sdi->conn; if (!usb->devhdl) /* Nothing to do. */ @@ -199,7 +183,6 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { - struct sr_dev_driver *di = sdi->driver; struct dev_context *devc; const char *tmp_str; @@ -208,11 +191,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; - if (!di->context) { - sr_err("Driver was not initialized."); - return SR_ERR; - } - devc = sdi->priv; switch (key) { @@ -336,7 +314,7 @@ SR_PRIV struct sr_dev_driver uni_t_ut32x_driver_info = { .init = init, .cleanup = std_cleanup, .scan = scan, - .dev_list = dev_list, + .dev_list = std_dev_list, .dev_clear = NULL, .config_get = config_get, .config_set = config_set,