return ((struct drv_context *)(di->context))->instances;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return std_dev_clear(di, NULL);
-}
-
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "Agilent U12xx series DMMs",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = NULL,
return ((struct drv_context *)(di->context))->instances;
}
-static int cleanup(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)
{
.longname = "APPA 55II",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = NULL,
return std_dev_clear(di, NULL);
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return dev_clear(di);
-}
-
static int config_list(uint32_t key, GVariant **data,
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
{
.longname = "Arachnid Labs Re:load Pro",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return SR_OK;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return dev_clear(di);
-}
-
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "ASIX SIGMA/SIGMA2",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return ((struct drv_context *)(di->context))->instances;
}
-static int cleanup(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)
{
.longname = "Atten PPS3203T-3S",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan_3203,
.dev_list = dev_list,
.dev_clear = NULL,
return SR_OK;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- dev_clear(di);
-
- return SR_OK;
-}
-
static int config_get(uint32_t key, GVariant **data,
const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
.longname = "BayLibre ACME (Another Cute Measurement Equipment)",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return SR_OK;
}
-static int cleanup(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)
{
.longname = "BeagleLogic",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return ret;
}
-static int cleanup(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)
{
.longname = "Brymen BM86X",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = NULL,
return ((struct drv_context *)(di->context))->instances;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return std_dev_clear(di, NULL);
-}
-
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "Brymen BM857",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = NULL,
return ((struct drv_context *)(di->context))->instances;
}
-static int cleanup(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)
{
.longname = "CEM DT-885x",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = NULL,
return ((struct drv_context *)(center_devs[idx].di->context))->instances;
}
-static int cleanup(int idx)
-{
- return dev_clear(idx);
-}
-
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
#define HW_INIT(X) \
static int init_##X(struct sr_dev_driver *d, \
struct sr_context *sr_ctx) { (void)d; return init(sr_ctx, X); }
-#define HW_CLEANUP(X) \
-static int cleanup_##X(const struct sr_dev_driver *d) { \
- (void)d; return cleanup(X); }
#define HW_SCAN(X) \
static GSList *scan_##X(struct sr_dev_driver *d, GSList *options) { \
(void)d; return scan(options, X); }
/* Driver structs and API function wrappers */
#define DRV(ID, ID_UPPER, NAME, LONGNAME) \
HW_INIT(ID_UPPER) \
-HW_CLEANUP(ID_UPPER) \
HW_SCAN(ID_UPPER) \
HW_DEV_LIST(ID_UPPER) \
HW_DEV_CLEAR(ID_UPPER) \
.longname = LONGNAME, \
.api_version = 1, \
.init = init_##ID_UPPER, \
- .cleanup = cleanup_##ID_UPPER, \
+ .cleanup = std_cleanup, \
.scan = scan_##ID_UPPER, \
.dev_list = dev_list_##ID_UPPER, \
.dev_clear = dev_clear_##ID_UPPER, \
return SR_OK;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return dev_clear(di);
-}
-
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "ChronoVu LA8/LA16",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return ((struct drv_context *)(di->context))->instances;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return std_dev_clear(di, NULL);
-}
-
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "Colead SLM",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = NULL,
return ((struct drv_context *)(di->context))->instances;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return std_dev_clear(di, NULL);
-}
-
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "Conrad DIGI 35 CPU",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = NULL,
return std_dev_clear(di, clear_helper);
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return dev_clear(di);
-}
-
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "Demo driver and pattern generator",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return std_dev_clear(di, es51919_serial_clean);
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return dev_clear(di);
-}
-
static GSList *scan(struct sr_dev_driver *di, GSList *options)
{
struct sr_dev_inst *sdi;
.longname = "DER EE DE-5000",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return ((struct drv_context *)(di->context))->instances;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return std_dev_clear(di, NULL);
-}
-
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "Fluke 18x/28x series DMMs",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = NULL,
return SR_OK;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- dev_clear(di);
-
- /* TODO: Free other driver resources, if any. */
-
- return SR_OK;
-}
-
static int config_get(uint32_t key, GVariant **data,
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
{
.longname = "FTDI LA",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return SR_OK;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- int ret;
- struct drv_context *drvc;
-
- if (!(drvc = di->context))
- return SR_OK;
-
- ret = std_dev_clear(di, NULL);
-
- g_free(drvc);
-
- return ret;
-}
-
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "fx2lafw (generic driver for FX2 based LAs)",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return SR_OK;
}
-static int cleanup(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)
{
.longname = "Gossen Metrawatt Metrahit 1x/2x, RS232 interface",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan_1x_2x_rs232,
.dev_list = dev_list,
.dev_clear = NULL,
.longname = "Gossen Metrawatt Metrahit 2x, BD232/SI232-II interface",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan_2x_bd232,
.dev_list = dev_list,
.dev_clear = NULL,
return SR_OK;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- dev_clear(di);
-
- return SR_OK;
-}
-
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "GW Instek GDS-800 series",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return SR_OK;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- dev_clear(di);
-
- return SR_OK;
-}
-
static int check_channel_group(struct dev_context *devc,
const struct sr_channel_group *cg)
{
.longname = "Hameg HMO",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return SR_OK;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return dev_clear(di);
-}
-
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "Hantek 6xxx",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return SR_OK;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return dev_clear(di);
-}
-
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "Hantek DSO",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return SR_OK;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return dev_clear(di);
-}
-
static int config_get(uint32_t key, GVariant **data,
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
{
.longname = "HP 3457A",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return SR_OK;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- struct drv_context *drvc = di->context;
- int ret;
-
- ret = dev_clear(di);
-
- g_free(drvc);
-
- return ret;
-}
-
static int find_in_array(GVariant *data, const GVariantType *type,
const void *arr, int n)
{
.longname = "Hung-Chang DSO-2100",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return SR_OK;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return dev_clear(di);
-}
-
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "IKALOGIC Scanalogic-2",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return ret;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return dev_clear(di);
-}
-
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "IKALOGIC ScanaPLUS",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return SR_OK;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- int ret;
- struct drv_context *drvc;
-
- if (!(drvc = di->context))
- /* Can get called on an unused driver, doesn't matter. */
- return SR_OK;
-
- ret = std_dev_clear(di, NULL);
- g_free(drvc);
-
- return ret;
-}
-
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "Kecheng KC-330B",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = NULL,
return ((struct drv_context *)(di->context))->instances;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return dev_clear(di);
-}
-
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = VENDOR " " MODEL, \
.api_version = 1, \
.init = init, \
- .cleanup = cleanup, \
+ .cleanup = std_cleanup, \
.scan = scan, \
.dev_list = dev_list, \
.dev_clear = dev_clear, \
return std_dev_clear(di, NULL);
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- dev_clear(di);
- return SR_OK;
-}
-
static int config_get(uint32_t key, GVariant **data,
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
{
.longname = "Korad KAxxxxP",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return SR_OK;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- int ret;
- struct drv_context *drvc;
-
- if (!(drvc = di->context))
- /* Can get called on an unused driver, doesn't matter. */
- return SR_OK;
-
- ret = std_dev_clear(di, NULL);
- g_free(drvc);
-
- return ret;
-}
-
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "Lascar EL-USB",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = NULL,
return SR_OK;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- struct drv_context *drvc;
- int ret;
-
- drvc = di->context;
-
- ret = dev_clear(di);
-
- g_free(drvc);
-
- return ret;
-}
-
static int config_get(uint32_t key, GVariant **data,
const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
{
.longname = "LeCroy LogicStudio",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return SR_OK;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return dev_clear();
-}
-
static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "Link Instruments MSO-19",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return ((struct drv_context *)(di->context))->instances;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return dev_clear(di);
-}
-
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "Manson HCS-3xxx",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return SR_OK;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return dev_clear(di);
-}
-
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "maynuo M97/M98 series",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return ((struct drv_context *)(mic_devs[idx].di->context))->instances;
}
-static int cleanup(int idx)
-{
- return dev_clear(idx);
-}
-
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
#define HW_INIT(X) \
static int init_##X(struct sr_dev_driver *di, struct sr_context *sr_ctx) { \
(void)di; return init(sr_ctx, X); }
-#define HW_CLEANUP(X) \
-static int cleanup_##X(const struct sr_dev_driver *di) { \
- (void)di; return cleanup(X); }
#define HW_SCAN(X) \
static GSList *scan_##X(struct sr_dev_driver *di, GSList *options) { \
(void)di; return scan(options, X); }
/* Driver structs and API function wrappers */
#define DRV(ID, ID_UPPER, NAME, LONGNAME) \
HW_INIT(ID_UPPER) \
-HW_CLEANUP(ID_UPPER) \
HW_SCAN(ID_UPPER) \
HW_DEV_LIST(ID_UPPER) \
HW_DEV_CLEAR(ID_UPPER) \
.longname = LONGNAME, \
.api_version = 1, \
.init = init_##ID_UPPER, \
- .cleanup = cleanup_##ID_UPPER, \
+ .cleanup = std_cleanup, \
.scan = scan_##ID_UPPER, \
.dev_list = dev_list_##ID_UPPER, \
.dev_clear = dev_clear_##ID_UPPER, \
return std_dev_clear(di, (std_dev_clear_callback)dev_clear_private);
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return dev_clear_lps301(di);
-}
-
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "Motech LPS-301",
.api_version = 1,
.init = init_lps301,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan_lps301,
.dev_list = dev_list_lps301,
.dev_clear = dev_clear_lps301,
return SR_OK;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return std_dev_clear(di, NULL);
-}
-
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "Norma DM9x0 DMMs",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = NULL,
.longname = "Siemens B102x DMMs",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = NULL,
return ((struct drv_context *)(di->context))->instances;
}
-static int cleanup(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)
{
.longname = "Openbench Logic Sniffer",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = NULL,
return std_dev_clear(di, clear_helper);
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return dev_clear(di);
-}
-
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "Pipistrello OLS",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return SR_OK;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return dev_clear(di);
-}
-
static int analog_frame_size(const struct sr_dev_inst *sdi)
{
struct dev_context *devc = sdi->priv;
.longname = "Rigol DS",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return SR_OK;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- int ret;
- struct drv_context *drvc;
-
- if (!(drvc = di->context))
- /* Can get called on an unused driver, doesn't matter. */
- return SR_OK;
-
- ret = std_dev_clear(di, NULL);
- g_free(drvc);
-
- return ret;
-}
-
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "Saleae Logic16",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = NULL,
return std_dev_clear(di, clear_helper);
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return dev_clear(di);
-}
-
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "SCPI PPS",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return ((struct drv_context *)(di->context))->instances;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return dev_clear(di);
-}
-
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = VENDOR " " MODEL, \
.api_version = 1, \
.init = init, \
- .cleanup = cleanup, \
+ .cleanup = std_cleanup, \
.scan = scan, \
.dev_list = dev_list, \
.dev_clear = dev_clear, \
.longname = "SysClk LWLA series",
.api_version = 1,
.init = init,
- .cleanup = dev_clear,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return ((struct drv_context *)(di->context))->instances;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return std_dev_clear(di, NULL);
-}
-
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "Teleinfo",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = NULL,
return SR_OK;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- int ret;
- struct drv_context *drvc;
-
- if (!(drvc = di->context))
- return SR_OK;
-
- ret = dev_clear(di);
- g_free(drvc);
-
- return ret;
-}
-
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "Testo",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return ((struct drv_context *)(di->context))->instances;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return std_dev_clear(di, NULL);
-}
-
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "Tondaj SL-814",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = NULL,
return SR_OK;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- return dev_clear(di);
-}
-
static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = VENDOR " " MODEL, \
.api_version = 1, \
.init = init, \
- .cleanup = cleanup, \
+ .cleanup = std_cleanup, \
.scan = scan, \
.dev_list = dev_list, \
.dev_clear = dev_clear, \
return SR_OK;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- int ret;
- struct drv_context *drvc;
-
- if (!(drvc = di->context))
- /* Can get called on an unused driver, doesn't matter. */
- return SR_OK;
-
- ret = std_dev_clear(di, NULL);
- g_free(drvc);
-
- return ret;
-}
-
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "UNI-T UT32x",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = NULL,
return SR_OK;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- int ret;
- struct drv_context *drvc;
-
- if (!(drvc = di->context))
- /* Can get called on an unused driver, doesn't matter. */
- return SR_OK;
-
- ret = std_dev_clear(di, NULL);
- g_free(drvc);
-
- return ret;
-}
-
static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
const struct sr_channel_group *cg)
{
.longname = "Victor DMMs",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = NULL,
return SR_OK;
}
-static int cleanup(const struct sr_dev_driver *di)
-{
- dev_clear(di);
-
- return SR_OK;
-}
-
/**
* Check which category a given channel group belongs to.
*
.longname = "Yokogawa DL/DLM",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = dev_clear,
return SR_OK;
}
-static int cleanup(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)
{
.longname = "ZEROPLUS Logic Cube LAP-C series",
.api_version = 1,
.init = init,
- .cleanup = cleanup,
+ .cleanup = std_cleanup,
.scan = scan,
.dev_list = dev_list,
.dev_clear = NULL,
SR_PRIV int std_init(struct sr_context *sr_ctx, struct sr_dev_driver *di,
const char *prefix);
+SR_PRIV int std_cleanup(const struct sr_dev_driver *di);
#ifdef HAVE_LIBSERIALPORT
SR_PRIV int std_serial_dev_open(struct sr_dev_inst *sdi);
SR_PRIV int std_serial_dev_acquisition_stop(struct sr_dev_inst *sdi,
return SR_OK;
}
+/**
+ * Standard driver cleanup() callback API helper
+ *
+ * @param di The driver instance to use.
+ *
+ * Frees all device instances by calling sr_dev_clear() and then releases any
+ * resources allocated by std_init().
+ *
+ * @retval SR_OK Success
+ * @retval SR_ERR_ARG Invalid driver
+ *
+*/
+SR_PRIV int std_cleanup(const struct sr_dev_driver *di)
+{
+ int ret;
+
+ ret = sr_dev_clear(di);
+ g_free(di->context);
+
+ return ret;
+}
+
/**
* Standard API helper for sending an SR_DF_HEADER packet.
*