]> sigrok.org Git - libsigrok.git/commitdiff
Remove unnecessary dev_clear() callbacks
authorLars-Peter Clausen <redacted>
Fri, 29 Apr 2016 12:26:00 +0000 (14:26 +0200)
committerLars-Peter Clausen <redacted>
Tue, 3 May 2016 19:24:55 +0000 (21:24 +0200)
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 <redacted>
15 files changed:
src/hardware/arachnid-labs-re-load-pro/api.c
src/hardware/baylibre-acme/api.c
src/hardware/beaglelogic/api.c
src/hardware/center-3xx/api.c
src/hardware/gwinstek-gds-800/api.c
src/hardware/hp-3457a/api.c
src/hardware/kern-scale/api.c
src/hardware/korad-kaxxxxp/api.c
src/hardware/lecroy-logicstudio/api.c
src/hardware/manson-hcs-3xxx/api.c
src/hardware/maynuo-m97/api.c
src/hardware/mic-985xx/api.c
src/hardware/serial-dmm/api.c
src/hardware/testo/api.c
src/hardware/uni-t-dmm/api.c

index 960c22435872810d1f05edda5c21eb5ec4ef7d3d..323f7cf5bed65683d630b5fc073ac73e8503b8b9 100644 (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,
index 23c75d84877979b173d06e7fb3350412e54dee98..cdf9968b20b94ad33217ebfa1c6f8ff93849d8be 100644 (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,
index 2285c193b266a098cad64e0073be38df66cdff70..cba429cacdd4966a928a07818632130ac2448143 100644 (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,
index 0e63122a74900fb89e7f2bef9824f02d37c7507e..7f08d9dad70832af465e9833bf60c87b31ee86ba 100644 (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, \
index 2b93f10fd5d0aface3f679981e7807b45b18c597..c26ec2617142e5d19c9575b62e128bf6ccd3d467 100644 (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,
index 19188e39d9b1e3fd6b4ec2785df257ac7c41c361..1a5e5d920a8f9f0f03191ba3f4de204582681c73 100644 (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,
index 3ab8857b2c5122e2d8e8371af8818354abb3dbea..e16bf596e30d8df2dfa8df3064da995dae8264d3 100644 (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, \
index f5c63f9fcf7687db323b1382566dfaf7bbf11138..26b1ee8ef8aefc6b55cd3823132bea45756eab5b 100644 (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,
index 06f9b503d3d9004186b5e638bd576c767cbb35c3..458be366f24f02122119ca8b9c768363cd11fc6a 100644 (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,
index 72091de41d271bef5a86fdfdff71d08328241a39..d3901954288801c49370695d767985234fa10065 100644 (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,
index d2212ca650b6701f07e9819893d18fad39e583e3..5716d3bd484f7c8ec6d84426689017a2c0123181 100644 (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,
index 07d2a8e197755b56b6c416a34062bf898e0c3f99..2bf20627a02d1381cb7bc3c3a9e045d489bad6d0 100644 (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, \
index 6b32f6485ec60b43bcf90e98db69f2f140e402e8..f29a0e0b2015c89b0a17e5b72be5f0f91d45597b 100644 (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, \
index fb3f8b64ce6c56312d327d73337f4bf92d74ee11..6e3511c013eb4bd76ec169e792a800a53547a834 100644 (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,
index 3eef3aa29494cfc8a2ad765f180da09fc45e6ba6..7e55d857f253c0c6e8731eb323cb8e0330ef3a1b 100644 (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, \