sr_err("No dev_list in driver %d ('%s').", i, d);
errors++;
}
- /* Note: dev_clear() is optional. */
+ if (!drivers[i]->dev_clear) {
+ sr_err("No dev_clear in driver %d ('%s').", i, d);
+ errors++;
+ }
/* Note: config_get() is optional. */
if (!drivers[i]->config_set) {
sr_err("No config_set in driver %d ('%s').", i, d);
*/
SR_API int sr_dev_clear(const struct sr_dev_driver *driver)
{
- int ret;
-
if (!driver) {
sr_err("Invalid driver.");
return SR_ERR_ARG;
/* No log message here, too verbose and not very useful. */
- if (driver->dev_clear)
- ret = driver->dev_clear(driver);
- else
- ret = std_dev_clear_with_callback(driver, NULL);
-
- return ret;
+ return driver->dev_clear(driver);
}
/**
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
- .dev_clear = NULL,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
- .dev_clear = NULL,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup,
.scan = scan_3203,
.dev_list = std_dev_list,
- .dev_clear = NULL,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
- .dev_clear = NULL,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
- .dev_clear = NULL,
+ .dev_clear = std_dev_clear,
.config_get = NULL,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
- .dev_clear = NULL,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup, \
.scan = scan_##ID_UPPER, \
.dev_list = std_dev_list, \
+ .dev_clear = std_dev_clear, \
.config_get = NULL, \
.config_set = config_set, \
.config_list = config_list, \
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
- .dev_clear = NULL,
+ .dev_clear = std_dev_clear,
.config_get = NULL,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
- .dev_clear = NULL,
+ .dev_clear = std_dev_clear,
.config_get = NULL,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
- .dev_clear = NULL,
+ .dev_clear = std_dev_clear,
.config_get = NULL,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup,
.scan = scan_1x_2x_rs232,
.dev_list = std_dev_list,
- .dev_clear = NULL,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list_sm,
.cleanup = std_cleanup,
.scan = scan_2x_bd232,
.dev_list = std_dev_list,
- .dev_clear = NULL,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list_bd,
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
- .dev_clear = NULL,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup, \
.scan = scan, \
.dev_list = std_dev_list, \
+ .dev_clear = std_dev_clear, \
.config_get = NULL, \
.config_set = config_set, \
.config_list = config_list, \
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
- .dev_clear = NULL,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup, \
.scan = scan_##ID_UPPER, \
.dev_list = std_dev_list, \
+ .dev_clear = std_dev_clear, \
.config_get = NULL, \
.config_set = config_set, \
.config_list = config_list_##ID_UPPER, \
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
- .dev_clear = NULL,
+ .dev_clear = std_dev_clear,
.config_get = NULL,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
- .dev_clear = NULL,
+ .dev_clear = std_dev_clear,
.config_get = NULL,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
- .dev_clear = NULL,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
return std_scan_complete(di, g_slist_append(NULL, sdi));
}
-static int dev_clear(const struct sr_dev_driver *di)
-{
- return std_dev_clear_with_callback(di, NULL);
-}
-
static int config_get(uint32_t key, GVariant **data,
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
{
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
- .dev_clear = dev_clear,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
return sr_scpi_scan(di->context, options, rs_probe_serial_device);
}
-static int dev_clear(const struct sr_dev_driver *di)
-{
- return std_dev_clear_with_callback(di, NULL);
-}
-
static int dev_open(struct sr_dev_inst *sdi)
{
return sr_scpi_open(sdi->conn);
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
- .dev_clear = dev_clear,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
return std_scan_complete(di, devices);
}
-static int dev_clear(const struct sr_dev_driver *di)
-{
- return std_dev_clear_with_callback(di, NULL);
-}
-
static int dev_open(struct sr_dev_inst *sdi)
{
struct sr_dev_driver *di = sdi->driver;
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
- .dev_clear = dev_clear,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
- .dev_clear = NULL,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup, \
.scan = scan, \
.dev_list = std_dev_list, \
+ .dev_clear = std_dev_clear, \
.config_get = NULL, \
.config_set = config_set, \
.config_list = config_list, \
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
- .dev_clear = NULL,
+ .dev_clear = std_dev_clear,
.config_get = NULL,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
- .dev_clear = NULL,
+ .dev_clear = std_dev_clear,
.config_get = NULL,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup, \
.scan = scan, \
.dev_list = std_dev_list, \
+ .dev_clear = std_dev_clear, \
.config_get = NULL, \
.config_set = config_set, \
.config_list = config_list, \
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
- .dev_clear = NULL,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
- .dev_clear = NULL,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
.cleanup = std_cleanup,
.scan = scan,
.dev_list = std_dev_list,
- .dev_clear = NULL,
+ .dev_clear = std_dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
SR_PRIV int std_session_send_df_end(const struct sr_dev_inst *sdi);
SR_PRIV int std_dev_clear_with_callback(const struct sr_dev_driver *driver,
std_dev_clear_callback clear_private);
+SR_PRIV int std_dev_clear(const struct sr_dev_driver *driver);
SR_PRIV GSList *std_dev_list(const struct sr_dev_driver *di);
SR_PRIV int std_serial_dev_close(struct sr_dev_inst *sdi);
SR_PRIV GSList *std_scan_complete(struct sr_dev_driver *di, GSList *devices);
return ret;
}
+SR_PRIV int std_dev_clear(const struct sr_dev_driver *driver)
+{
+ return std_dev_clear_with_callback(driver, NULL);
+}
+
/**
* Standard driver dev_list() callback API helper.
*