Remove unnecessary driver context checks
Some drivers check in some of their driver callbacks if the driver has been initialized and return an error if it has not. For the scan() callback the sigrok core checks if the driver has been initialized and if not returns an error. So it is not possible that the scan() callback gets called if the driver is not initialized. Without the scan() callback succeeding it is not possible to get a reference to a device which is associated with the driver, so it is not possible that any of the device specific callbacks is called without the driver first being initialized either. In conclusion these checks are not necessary since they never evaluate to true and can be dropped. If they should ever become necessary they should be done in the sigrok core so all drivers and all callbacks are equally handled. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
e91bb0a6c4
commit
efa9840222
|
@ -183,17 +183,12 @@ static int dev_clear(const struct sr_dev_driver *di)
|
||||||
static int dev_open(struct sr_dev_inst *sdi)
|
static int dev_open(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
struct sr_dev_driver *di = sdi->driver;
|
struct sr_dev_driver *di = sdi->driver;
|
||||||
struct drv_context *drvc;
|
struct drv_context *drvc = di->context;
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_usb_dev_inst *usb;
|
struct sr_usb_dev_inst *usb;
|
||||||
uint8_t buffer[PACKET_LENGTH];
|
uint8_t buffer[PACKET_LENGTH];
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!(drvc = di->context)) {
|
|
||||||
sr_err("Driver was not initialized.");
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
|
@ -254,14 +249,8 @@ static int dev_open(struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
static int dev_close(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;
|
struct sr_usb_dev_inst *usb;
|
||||||
|
|
||||||
if (!di->context) {
|
|
||||||
sr_err("Driver was not initialized.");
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
|
|
||||||
if (!usb->devhdl)
|
if (!usb->devhdl)
|
||||||
|
|
|
@ -163,15 +163,10 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
static int dev_open(struct sr_dev_inst *sdi)
|
static int dev_open(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
struct sr_dev_driver *di = sdi->driver;
|
struct sr_dev_driver *di = sdi->driver;
|
||||||
struct drv_context *drvc;
|
struct drv_context *drvc = di->context;
|
||||||
struct sr_usb_dev_inst *usb;
|
struct sr_usb_dev_inst *usb;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!(drvc = di->context)) {
|
|
||||||
sr_err("Driver was not initialized.");
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
|
|
||||||
if (sr_usb_open(drvc->sr_ctx->libusb_ctx, usb) != SR_OK)
|
if (sr_usb_open(drvc->sr_ctx->libusb_ctx, usb) != SR_OK)
|
||||||
|
@ -193,15 +188,9 @@ static int dev_open(struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
static int dev_close(struct sr_dev_inst *sdi)
|
static int dev_close(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
struct sr_dev_driver *di = sdi->driver;
|
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_usb_dev_inst *usb;
|
struct sr_usb_dev_inst *usb;
|
||||||
|
|
||||||
if (!di->context) {
|
|
||||||
sr_err("Driver was not initialized.");
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
|
|
||||||
if (!usb->devhdl)
|
if (!usb->devhdl)
|
||||||
|
@ -274,7 +263,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,
|
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_channel_group *cg)
|
const struct sr_channel_group *cg)
|
||||||
{
|
{
|
||||||
struct sr_dev_driver *di = sdi->driver;
|
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
uint64_t p, q;
|
uint64_t p, q;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -286,11 +274,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
|
||||||
if (!di->context) {
|
|
||||||
sr_err("Driver was not initialized.");
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
ret = SR_OK;
|
ret = SR_OK;
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
|
|
@ -92,15 +92,10 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
static int dev_open(struct sr_dev_inst *sdi)
|
static int dev_open(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
struct sr_dev_driver *di = sdi->driver;
|
struct sr_dev_driver *di = sdi->driver;
|
||||||
struct drv_context *drvc;
|
struct drv_context *drvc = di->context;;
|
||||||
struct sr_usb_dev_inst *usb;
|
struct sr_usb_dev_inst *usb;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!(drvc = di->context)) {
|
|
||||||
sr_err("Driver was not initialized.");
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
|
|
||||||
if (sr_usb_open(drvc->sr_ctx->libusb_ctx, usb) != SR_OK)
|
if (sr_usb_open(drvc->sr_ctx->libusb_ctx, usb) != SR_OK)
|
||||||
|
@ -117,14 +112,8 @@ static int dev_open(struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
static int dev_close(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;
|
struct sr_usb_dev_inst *usb;
|
||||||
|
|
||||||
if (!di->context) {
|
|
||||||
sr_err("Driver was not initialized.");
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
|
|
||||||
if (!usb->devhdl)
|
if (!usb->devhdl)
|
||||||
|
@ -178,7 +167,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,
|
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_channel_group *cg)
|
const struct sr_channel_group *cg)
|
||||||
{
|
{
|
||||||
struct sr_dev_driver *di = sdi->driver;
|
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -187,11 +175,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
|
||||||
if (!di->context) {
|
|
||||||
sr_err("Driver was not initialized.");
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
ret = SR_OK;
|
ret = SR_OK;
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
@ -321,11 +304,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
|
||||||
if (!di->context) {
|
|
||||||
sr_err("Driver was not initialized.");
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
drvc = di->context;
|
drvc = di->context;
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
|
@ -427,13 +405,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
SR_PRIV int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
SR_PRIV int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
struct sr_dev_driver *di = sdi->driver;
|
|
||||||
|
|
||||||
if (!di->context) {
|
|
||||||
sr_err("Driver was not initialized.");
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE) {
|
if (sdi->status != SR_ST_ACTIVE) {
|
||||||
sr_err("Device inactive, can't stop acquisition.");
|
sr_err("Device inactive, can't stop acquisition.");
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
|
|
@ -263,19 +263,12 @@ static int open_device(struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
static int dev_open(struct sr_dev_inst *sdi)
|
static int dev_open(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
struct drv_context *drvc;
|
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
int64_t timediff_us, timediff_ms;
|
int64_t timediff_us, timediff_ms;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
drvc = sdi->driver->context;
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
if (!drvc) {
|
|
||||||
sr_err("Driver was not initialized.");
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we didn't need to upload FX2 firmware in scan(), open the device
|
* If we didn't need to upload FX2 firmware in scan(), open the device
|
||||||
* right away. Otherwise, wait up to MAX_RENUM_DELAY_MS ms for the
|
* right away. Otherwise, wait up to MAX_RENUM_DELAY_MS ms for the
|
||||||
|
|
|
@ -55,15 +55,12 @@ SR_PRIV struct sr_dev_driver link_mso19_driver_info;
|
||||||
/* TODO: Use sr_dev_inst to store connection handle & use std_dev_clear(). */
|
/* TODO: Use sr_dev_inst to store connection handle & use std_dev_clear(). */
|
||||||
static int dev_clear(const struct sr_dev_driver *di)
|
static int dev_clear(const struct sr_dev_driver *di)
|
||||||
{
|
{
|
||||||
|
struct drv_context *drvc = di->context;
|
||||||
GSList *l;
|
GSList *l;
|
||||||
struct sr_dev_inst *sdi;
|
struct sr_dev_inst *sdi;
|
||||||
struct drv_context *drvc;
|
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
int ret = SR_OK;
|
int ret = SR_OK;
|
||||||
|
|
||||||
if (!(drvc = di->context))
|
|
||||||
return SR_OK;
|
|
||||||
|
|
||||||
/* Properly close and free all devices. */
|
/* Properly close and free all devices. */
|
||||||
for (l = drvc->instances; l; l = l->next) {
|
for (l = drvc->instances; l; l = l->next) {
|
||||||
if (!(sdi = l->data)) {
|
if (!(sdi = l->data)) {
|
||||||
|
|
|
@ -282,10 +282,6 @@ static int dev_open(struct sr_dev_inst *sdi)
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
|
|
||||||
if (!drvc) {
|
|
||||||
sr_err("Driver was not initialized.");
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
if (sdi->status != SR_ST_INACTIVE) {
|
if (sdi->status != SR_ST_INACTIVE) {
|
||||||
sr_err("Device already open.");
|
sr_err("Device already open.");
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
@ -349,19 +345,13 @@ static int dev_open(struct sr_dev_inst *sdi)
|
||||||
*/
|
*/
|
||||||
static int dev_close(struct sr_dev_inst *sdi)
|
static int dev_close(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
struct drv_context *drvc;
|
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
struct sr_usb_dev_inst *usb;
|
struct sr_usb_dev_inst *usb;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
drvc = sdi->driver->context;
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
|
|
||||||
if (!drvc) {
|
|
||||||
sr_err("Driver was not initialized.");
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
if (sdi->status == SR_ST_INACTIVE) {
|
if (sdi->status == SR_ST_INACTIVE) {
|
||||||
sr_dbg("Device already closed.");
|
sr_dbg("Device already closed.");
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
|
|
|
@ -155,11 +155,6 @@ static int dev_open(struct sr_dev_inst *sdi)
|
||||||
int ret, i;
|
int ret, i;
|
||||||
char connection_id[64];
|
char connection_id[64];
|
||||||
|
|
||||||
if (!di->context) {
|
|
||||||
sr_err("Driver was not initialized.");
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist);
|
libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist);
|
||||||
for (i = 0; devlist[i]; i++) {
|
for (i = 0; devlist[i]; i++) {
|
||||||
|
@ -199,14 +194,8 @@ static int dev_open(struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
static int dev_close(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;
|
struct sr_usb_dev_inst *usb;
|
||||||
|
|
||||||
if (!di->context) {
|
|
||||||
sr_err("Driver was not initialized.");
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
if (!usb->devhdl)
|
if (!usb->devhdl)
|
||||||
/* Nothing to do. */
|
/* Nothing to do. */
|
||||||
|
@ -256,11 +245,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
|
||||||
if (!di->context) {
|
|
||||||
sr_err("Driver was not initialized.");
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
ret = SR_OK;
|
ret = SR_OK;
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
@ -434,10 +418,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
|
||||||
if (!di->context) {
|
|
||||||
sr_err("Driver was not initialized.");
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
|
@ -474,13 +454,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
struct sr_dev_driver *di = sdi->driver;
|
|
||||||
|
|
||||||
if (!di->context) {
|
|
||||||
sr_err("Driver was not initialized.");
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
|
||||||
|
|
|
@ -101,15 +101,10 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
||||||
static int dev_open(struct sr_dev_inst *sdi)
|
static int dev_open(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
struct sr_dev_driver *di = sdi->driver;
|
struct sr_dev_driver *di = sdi->driver;
|
||||||
struct drv_context *drvc;
|
struct drv_context *drvc = di->context;
|
||||||
struct sr_usb_dev_inst *usb;
|
struct sr_usb_dev_inst *usb;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!(drvc = di->context)) {
|
|
||||||
sr_err("Driver was not initialized.");
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
|
|
||||||
if (sr_usb_open(drvc->sr_ctx->libusb_ctx, usb) != SR_OK)
|
if (sr_usb_open(drvc->sr_ctx->libusb_ctx, usb) != SR_OK)
|
||||||
|
@ -145,14 +140,8 @@ static int dev_open(struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
static int dev_close(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;
|
struct sr_usb_dev_inst *usb;
|
||||||
|
|
||||||
if (!di->context) {
|
|
||||||
sr_err("Driver was not initialized.");
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
if (!usb->devhdl)
|
if (!usb->devhdl)
|
||||||
/* Nothing to do. */
|
/* Nothing to do. */
|
||||||
|
@ -194,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,
|
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_channel_group *cg)
|
const struct sr_channel_group *cg)
|
||||||
{
|
{
|
||||||
struct sr_dev_driver *di = sdi->driver;
|
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
const char *tmp_str;
|
const char *tmp_str;
|
||||||
|
|
||||||
|
@ -203,11 +191,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
|
||||||
if (!di->context) {
|
|
||||||
sr_err("Driver was not initialized.");
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
|
|
@ -110,11 +110,6 @@ static int dev_open(struct sr_dev_inst *sdi)
|
||||||
int ret, i;
|
int ret, i;
|
||||||
char connection_id[64];
|
char connection_id[64];
|
||||||
|
|
||||||
if (!di->context) {
|
|
||||||
sr_err("Driver was not initialized.");
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
|
|
||||||
libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist);
|
libusb_get_device_list(drvc->sr_ctx->libusb_ctx, &devlist);
|
||||||
|
@ -156,14 +151,8 @@ static int dev_open(struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
static int dev_close(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;
|
struct sr_usb_dev_inst *usb;
|
||||||
|
|
||||||
if (!di->context) {
|
|
||||||
sr_err("Driver was not initialized.");
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
|
|
||||||
if (!usb->devhdl)
|
if (!usb->devhdl)
|
||||||
|
@ -204,7 +193,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,
|
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
|
||||||
const struct sr_channel_group *cg)
|
const struct sr_channel_group *cg)
|
||||||
{
|
{
|
||||||
struct sr_dev_driver *di = sdi->driver;
|
|
||||||
struct dev_context *devc;
|
struct dev_context *devc;
|
||||||
gint64 now;
|
gint64 now;
|
||||||
|
|
||||||
|
@ -213,11 +201,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
|
||||||
if (!di->context) {
|
|
||||||
sr_err("Driver was not initialized.");
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
devc = sdi->priv;
|
devc = sdi->priv;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
@ -351,11 +334,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
if (sdi->status != SR_ST_ACTIVE)
|
if (sdi->status != SR_ST_ACTIVE)
|
||||||
return SR_ERR_DEV_CLOSED;
|
return SR_ERR_DEV_CLOSED;
|
||||||
|
|
||||||
if (!di->context) {
|
|
||||||
sr_err("Driver was not initialized.");
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
usb = sdi->conn;
|
usb = sdi->conn;
|
||||||
|
|
||||||
std_session_send_df_header(sdi, LOG_PREFIX);
|
std_session_send_df_header(sdi, LOG_PREFIX);
|
||||||
|
@ -384,13 +362,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
||||||
|
|
||||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
|
||||||
{
|
{
|
||||||
struct sr_dev_driver *di = sdi->driver;
|
|
||||||
|
|
||||||
if (!di->context) {
|
|
||||||
sr_err("Driver was not initialized.");
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sdi->status != SR_ST_ACTIVE) {
|
if (sdi->status != SR_ST_ACTIVE) {
|
||||||
sr_err("Device not active, can't stop acquisition.");
|
sr_err("Device not active, can't stop acquisition.");
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
|
Loading…
Reference in New Issue