From: Uwe Hermann Date: Tue, 11 Jul 2017 20:14:01 +0000 (+0200) Subject: std: Add and use std_dev_clear() where possible. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=f778bf02eaf0d7fa7ccb91a0da8a68233f1fb79a;p=libsigrok.git std: Add and use std_dev_clear() where possible. Be explicit and consistent in the drivers about which dev_clear function will be called to avoid confusion and inconsistencies. Drop some open-coded implementations of std_dev_clear(). --- diff --git a/src/backend.c b/src/backend.c index beb5a852..e5fe6a3f 100644 --- a/src/backend.c +++ b/src/backend.c @@ -309,7 +309,10 @@ static int sanity_check_all_drivers(const struct sr_context *ctx) 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); diff --git a/src/device.c b/src/device.c index 069ad153..ae8f3b8c 100644 --- a/src/device.c +++ b/src/device.c @@ -529,8 +529,6 @@ SR_API GSList *sr_dev_list(const struct sr_dev_driver *driver) */ SR_API int sr_dev_clear(const struct sr_dev_driver *driver) { - int ret; - if (!driver) { sr_err("Invalid driver."); return SR_ERR_ARG; @@ -548,12 +546,7 @@ SR_API int sr_dev_clear(const struct sr_dev_driver *driver) /* 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); } /** diff --git a/src/hardware/agilent-dmm/api.c b/src/hardware/agilent-dmm/api.c index ab5daaa5..27079764 100644 --- a/src/hardware/agilent-dmm/api.c +++ b/src/hardware/agilent-dmm/api.c @@ -348,7 +348,7 @@ static struct sr_dev_driver agdmm_driver_info = { .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, diff --git a/src/hardware/appa-55ii/api.c b/src/hardware/appa-55ii/api.c index 0bd40bad..05024f96 100644 --- a/src/hardware/appa-55ii/api.c +++ b/src/hardware/appa-55ii/api.c @@ -218,7 +218,7 @@ static struct sr_dev_driver appa_55ii_driver_info = { .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, diff --git a/src/hardware/arachnid-labs-re-load-pro/api.c b/src/hardware/arachnid-labs-re-load-pro/api.c index 7a6e6bcd..4fcd7b85 100644 --- a/src/hardware/arachnid-labs-re-load-pro/api.c +++ b/src/hardware/arachnid-labs-re-load-pro/api.c @@ -337,6 +337,7 @@ static struct sr_dev_driver arachnid_labs_re_load_pro_driver_info = { .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, diff --git a/src/hardware/atten-pps3xxx/api.c b/src/hardware/atten-pps3xxx/api.c index 59252838..a90ab6ff 100644 --- a/src/hardware/atten-pps3xxx/api.c +++ b/src/hardware/atten-pps3xxx/api.c @@ -475,7 +475,7 @@ static struct sr_dev_driver atten_pps3203_driver_info = { .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, diff --git a/src/hardware/baylibre-acme/api.c b/src/hardware/baylibre-acme/api.c index 93570f93..73538583 100644 --- a/src/hardware/baylibre-acme/api.c +++ b/src/hardware/baylibre-acme/api.c @@ -358,6 +358,7 @@ static struct sr_dev_driver baylibre_acme_driver_info = { .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, diff --git a/src/hardware/beaglelogic/api.c b/src/hardware/beaglelogic/api.c index ff8f0424..2b11fdc7 100644 --- a/src/hardware/beaglelogic/api.c +++ b/src/hardware/beaglelogic/api.c @@ -343,6 +343,7 @@ static struct sr_dev_driver beaglelogic_driver_info = { .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, diff --git a/src/hardware/brymen-bm86x/api.c b/src/hardware/brymen-bm86x/api.c index 5a5f3580..c3c1ea62 100644 --- a/src/hardware/brymen-bm86x/api.c +++ b/src/hardware/brymen-bm86x/api.c @@ -221,7 +221,7 @@ static struct sr_dev_driver brymen_bm86x_driver_info = { .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, diff --git a/src/hardware/brymen-dmm/api.c b/src/hardware/brymen-dmm/api.c index 2c43bb3a..2bf9154b 100644 --- a/src/hardware/brymen-dmm/api.c +++ b/src/hardware/brymen-dmm/api.c @@ -178,7 +178,7 @@ static struct sr_dev_driver brymen_bm857_driver_info = { .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, diff --git a/src/hardware/cem-dt-885x/api.c b/src/hardware/cem-dt-885x/api.c index 709e92c9..98db1072 100644 --- a/src/hardware/cem-dt-885x/api.c +++ b/src/hardware/cem-dt-885x/api.c @@ -366,7 +366,7 @@ static struct sr_dev_driver cem_dt_885x_driver_info = { .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, diff --git a/src/hardware/center-3xx/api.c b/src/hardware/center-3xx/api.c index 9e618777..97869bce 100644 --- a/src/hardware/center-3xx/api.c +++ b/src/hardware/center-3xx/api.c @@ -196,6 +196,7 @@ static struct sr_dev_driver ID##_driver_info = { \ .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, \ diff --git a/src/hardware/colead-slm/api.c b/src/hardware/colead-slm/api.c index 338462f3..c2f0ac08 100644 --- a/src/hardware/colead-slm/api.c +++ b/src/hardware/colead-slm/api.c @@ -139,7 +139,7 @@ static struct sr_dev_driver colead_slm_driver_info = { .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, diff --git a/src/hardware/conrad-digi-35-cpu/api.c b/src/hardware/conrad-digi-35-cpu/api.c index b488bcd1..ba84f476 100644 --- a/src/hardware/conrad-digi-35-cpu/api.c +++ b/src/hardware/conrad-digi-35-cpu/api.c @@ -166,7 +166,7 @@ static struct sr_dev_driver conrad_digi_35_cpu_driver_info = { .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, diff --git a/src/hardware/fluke-dmm/api.c b/src/hardware/fluke-dmm/api.c index 75b0954d..022a2ca9 100644 --- a/src/hardware/fluke-dmm/api.c +++ b/src/hardware/fluke-dmm/api.c @@ -246,7 +246,7 @@ static struct sr_dev_driver flukedmm_driver_info = { .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, diff --git a/src/hardware/gmc-mh-1x-2x/api.c b/src/hardware/gmc-mh-1x-2x/api.c index 332c9017..f94fc851 100644 --- a/src/hardware/gmc-mh-1x-2x/api.c +++ b/src/hardware/gmc-mh-1x-2x/api.c @@ -463,7 +463,7 @@ static struct sr_dev_driver gmc_mh_1x_2x_rs232_driver_info = { .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, @@ -483,7 +483,7 @@ static struct sr_dev_driver gmc_mh_2x_bd232_driver_info = { .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, diff --git a/src/hardware/gwinstek-gds-800/api.c b/src/hardware/gwinstek-gds-800/api.c index 0b8262cd..249074b8 100644 --- a/src/hardware/gwinstek-gds-800/api.c +++ b/src/hardware/gwinstek-gds-800/api.c @@ -229,6 +229,7 @@ static struct sr_dev_driver gwinstek_gds_800_driver_info = { .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, diff --git a/src/hardware/hp-3457a/api.c b/src/hardware/hp-3457a/api.c index f58cfef9..873fbc07 100644 --- a/src/hardware/hp-3457a/api.c +++ b/src/hardware/hp-3457a/api.c @@ -432,6 +432,7 @@ static struct sr_dev_driver hp_3457a_driver_info = { .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, diff --git a/src/hardware/kecheng-kc-330b/api.c b/src/hardware/kecheng-kc-330b/api.c index fa50dd69..15dda4e0 100644 --- a/src/hardware/kecheng-kc-330b/api.c +++ b/src/hardware/kecheng-kc-330b/api.c @@ -494,7 +494,7 @@ static struct sr_dev_driver kecheng_kc_330b_driver_info = { .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, diff --git a/src/hardware/kern-scale/api.c b/src/hardware/kern-scale/api.c index 421ab798..7b65a4d6 100644 --- a/src/hardware/kern-scale/api.c +++ b/src/hardware/kern-scale/api.c @@ -178,6 +178,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) .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, \ diff --git a/src/hardware/korad-kaxxxxp/api.c b/src/hardware/korad-kaxxxxp/api.c index 3ee69b72..5ab95c7f 100644 --- a/src/hardware/korad-kaxxxxp/api.c +++ b/src/hardware/korad-kaxxxxp/api.c @@ -364,6 +364,7 @@ static struct sr_dev_driver korad_kaxxxxp_driver_info = { .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, diff --git a/src/hardware/lascar-el-usb/api.c b/src/hardware/lascar-el-usb/api.c index 9801732a..7f741280 100644 --- a/src/hardware/lascar-el-usb/api.c +++ b/src/hardware/lascar-el-usb/api.c @@ -402,7 +402,7 @@ SR_PRIV struct sr_dev_driver lascar_el_usb_driver_info = { .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, diff --git a/src/hardware/lecroy-logicstudio/api.c b/src/hardware/lecroy-logicstudio/api.c index c3007e42..a372d2c7 100644 --- a/src/hardware/lecroy-logicstudio/api.c +++ b/src/hardware/lecroy-logicstudio/api.c @@ -488,6 +488,7 @@ static struct sr_dev_driver lecroy_logicstudio_driver_info = { .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, diff --git a/src/hardware/link-mso19/api.c b/src/hardware/link-mso19/api.c index 5924aeb9..00be6ac4 100644 --- a/src/hardware/link-mso19/api.c +++ b/src/hardware/link-mso19/api.c @@ -399,6 +399,7 @@ static struct sr_dev_driver link_mso19_driver_info = { .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, diff --git a/src/hardware/manson-hcs-3xxx/api.c b/src/hardware/manson-hcs-3xxx/api.c index 7bae9291..5d289c30 100644 --- a/src/hardware/manson-hcs-3xxx/api.c +++ b/src/hardware/manson-hcs-3xxx/api.c @@ -374,6 +374,7 @@ static struct sr_dev_driver manson_hcs_3xxx_driver_info = { .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, diff --git a/src/hardware/maynuo-m97/api.c b/src/hardware/maynuo-m97/api.c index 23b0e68b..876150a2 100644 --- a/src/hardware/maynuo-m97/api.c +++ b/src/hardware/maynuo-m97/api.c @@ -458,6 +458,7 @@ static struct sr_dev_driver maynuo_m97_driver_info = { .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, diff --git a/src/hardware/mic-985xx/api.c b/src/hardware/mic-985xx/api.c index 492f4b79..8be5cbef 100644 --- a/src/hardware/mic-985xx/api.c +++ b/src/hardware/mic-985xx/api.c @@ -213,6 +213,7 @@ static struct sr_dev_driver ID##_driver_info = { \ .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, \ diff --git a/src/hardware/norma-dmm/api.c b/src/hardware/norma-dmm/api.c index c9399402..29cdbccd 100644 --- a/src/hardware/norma-dmm/api.c +++ b/src/hardware/norma-dmm/api.c @@ -221,7 +221,7 @@ static struct sr_dev_driver norma_dmm_driver_info = { .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, @@ -241,7 +241,7 @@ static struct sr_dev_driver siemens_b102x_driver_info = { .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, diff --git a/src/hardware/openbench-logic-sniffer/api.c b/src/hardware/openbench-logic-sniffer/api.c index 93fa3bd7..e3bb1fa5 100644 --- a/src/hardware/openbench-logic-sniffer/api.c +++ b/src/hardware/openbench-logic-sniffer/api.c @@ -564,7 +564,7 @@ static struct sr_dev_driver ols_driver_info = { .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, diff --git a/src/hardware/pce-322a/api.c b/src/hardware/pce-322a/api.c index 3ac85730..14534e2a 100644 --- a/src/hardware/pce-322a/api.c +++ b/src/hardware/pce-322a/api.c @@ -103,11 +103,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) 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) { @@ -347,7 +342,7 @@ static struct sr_dev_driver pce_322a_driver_info = { .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, diff --git a/src/hardware/rohde-schwarz-sme-0x/api.c b/src/hardware/rohde-schwarz-sme-0x/api.c index 25c56a34..21ff6334 100644 --- a/src/hardware/rohde-schwarz-sme-0x/api.c +++ b/src/hardware/rohde-schwarz-sme-0x/api.c @@ -155,11 +155,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) 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); @@ -256,7 +251,7 @@ SR_PRIV struct sr_dev_driver rohde_schwarz_sme_0x_driver_info = { .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, diff --git a/src/hardware/saleae-logic-pro/api.c b/src/hardware/saleae-logic-pro/api.c index d568f3ea..ef4f4950 100644 --- a/src/hardware/saleae-logic-pro/api.c +++ b/src/hardware/saleae-logic-pro/api.c @@ -180,11 +180,6 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) 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; @@ -407,7 +402,7 @@ SR_PRIV struct sr_dev_driver saleae_logic_pro_driver_info = { .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, diff --git a/src/hardware/saleae-logic16/api.c b/src/hardware/saleae-logic16/api.c index ff0af735..0400ce83 100644 --- a/src/hardware/saleae-logic16/api.c +++ b/src/hardware/saleae-logic16/api.c @@ -786,7 +786,7 @@ static struct sr_dev_driver saleae_logic16_driver_info = { .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, diff --git a/src/hardware/serial-dmm/api.c b/src/hardware/serial-dmm/api.c index ad063679..99b2a717 100644 --- a/src/hardware/serial-dmm/api.c +++ b/src/hardware/serial-dmm/api.c @@ -200,6 +200,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi) .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, \ diff --git a/src/hardware/teleinfo/api.c b/src/hardware/teleinfo/api.c index 5e786295..980b5b3e 100644 --- a/src/hardware/teleinfo/api.c +++ b/src/hardware/teleinfo/api.c @@ -181,7 +181,7 @@ static struct sr_dev_driver teleinfo_driver_info = { .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, diff --git a/src/hardware/testo/api.c b/src/hardware/testo/api.c index 548cdb3d..062849bf 100644 --- a/src/hardware/testo/api.c +++ b/src/hardware/testo/api.c @@ -415,6 +415,7 @@ static struct sr_dev_driver testo_driver_info = { .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, diff --git a/src/hardware/tondaj-sl-814/api.c b/src/hardware/tondaj-sl-814/api.c index bdad1f60..4330d960 100644 --- a/src/hardware/tondaj-sl-814/api.c +++ b/src/hardware/tondaj-sl-814/api.c @@ -150,7 +150,7 @@ static struct sr_dev_driver tondaj_sl_814_driver_info = { .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, diff --git a/src/hardware/uni-t-dmm/api.c b/src/hardware/uni-t-dmm/api.c index 1dc14872..eccff3cf 100644 --- a/src/hardware/uni-t-dmm/api.c +++ b/src/hardware/uni-t-dmm/api.c @@ -175,6 +175,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi) .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, \ diff --git a/src/hardware/uni-t-ut32x/api.c b/src/hardware/uni-t-ut32x/api.c index 1d12a580..7d4ca628 100644 --- a/src/hardware/uni-t-ut32x/api.c +++ b/src/hardware/uni-t-ut32x/api.c @@ -302,7 +302,7 @@ static struct sr_dev_driver uni_t_ut32x_driver_info = { .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, diff --git a/src/hardware/victor-dmm/api.c b/src/hardware/victor-dmm/api.c index 66eff890..ebe56fea 100644 --- a/src/hardware/victor-dmm/api.c +++ b/src/hardware/victor-dmm/api.c @@ -326,7 +326,7 @@ static struct sr_dev_driver victor_dmm_driver_info = { .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, diff --git a/src/hardware/zeroplus-logic-cube/api.c b/src/hardware/zeroplus-logic-cube/api.c index 8d530e57..e8e7d4fb 100644 --- a/src/hardware/zeroplus-logic-cube/api.c +++ b/src/hardware/zeroplus-logic-cube/api.c @@ -658,7 +658,7 @@ static struct sr_dev_driver zeroplus_logic_cube_driver_info = { .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, diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h index 97d1cdde..fe2544fa 100644 --- a/src/libsigrok-internal.h +++ b/src/libsigrok-internal.h @@ -942,6 +942,7 @@ SR_PRIV int std_session_send_df_header(const struct sr_dev_inst *sdi); 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); diff --git a/src/std.c b/src/std.c index 915a2455..1433f30f 100644 --- a/src/std.c +++ b/src/std.c @@ -404,6 +404,11 @@ SR_PRIV int std_dev_clear_with_callback(const struct sr_dev_driver *driver, 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. *