From: Uwe Hermann Date: Tue, 11 Jul 2017 20:47:46 +0000 (+0200) Subject: dev_clear(): Consistently name callback 'clear_helper()'. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=53279f13e4694fcf2aba314baade418941b0bc3e;p=libsigrok.git dev_clear(): Consistently name callback 'clear_helper()'. --- diff --git a/src/hardware/asix-sigma/api.c b/src/hardware/asix-sigma/api.c index 542aadbb..cf02b1e5 100644 --- a/src/hardware/asix-sigma/api.c +++ b/src/hardware/asix-sigma/api.c @@ -59,9 +59,18 @@ static const int32_t trigger_matches[] = { }; #endif +static void clear_helper(void *priv) +{ + struct dev_context *devc; + + devc = priv; + + ftdi_deinit(&devc->ftdic); +} + static int dev_clear(const struct sr_dev_driver *di) { - return std_dev_clear_with_callback(di, sigma_clear_helper); + return std_dev_clear_with_callback(di, clear_helper); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/asix-sigma/protocol.c b/src/hardware/asix-sigma/protocol.c index cc742d10..01382e75 100644 --- a/src/hardware/asix-sigma/protocol.c +++ b/src/hardware/asix-sigma/protocol.c @@ -272,15 +272,6 @@ SR_PRIV int sigma_write_trigger_lut(struct triggerlut *lut, struct dev_context * return SR_OK; } -SR_PRIV void sigma_clear_helper(void *priv) -{ - struct dev_context *devc; - - devc = priv; - - ftdi_deinit(&devc->ftdic); -} - /* * Configure the FPGA for bitbang mode. * This sequence is documented in section 2. of the ASIX Sigma programming diff --git a/src/hardware/asix-sigma/protocol.h b/src/hardware/asix-sigma/protocol.h index e84badd9..88821769 100644 --- a/src/hardware/asix-sigma/protocol.h +++ b/src/hardware/asix-sigma/protocol.h @@ -280,7 +280,6 @@ SR_PRIV int sigma_write_register(uint8_t reg, uint8_t *data, size_t len, struct dev_context *devc); SR_PRIV int sigma_set_register(uint8_t reg, uint8_t value, struct dev_context *devc); SR_PRIV int sigma_write_trigger_lut(struct triggerlut *lut, struct dev_context *devc); -SR_PRIV void sigma_clear_helper(void *priv); SR_PRIV uint64_t sigma_limit_samples_to_msec(const struct dev_context *devc, uint64_t limit_samples); SR_PRIV int sigma_set_samplerate(const struct sr_dev_inst *sdi, uint64_t samplerate); diff --git a/src/hardware/dreamsourcelab-dslogic/api.c b/src/hardware/dreamsourcelab-dslogic/api.c index 17793224..2b84ac3e 100644 --- a/src/hardware/dreamsourcelab-dslogic/api.c +++ b/src/hardware/dreamsourcelab-dslogic/api.c @@ -283,7 +283,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) return std_scan_complete(di, devices); } -static void clear_dev_context(void *priv) +static void clear_helper(void *priv) { struct dev_context *devc; @@ -293,7 +293,7 @@ static void clear_dev_context(void *priv) static int dev_clear(const struct sr_dev_driver *di) { - return std_dev_clear_with_callback(di, clear_dev_context); + return std_dev_clear_with_callback(di, clear_helper); } static int dev_open(struct sr_dev_inst *sdi) diff --git a/src/hardware/fx2lafw/api.c b/src/hardware/fx2lafw/api.c index 1f6aef29..da27f092 100644 --- a/src/hardware/fx2lafw/api.c +++ b/src/hardware/fx2lafw/api.c @@ -345,7 +345,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) return std_scan_complete(di, devices); } -static void clear_dev_context(void *priv) +static void clear_helper(void *priv) { struct dev_context *devc; @@ -356,7 +356,7 @@ static void clear_dev_context(void *priv) static int dev_clear(const struct sr_dev_driver *di) { - return std_dev_clear_with_callback(di, clear_dev_context); + return std_dev_clear_with_callback(di, clear_helper); } static int dev_open(struct sr_dev_inst *sdi) diff --git a/src/hardware/hantek-6xxx/api.c b/src/hardware/hantek-6xxx/api.c index e815603f..ad407a2e 100644 --- a/src/hardware/hantek-6xxx/api.c +++ b/src/hardware/hantek-6xxx/api.c @@ -156,7 +156,7 @@ static int configure_channels(const struct sr_dev_inst *sdi) return SR_OK; } -static void clear_dev_context(void *priv) +static void clear_helper(void *priv) { struct dev_context *devc; @@ -167,7 +167,7 @@ static void clear_dev_context(void *priv) static int dev_clear(const struct sr_dev_driver *di) { - return std_dev_clear_with_callback(di, clear_dev_context); + return std_dev_clear_with_callback(di, clear_helper); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/hantek-dso/api.c b/src/hardware/hantek-dso/api.c index 8d624edd..ea07b546 100644 --- a/src/hardware/hantek-dso/api.c +++ b/src/hardware/hantek-dso/api.c @@ -232,19 +232,18 @@ static int configure_channels(const struct sr_dev_inst *sdi) return SR_OK; } -static void clear_dev_context(void *priv) +static void clear_helper(void *priv) { struct dev_context *devc; devc = priv; g_free(devc->triggersource); g_slist_free(devc->enabled_channels); - } static int dev_clear(const struct sr_dev_driver *di) { - return std_dev_clear_with_callback(di, clear_dev_context); + return std_dev_clear_with_callback(di, clear_helper); } static GSList *scan(struct sr_dev_driver *di, GSList *options) diff --git a/src/hardware/hung-chang-dso-2100/api.c b/src/hardware/hung-chang-dso-2100/api.c index 419b40bc..505649dd 100644 --- a/src/hardware/hung-chang-dso-2100/api.c +++ b/src/hardware/hung-chang-dso-2100/api.c @@ -218,7 +218,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) return std_scan_complete(di, devices); } -static void clear_private(void *priv) +static void clear_helper(void *priv) { struct dev_context *devc = priv; @@ -238,7 +238,7 @@ static int dev_clear(const struct sr_dev_driver *di) } } - return std_dev_clear_with_callback(di, clear_private); + return std_dev_clear_with_callback(di, clear_helper); } static int dev_open(struct sr_dev_inst *sdi) diff --git a/src/hardware/ikalogic-scanalogic2/api.c b/src/hardware/ikalogic-scanalogic2/api.c index 3189909c..335768eb 100644 --- a/src/hardware/ikalogic-scanalogic2/api.c +++ b/src/hardware/ikalogic-scanalogic2/api.c @@ -152,14 +152,12 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) return std_scan_complete(di, devices); } -static void clear_dev_context(void *priv) +static void clear_helper(void *priv) { struct dev_context *devc; devc = priv; - sr_dbg("Device context cleared."); - libusb_free_transfer(devc->xfer_in); libusb_free_transfer(devc->xfer_out); g_free(devc); @@ -167,7 +165,7 @@ static void clear_dev_context(void *priv) static int dev_clear(const struct sr_dev_driver *di) { - return std_dev_clear_with_callback(di, &clear_dev_context); + return std_dev_clear_with_callback(di, clear_helper); } static int dev_open(struct sr_dev_inst *sdi) diff --git a/src/hardware/motech-lps-30x/api.c b/src/hardware/motech-lps-30x/api.c index fe396199..84d298b3 100644 --- a/src/hardware/motech-lps-30x/api.c +++ b/src/hardware/motech-lps-30x/api.c @@ -496,7 +496,7 @@ static GSList *scan_lps301(struct sr_dev_driver *di, GSList *options) return do_scan(LPS_301, di, options); } -static void dev_clear_private(struct dev_context *devc) +static void clear_helper(struct dev_context *devc) { int ch_idx; @@ -505,9 +505,9 @@ static void dev_clear_private(struct dev_context *devc) g_slist_free(devc->channel_status[ch_idx].info); } -static int dev_clear_lps301(const struct sr_dev_driver *di) +static int dev_clear(const struct sr_dev_driver *di) { - return std_dev_clear_with_callback(di, (std_dev_clear_callback)dev_clear_private); + return std_dev_clear_with_callback(di, (std_dev_clear_callback)clear_helper); } static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, @@ -784,7 +784,7 @@ static struct sr_dev_driver motech_lps_301_driver_info = { .cleanup = std_cleanup, .scan = scan_lps301, .dev_list = std_dev_list, - .dev_clear = dev_clear_lps301, + .dev_clear = dev_clear, .config_get = config_get, .config_set = config_set, .config_list = config_list, diff --git a/src/hardware/sysclk-lwla/api.c b/src/hardware/sysclk-lwla/api.c index 8373a0eb..6cd38a13 100644 --- a/src/hardware/sysclk-lwla/api.c +++ b/src/hardware/sysclk-lwla/api.c @@ -203,9 +203,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) return std_scan_complete(di, devices); } -/* Destroy the private device context. - */ -static void clear_dev_context(void *priv) +static void clear_helper(void *priv) { struct dev_context *devc; @@ -215,16 +213,13 @@ static void clear_dev_context(void *priv) sr_err("Cannot clear device context during acquisition!"); return; /* Leak and pray. */ } - sr_dbg("Device context cleared."); g_free(devc); } -/* Destroy all device instances. - */ static int dev_clear(const struct sr_dev_driver *di) { - return std_dev_clear_with_callback(di, &clear_dev_context); + return std_dev_clear_with_callback(di, clear_helper); } /* Drain any pending data from the USB transfer buffers on the device.