dev_clear(): Consistently name callback 'clear_helper()'.

This commit is contained in:
Uwe Hermann 2017-07-11 22:47:46 +02:00
parent f778bf02ea
commit 53279f13e4
11 changed files with 28 additions and 37 deletions

View File

@ -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)

View File

@ -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

View File

@ -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);

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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,

View File

@ -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.