Remove unnecessary dev_clear() callbacks

If a driver does not implement a dev_clear() callback the core will
automatically call std_dev_clear(di, NULL). Remove all driver dev_clear()
implementations that are identical to default. This reduces the amount of
boiler-plate code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2016-04-29 14:26:00 +02:00
parent 700d6b64d5
commit 88a0265ebc
15 changed files with 0 additions and 98 deletions

View File

@ -169,11 +169,6 @@ static GSList *dev_list(const struct sr_dev_driver *di)
return ((struct drv_context *)(di->context))->instances;
}
static int dev_clear(const struct sr_dev_driver *di)
{
return std_dev_clear(di, NULL);
}
static int config_list(uint32_t key, GVariant **data,
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
{
@ -383,7 +378,6 @@ SR_PRIV struct sr_dev_driver arachnid_labs_re_load_pro_driver_info = {
.cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,

View File

@ -147,11 +147,6 @@ static GSList *dev_list(const struct sr_dev_driver *di)
return ((struct drv_context *)(di->context))->instances;
}
static int dev_clear(const struct sr_dev_driver *di)
{
return std_dev_clear(di, NULL);
}
static int dev_open(struct sr_dev_inst *sdi)
{
(void)sdi;
@ -418,7 +413,6 @@ SR_PRIV struct sr_dev_driver baylibre_acme_driver_info = {
.cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,

View File

@ -150,11 +150,6 @@ static GSList *dev_list(const struct sr_dev_driver *di)
return ((struct drv_context *)(di->context))->instances;
}
static int dev_clear(const struct sr_dev_driver *di)
{
return std_dev_clear(di, NULL);
}
static int dev_open(struct sr_dev_inst *sdi)
{
struct dev_context *devc = sdi->priv;
@ -381,7 +376,6 @@ SR_PRIV struct sr_dev_driver beaglelogic_driver_info = {
.cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,

View File

@ -56,11 +56,6 @@ SR_PRIV const struct center_dev_info center_devs[] = {
},
};
static int dev_clear(int idx)
{
return std_dev_clear(center_devs[idx].di, NULL);
}
static int init(struct sr_context *sr_ctx, int idx)
{
return std_init(sr_ctx, center_devs[idx].di, LOG_PREFIX);
@ -237,9 +232,6 @@ static GSList *scan_##X(struct sr_dev_driver *d, GSList *options) { \
#define HW_DEV_LIST(X) \
static GSList *dev_list_##X(const struct sr_dev_driver *d) { \
(void)d; return dev_list(X); }
#define HW_DEV_CLEAR(X) \
static int dev_clear_##X(const struct sr_dev_driver *d) { \
(void)d; return dev_clear(X); }
#define HW_DEV_ACQUISITION_START(X) \
static int dev_acquisition_start_##X(const struct sr_dev_inst *sdi \
) { return dev_acquisition_start(sdi, X); }
@ -249,7 +241,6 @@ static int dev_acquisition_start_##X(const struct sr_dev_inst *sdi \
HW_INIT(ID_UPPER) \
HW_SCAN(ID_UPPER) \
HW_DEV_LIST(ID_UPPER) \
HW_DEV_CLEAR(ID_UPPER) \
HW_DEV_ACQUISITION_START(ID_UPPER) \
SR_PRIV struct sr_dev_driver ID##_driver_info = { \
.name = NAME, \
@ -259,7 +250,6 @@ SR_PRIV struct sr_dev_driver ID##_driver_info = { \
.cleanup = std_cleanup, \
.scan = scan_##ID_UPPER, \
.dev_list = dev_list_##ID_UPPER, \
.dev_clear = dev_clear_##ID_UPPER, \
.config_get = NULL, \
.config_set = config_set, \
.config_list = config_list, \

View File

@ -98,11 +98,6 @@ static GSList *dev_list(const struct sr_dev_driver *di)
return ((struct drv_context *)(di->context))->instances;
}
static int dev_clear(const struct sr_dev_driver *di)
{
return std_dev_clear(di, NULL);
}
static int dev_open(struct sr_dev_inst *sdi)
{
int ret;
@ -258,7 +253,6 @@ SR_PRIV struct sr_dev_driver gwinstek_gds_800_driver_info = {
.cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,

View File

@ -181,11 +181,6 @@ static GSList *dev_list(const struct sr_dev_driver *di)
return ((struct drv_context *)(di->context))->instances;
}
static int dev_clear(const struct sr_dev_driver *di)
{
return std_dev_clear(di, NULL);
}
/*
* We need to set the HP 3457A to a known state, and there are quite a number
* of knobs to tweak. Here's a brief explanation of what's going on. For more
@ -460,7 +455,6 @@ SR_PRIV struct sr_dev_driver hp_3457a_driver_info = {
.cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,

View File

@ -36,11 +36,6 @@ static const uint32_t devopts[] = {
SR_CONF_LIMIT_MSEC | SR_CONF_SET,
};
static int dev_clear(const struct sr_dev_driver *di)
{
return std_dev_clear(di, NULL);
}
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
@ -223,7 +218,6 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
.cleanup = std_cleanup, \
.scan = scan, \
.dev_list = dev_list, \
.dev_clear = dev_clear, \
.config_get = NULL, \
.config_set = config_set, \
.config_list = config_list, \

View File

@ -183,11 +183,6 @@ static GSList *dev_list(const struct sr_dev_driver *di)
return ((struct drv_context *)(di->context))->instances;
}
static int dev_clear(const struct sr_dev_driver *di)
{
return std_dev_clear(di, NULL);
}
static int config_get(uint32_t key, GVariant **data,
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
{
@ -416,7 +411,6 @@ SR_PRIV struct sr_dev_driver korad_kaxxxxp_driver_info = {
.cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,

View File

@ -196,11 +196,6 @@ static GSList *dev_list(const struct sr_dev_driver *di)
return ((struct drv_context *)(di->context))->instances;
}
static int dev_clear(const struct sr_dev_driver *di)
{
return std_dev_clear(di, NULL);
}
static int open_device(struct sr_dev_inst *sdi)
{
struct drv_context *drvc;
@ -530,7 +525,6 @@ SR_PRIV struct sr_dev_driver lecroy_logicstudio_driver_info = {
.cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,

View File

@ -75,11 +75,6 @@ static const struct hcs_model models[] = {
SR_PRIV struct sr_dev_driver manson_hcs_3xxx_driver_info;
static int dev_clear(const struct sr_dev_driver *di)
{
return std_dev_clear(di, NULL);
}
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
@ -421,7 +416,6 @@ SR_PRIV struct sr_dev_driver manson_hcs_3xxx_driver_info = {
.cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,

View File

@ -204,11 +204,6 @@ static GSList *dev_list(const struct sr_dev_driver *di)
return ((struct drv_context *)(di->context))->instances;
}
static int dev_clear(const struct sr_dev_driver *di)
{
return std_dev_clear(di, g_free);
}
static int dev_open(struct sr_dev_inst *sdi)
{
struct sr_modbus_dev_inst *modbus = sdi->conn;
@ -494,7 +489,6 @@ SR_PRIV struct sr_dev_driver maynuo_m97_driver_info = {
.cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,

View File

@ -57,11 +57,6 @@ SR_PRIV const struct mic_dev_info mic_devs[] = {
},
};
static int dev_clear(int idx)
{
return std_dev_clear(mic_devs[idx].di, NULL);
}
static int init(struct sr_context *sr_ctx, int idx)
{
return std_init(sr_ctx, mic_devs[idx].di, LOG_PREFIX);
@ -245,9 +240,6 @@ static GSList *scan_##X(struct sr_dev_driver *di, GSList *options) { \
#define HW_DEV_LIST(X) \
static GSList *dev_list_##X(const struct sr_dev_driver *di) { \
(void)di; return dev_list(X); }
#define HW_DEV_CLEAR(X) \
static int dev_clear_##X(const struct sr_dev_driver *di) { \
(void)di; return dev_clear(X); }
#define HW_CONFIG_LIST(X) \
static int config_list_##X(uint32_t key, GVariant **data, \
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { \
@ -261,7 +253,6 @@ static int dev_acquisition_start_##X(const struct sr_dev_inst *sdi \
HW_INIT(ID_UPPER) \
HW_SCAN(ID_UPPER) \
HW_DEV_LIST(ID_UPPER) \
HW_DEV_CLEAR(ID_UPPER) \
HW_CONFIG_LIST(ID_UPPER) \
HW_DEV_ACQUISITION_START(ID_UPPER) \
SR_PRIV struct sr_dev_driver ID##_driver_info = { \
@ -272,7 +263,6 @@ SR_PRIV struct sr_dev_driver ID##_driver_info = { \
.cleanup = std_cleanup, \
.scan = scan_##ID_UPPER, \
.dev_list = dev_list_##ID_UPPER, \
.dev_clear = dev_clear_##ID_UPPER, \
.config_get = NULL, \
.config_set = config_set, \
.config_list = config_list_##ID_UPPER, \

View File

@ -41,11 +41,6 @@ static const uint32_t devopts[] = {
SR_CONF_LIMIT_MSEC | SR_CONF_SET,
};
static int dev_clear(const struct sr_dev_driver *di)
{
return std_dev_clear(di, NULL);
}
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
@ -251,7 +246,6 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
.cleanup = std_cleanup, \
.scan = scan, \
.dev_list = dev_list, \
.dev_clear = dev_clear, \
.config_get = NULL, \
.config_set = config_set, \
.config_list = config_list, \

View File

@ -151,11 +151,6 @@ static GSList *dev_list(const struct sr_dev_driver *di)
return ((struct drv_context *)(di->context))->instances;
}
static int dev_clear(const struct sr_dev_driver *di)
{
return std_dev_clear(di, NULL);
}
static int dev_open(struct sr_dev_inst *sdi)
{
struct sr_dev_driver *di = sdi->driver;
@ -507,7 +502,6 @@ SR_PRIV struct sr_dev_driver testo_driver_info = {
.cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,

View File

@ -46,11 +46,6 @@ static const uint32_t devopts[] = {
* default of 2400 being used (which will not work with this DMM, of course).
*/
static int dev_clear(const struct sr_dev_driver *di)
{
return std_dev_clear(di, NULL);
}
static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
{
return std_init(sr_ctx, di, LOG_PREFIX);
@ -219,7 +214,6 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
.cleanup = std_cleanup, \
.scan = scan, \
.dev_list = dev_list, \
.dev_clear = dev_clear, \
.config_get = NULL, \
.config_set = config_set, \
.config_list = config_list, \