From: Lars-Peter Clausen Date: Fri, 29 Apr 2016 12:26:00 +0000 (+0200) Subject: Remove unnecessary dev_clear() callbacks X-Git-Tag: libsigrok-0.5.0~465 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=88a0265ebcb265ba839c02cc5bcd39e359c9f60f;p=libsigrok.git 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 --- diff --git a/src/hardware/arachnid-labs-re-load-pro/api.c b/src/hardware/arachnid-labs-re-load-pro/api.c index 960c2243..323f7cf5 100644 --- a/src/hardware/arachnid-labs-re-load-pro/api.c +++ b/src/hardware/arachnid-labs-re-load-pro/api.c @@ -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, diff --git a/src/hardware/baylibre-acme/api.c b/src/hardware/baylibre-acme/api.c index 23c75d84..cdf9968b 100644 --- a/src/hardware/baylibre-acme/api.c +++ b/src/hardware/baylibre-acme/api.c @@ -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, diff --git a/src/hardware/beaglelogic/api.c b/src/hardware/beaglelogic/api.c index 2285c193..cba429ca 100644 --- a/src/hardware/beaglelogic/api.c +++ b/src/hardware/beaglelogic/api.c @@ -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, diff --git a/src/hardware/center-3xx/api.c b/src/hardware/center-3xx/api.c index 0e63122a..7f08d9da 100644 --- a/src/hardware/center-3xx/api.c +++ b/src/hardware/center-3xx/api.c @@ -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, \ diff --git a/src/hardware/gwinstek-gds-800/api.c b/src/hardware/gwinstek-gds-800/api.c index 2b93f10f..c26ec261 100644 --- a/src/hardware/gwinstek-gds-800/api.c +++ b/src/hardware/gwinstek-gds-800/api.c @@ -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, diff --git a/src/hardware/hp-3457a/api.c b/src/hardware/hp-3457a/api.c index 19188e39..1a5e5d92 100644 --- a/src/hardware/hp-3457a/api.c +++ b/src/hardware/hp-3457a/api.c @@ -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, diff --git a/src/hardware/kern-scale/api.c b/src/hardware/kern-scale/api.c index 3ab8857b..e16bf596 100644 --- a/src/hardware/kern-scale/api.c +++ b/src/hardware/kern-scale/api.c @@ -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, \ diff --git a/src/hardware/korad-kaxxxxp/api.c b/src/hardware/korad-kaxxxxp/api.c index f5c63f9f..26b1ee8e 100644 --- a/src/hardware/korad-kaxxxxp/api.c +++ b/src/hardware/korad-kaxxxxp/api.c @@ -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, diff --git a/src/hardware/lecroy-logicstudio/api.c b/src/hardware/lecroy-logicstudio/api.c index 06f9b503..458be366 100644 --- a/src/hardware/lecroy-logicstudio/api.c +++ b/src/hardware/lecroy-logicstudio/api.c @@ -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, diff --git a/src/hardware/manson-hcs-3xxx/api.c b/src/hardware/manson-hcs-3xxx/api.c index 72091de4..d3901954 100644 --- a/src/hardware/manson-hcs-3xxx/api.c +++ b/src/hardware/manson-hcs-3xxx/api.c @@ -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, diff --git a/src/hardware/maynuo-m97/api.c b/src/hardware/maynuo-m97/api.c index d2212ca6..5716d3bd 100644 --- a/src/hardware/maynuo-m97/api.c +++ b/src/hardware/maynuo-m97/api.c @@ -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, diff --git a/src/hardware/mic-985xx/api.c b/src/hardware/mic-985xx/api.c index 07d2a8e1..2bf20627 100644 --- a/src/hardware/mic-985xx/api.c +++ b/src/hardware/mic-985xx/api.c @@ -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, \ diff --git a/src/hardware/serial-dmm/api.c b/src/hardware/serial-dmm/api.c index 6b32f648..f29a0e0b 100644 --- a/src/hardware/serial-dmm/api.c +++ b/src/hardware/serial-dmm/api.c @@ -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, \ diff --git a/src/hardware/testo/api.c b/src/hardware/testo/api.c index fb3f8b64..6e3511c0 100644 --- a/src/hardware/testo/api.c +++ b/src/hardware/testo/api.c @@ -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, diff --git a/src/hardware/uni-t-dmm/api.c b/src/hardware/uni-t-dmm/api.c index 3eef3aa2..7e55d857 100644 --- a/src/hardware/uni-t-dmm/api.c +++ b/src/hardware/uni-t-dmm/api.c @@ -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, \