Use std_serial_dev_close() to replace matching dev_close functions.
This commit is contained in:
parent
043e899a51
commit
bf2c987fde
|
@ -182,19 +182,6 @@ static int dev_open(struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int dev_close(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct sr_serial_dev_inst *serial;
|
||||
|
||||
serial = sdi->conn;
|
||||
if (serial && serial->fd != -1) {
|
||||
serial_close(serial);
|
||||
sdi->status = SR_ST_INACTIVE;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int cleanup(void)
|
||||
{
|
||||
return dev_clear();
|
||||
|
@ -287,7 +274,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
|||
|
||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
|
||||
{
|
||||
return std_dev_acquisition_stop_serial(sdi, cb_data, dev_close,
|
||||
return std_dev_acquisition_stop_serial(sdi, cb_data, std_serial_dev_close,
|
||||
sdi->conn, LOG_PREFIX);
|
||||
}
|
||||
|
||||
|
@ -304,7 +291,7 @@ SR_PRIV struct sr_dev_driver agdmm_driver_info = {
|
|||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = dev_open,
|
||||
.dev_close = dev_close,
|
||||
.dev_close = std_serial_dev_close,
|
||||
.dev_acquisition_start = dev_acquisition_start,
|
||||
.dev_acquisition_stop = dev_acquisition_stop,
|
||||
.priv = NULL,
|
||||
|
|
|
@ -162,19 +162,6 @@ static int dev_open(struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int dev_close(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct sr_serial_dev_inst *serial;
|
||||
|
||||
serial = sdi->conn;
|
||||
if (serial && serial->fd != -1) {
|
||||
serial_close(serial);
|
||||
sdi->status = SR_ST_INACTIVE;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int cleanup(void)
|
||||
{
|
||||
return dev_clear();
|
||||
|
@ -269,7 +256,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
|||
|
||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
|
||||
{
|
||||
return std_dev_acquisition_stop_serial(sdi, cb_data, dev_close,
|
||||
return std_dev_acquisition_stop_serial(sdi, cb_data, std_serial_dev_close,
|
||||
sdi->conn, LOG_PREFIX);
|
||||
}
|
||||
|
||||
|
@ -286,7 +273,7 @@ SR_PRIV struct sr_dev_driver brymen_bm857_driver_info = {
|
|||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = dev_open,
|
||||
.dev_close = dev_close,
|
||||
.dev_close = std_serial_dev_close,
|
||||
.dev_acquisition_start = dev_acquisition_start,
|
||||
.dev_acquisition_stop = dev_acquisition_stop,
|
||||
.priv = NULL,
|
||||
|
|
|
@ -165,19 +165,6 @@ static int dev_open(struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int dev_close(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct sr_serial_dev_inst *serial;
|
||||
|
||||
serial = sdi->conn;
|
||||
if (serial && serial->fd != -1) {
|
||||
serial_close(serial);
|
||||
sdi->status = SR_ST_INACTIVE;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int cleanup(void)
|
||||
{
|
||||
return dev_clear();
|
||||
|
@ -428,7 +415,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
|
|||
if (sdi->status != SR_ST_ACTIVE)
|
||||
return SR_ERR_DEV_CLOSED;
|
||||
|
||||
return std_dev_acquisition_stop_serial(sdi, cb_data, dev_close,
|
||||
return std_dev_acquisition_stop_serial(sdi, cb_data, std_serial_dev_close,
|
||||
sdi->conn, LOG_PREFIX);
|
||||
|
||||
return SR_OK;
|
||||
|
@ -447,7 +434,7 @@ SR_PRIV struct sr_dev_driver cem_dt_885x_driver_info = {
|
|||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = dev_open,
|
||||
.dev_close = dev_close,
|
||||
.dev_close = std_serial_dev_close,
|
||||
.dev_acquisition_start = dev_acquisition_start,
|
||||
.dev_acquisition_stop = dev_acquisition_stop,
|
||||
.priv = NULL,
|
||||
|
|
|
@ -168,19 +168,6 @@ static int dev_open(struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int dev_close(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct sr_serial_dev_inst *serial;
|
||||
|
||||
serial = sdi->conn;
|
||||
if (serial && serial->fd != -1) {
|
||||
serial_close(serial);
|
||||
sdi->status = SR_ST_INACTIVE;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int cleanup(int idx)
|
||||
{
|
||||
return dev_clear(idx);
|
||||
|
@ -265,8 +252,8 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi,
|
|||
|
||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
|
||||
{
|
||||
return std_dev_acquisition_stop_serial(sdi, cb_data, dev_close,
|
||||
sdi->conn, LOG_PREFIX);
|
||||
return std_dev_acquisition_stop_serial(sdi, cb_data,
|
||||
std_serial_dev_close, sdi->conn, LOG_PREFIX);
|
||||
}
|
||||
|
||||
/* Driver-specific API function wrappers */
|
||||
|
@ -305,7 +292,7 @@ SR_PRIV struct sr_dev_driver ID##_driver_info = { \
|
|||
.config_set = config_set, \
|
||||
.config_list = config_list, \
|
||||
.dev_open = dev_open, \
|
||||
.dev_close = dev_close, \
|
||||
.dev_close = std_serial_dev_close, \
|
||||
.dev_acquisition_start = dev_acquisition_start_##ID_UPPER, \
|
||||
.dev_acquisition_stop = dev_acquisition_stop, \
|
||||
.priv = NULL, \
|
||||
|
|
|
@ -129,19 +129,6 @@ static int dev_open(struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int dev_close(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct sr_serial_dev_inst *serial;
|
||||
|
||||
serial = sdi->conn;
|
||||
if (serial && serial->fd != -1) {
|
||||
serial_close(serial);
|
||||
sdi->status = SR_ST_INACTIVE;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int cleanup(void)
|
||||
{
|
||||
return dev_clear();
|
||||
|
@ -235,7 +222,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
|||
|
||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
|
||||
{
|
||||
return std_dev_acquisition_stop_serial(sdi, cb_data, dev_close,
|
||||
return std_dev_acquisition_stop_serial(sdi, cb_data, std_serial_dev_close,
|
||||
sdi->conn, LOG_PREFIX);
|
||||
}
|
||||
|
||||
|
@ -252,7 +239,7 @@ SR_PRIV struct sr_dev_driver colead_slm_driver_info = {
|
|||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = dev_open,
|
||||
.dev_close = dev_close,
|
||||
.dev_close = std_serial_dev_close,
|
||||
.dev_acquisition_start = dev_acquisition_start,
|
||||
.dev_acquisition_stop = dev_acquisition_stop,
|
||||
.priv = NULL,
|
||||
|
|
|
@ -215,19 +215,6 @@ static int dev_open(struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int dev_close(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct sr_serial_dev_inst *serial;
|
||||
|
||||
serial = sdi->conn;
|
||||
if (serial && serial->fd != -1) {
|
||||
serial_close(serial);
|
||||
sdi->status = SR_ST_INACTIVE;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int cleanup(void)
|
||||
{
|
||||
return dev_clear();
|
||||
|
@ -327,7 +314,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
|||
|
||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
|
||||
{
|
||||
return std_dev_acquisition_stop_serial(sdi, cb_data, dev_close,
|
||||
return std_dev_acquisition_stop_serial(sdi, cb_data, std_serial_dev_close,
|
||||
sdi->conn, LOG_PREFIX);
|
||||
}
|
||||
|
||||
|
@ -344,7 +331,7 @@ SR_PRIV struct sr_dev_driver flukedmm_driver_info = {
|
|||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = dev_open,
|
||||
.dev_close = dev_close,
|
||||
.dev_close = std_serial_dev_close,
|
||||
.dev_acquisition_start = dev_acquisition_start,
|
||||
.dev_acquisition_stop = dev_acquisition_stop,
|
||||
.priv = NULL,
|
||||
|
|
|
@ -234,14 +234,9 @@ static int dev_open(struct sr_dev_inst *sdi)
|
|||
|
||||
static int dev_close(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct sr_serial_dev_inst *serial;
|
||||
struct dev_context *devc;
|
||||
|
||||
serial = sdi->conn;
|
||||
if (serial && serial->fd != -1) {
|
||||
serial_close(serial);
|
||||
sdi->status = SR_ST_INACTIVE;
|
||||
}
|
||||
std_serial_dev_close(sdi);
|
||||
|
||||
sdi->status = SR_ST_INACTIVE;
|
||||
|
||||
|
|
|
@ -51,8 +51,6 @@ static const uint64_t samplerates[] = {
|
|||
SR_PRIV struct sr_dev_driver link_mso19_driver_info;
|
||||
static struct sr_dev_driver *di = &link_mso19_driver_info;
|
||||
|
||||
static int dev_close(struct sr_dev_inst *sdi);
|
||||
|
||||
/* TODO: Use sr_dev_inst to store connection handle & use std_dev_clear(). */
|
||||
static int dev_clear(void)
|
||||
{
|
||||
|
@ -79,7 +77,7 @@ static int dev_clear(void)
|
|||
ret = SR_ERR_BUG;
|
||||
continue;
|
||||
}
|
||||
dev_close(sdi);
|
||||
std_serial_dev_close(sdi);
|
||||
sr_serial_dev_inst_free(devc->serial);
|
||||
sr_dev_inst_free(sdi);
|
||||
}
|
||||
|
@ -272,20 +270,6 @@ static int dev_open(struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int dev_close(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct dev_context *devc;
|
||||
|
||||
devc = sdi->priv;
|
||||
|
||||
if (devc->serial && devc->serial->fd != -1) {
|
||||
serial_close(devc->serial);
|
||||
sdi->status = SR_ST_INACTIVE;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int cleanup(void)
|
||||
{
|
||||
return dev_clear();
|
||||
|
@ -501,7 +485,7 @@ SR_PRIV struct sr_dev_driver link_mso19_driver_info = {
|
|||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = dev_open,
|
||||
.dev_close = dev_close,
|
||||
.dev_close = std_serial_dev_close,
|
||||
.dev_acquisition_start = dev_acquisition_start,
|
||||
.dev_acquisition_stop = dev_acquisition_stop,
|
||||
.priv = NULL,
|
||||
|
|
|
@ -170,19 +170,6 @@ static int dev_open(struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int dev_close(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct sr_serial_dev_inst *serial;
|
||||
|
||||
serial = sdi->conn;
|
||||
if (serial && serial->fd != -1) {
|
||||
serial_close(serial);
|
||||
sdi->status = SR_ST_INACTIVE;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int cleanup(int idx)
|
||||
{
|
||||
return dev_clear(idx);
|
||||
|
@ -267,7 +254,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi,
|
|||
|
||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
|
||||
{
|
||||
return std_dev_acquisition_stop_serial(sdi, cb_data, dev_close,
|
||||
return std_dev_acquisition_stop_serial(sdi, cb_data, std_serial_dev_close,
|
||||
sdi->conn, LOG_PREFIX);
|
||||
}
|
||||
|
||||
|
@ -307,7 +294,7 @@ SR_PRIV struct sr_dev_driver ID##_driver_info = { \
|
|||
.config_set = config_set, \
|
||||
.config_list = config_list, \
|
||||
.dev_open = dev_open, \
|
||||
.dev_close = dev_close, \
|
||||
.dev_close = std_serial_dev_close, \
|
||||
.dev_acquisition_start = dev_acquisition_start_##ID_UPPER, \
|
||||
.dev_acquisition_stop = dev_acquisition_stop, \
|
||||
.priv = NULL, \
|
||||
|
|
|
@ -183,14 +183,9 @@ static int dev_open(struct sr_dev_inst *sdi)
|
|||
|
||||
static int dev_close(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct sr_serial_dev_inst *serial;
|
||||
struct dev_context *devc;
|
||||
|
||||
serial = sdi->conn;
|
||||
if (serial && serial->fd != -1) {
|
||||
serial_close(serial);
|
||||
sdi->status = SR_ST_INACTIVE;
|
||||
}
|
||||
std_serial_dev_close(sdi);
|
||||
|
||||
/* Free dynamically allocated resources. */
|
||||
if ((devc = sdi->priv) && devc->version) {
|
||||
|
|
|
@ -222,19 +222,6 @@ static int dev_open(struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int dev_close(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct sr_serial_dev_inst *serial;
|
||||
|
||||
serial = sdi->conn;
|
||||
if (serial && serial->fd != -1) {
|
||||
serial_close(serial);
|
||||
sdi->status = SR_ST_INACTIVE;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int cleanup(void)
|
||||
{
|
||||
return dev_clear();
|
||||
|
@ -564,7 +551,7 @@ SR_PRIV struct sr_dev_driver ols_driver_info = {
|
|||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = dev_open,
|
||||
.dev_close = dev_close,
|
||||
.dev_close = std_serial_dev_close,
|
||||
.dev_acquisition_start = dev_acquisition_start,
|
||||
.dev_acquisition_stop = dev_acquisition_stop,
|
||||
.priv = NULL,
|
||||
|
|
|
@ -393,19 +393,6 @@ static int dev_open(struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int dev_close(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct sr_serial_dev_inst *serial;
|
||||
|
||||
serial = sdi->conn;
|
||||
if (serial && serial->fd != -1) {
|
||||
serial_close(serial);
|
||||
sdi->status = SR_ST_INACTIVE;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int cleanup(int dmm)
|
||||
{
|
||||
return dev_clear(dmm);
|
||||
|
@ -503,7 +490,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi,
|
|||
|
||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
|
||||
{
|
||||
return std_dev_acquisition_stop_serial(sdi, cb_data, dev_close,
|
||||
return std_dev_acquisition_stop_serial(sdi, cb_data, std_serial_dev_close,
|
||||
sdi->conn, LOG_PREFIX);
|
||||
}
|
||||
|
||||
|
@ -543,7 +530,7 @@ SR_PRIV struct sr_dev_driver ID##_driver_info = { \
|
|||
.config_set = config_set, \
|
||||
.config_list = config_list, \
|
||||
.dev_open = dev_open, \
|
||||
.dev_close = dev_close, \
|
||||
.dev_close = std_serial_dev_close, \
|
||||
.dev_acquisition_start = dev_acquisition_start_##ID_UPPER, \
|
||||
.dev_acquisition_stop = dev_acquisition_stop, \
|
||||
.priv = NULL, \
|
||||
|
|
|
@ -186,18 +186,6 @@ static int dev_open(struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int dev_close(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct sr_serial_dev_inst *serial = sdi->conn;
|
||||
|
||||
if (serial && serial->fd != -1) {
|
||||
serial_close(serial);
|
||||
sdi->status = SR_ST_INACTIVE;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int cleanup(void)
|
||||
{
|
||||
return dev_clear();
|
||||
|
@ -290,7 +278,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
|
|||
|
||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
|
||||
{
|
||||
return std_dev_acquisition_stop_serial(sdi, cb_data, dev_close,
|
||||
return std_dev_acquisition_stop_serial(sdi, cb_data, std_serial_dev_close,
|
||||
sdi->conn, LOG_PREFIX);
|
||||
}
|
||||
|
||||
|
@ -306,7 +294,7 @@ SR_PRIV struct sr_dev_driver teleinfo_driver_info = {
|
|||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = dev_open,
|
||||
.dev_close = dev_close,
|
||||
.dev_close = std_serial_dev_close,
|
||||
.dev_acquisition_start = dev_acquisition_start,
|
||||
.dev_acquisition_stop = dev_acquisition_stop,
|
||||
};
|
||||
|
|
|
@ -141,19 +141,6 @@ static int dev_open(struct sr_dev_inst *sdi)
|
|||
return SR_OK;
|
||||
}
|
||||
|
||||
static int dev_close(struct sr_dev_inst *sdi)
|
||||
{
|
||||
struct sr_serial_dev_inst *serial;
|
||||
|
||||
serial = sdi->conn;
|
||||
if (serial && serial->fd != -1) {
|
||||
serial_close(serial);
|
||||
sdi->status = SR_ST_INACTIVE;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
static int cleanup(void)
|
||||
{
|
||||
return dev_clear();
|
||||
|
@ -231,7 +218,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi,
|
|||
|
||||
static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
|
||||
{
|
||||
return std_dev_acquisition_stop_serial(sdi, cb_data, dev_close,
|
||||
return std_dev_acquisition_stop_serial(sdi, cb_data, std_serial_dev_close,
|
||||
sdi->conn, LOG_PREFIX);
|
||||
}
|
||||
|
||||
|
@ -248,7 +235,7 @@ SR_PRIV struct sr_dev_driver tondaj_sl_814_driver_info = {
|
|||
.config_set = config_set,
|
||||
.config_list = config_list,
|
||||
.dev_open = dev_open,
|
||||
.dev_close = dev_close,
|
||||
.dev_close = std_serial_dev_close,
|
||||
.dev_acquisition_start = dev_acquisition_start,
|
||||
.dev_acquisition_stop = dev_acquisition_stop,
|
||||
.priv = NULL,
|
||||
|
|
Loading…
Reference in New Issue