aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2016-05-28 13:54:08 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2016-05-31 15:54:52 +0200
commit1b38775baa3016fb4d613c971dce5a4f26cacb7b (patch)
treee2a72d13cca856cb610a5fa03359bb00898d3d2c
parent15f96409dc54fd2ef784c59156daedd9acfa78ed (diff)
std_serial_dev_acquisition_stop(): Remove dev_close_fn parameter
All callers of std_serial_dev_acquisition_stop() currently pass the same callback for the dev_close_fn parameter as the dev_close callback of their sr_dev_driver struct. Remove the dev_close_fn parameter and invoke the drivers dev_close() callback directly. This simplifies the API and ensures consistent behaviour between different drivers. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
-rw-r--r--src/hardware/agilent-dmm/api.c2
-rw-r--r--src/hardware/appa-55ii/api.c3
-rw-r--r--src/hardware/arachnid-labs-re-load-pro/api.c3
-rw-r--r--src/hardware/brymen-dmm/api.c2
-rw-r--r--src/hardware/cem-dt-885x/api.c2
-rw-r--r--src/hardware/center-3xx/api.c3
-rw-r--r--src/hardware/colead-slm/api.c2
-rw-r--r--src/hardware/fluke-dmm/api.c2
-rw-r--r--src/hardware/gmc-mh-1x-2x/api.c2
-rw-r--r--src/hardware/kern-scale/api.c2
-rw-r--r--src/hardware/korad-kaxxxxp/api.c3
-rw-r--r--src/hardware/manson-hcs-3xxx/api.c3
-rw-r--r--src/hardware/mic-985xx/api.c2
-rw-r--r--src/hardware/motech-lps-30x/api.c2
-rw-r--r--src/hardware/norma-dmm/api.c2
-rw-r--r--src/hardware/pce-322a/api.c2
-rw-r--r--src/hardware/serial-dmm/api.c2
-rw-r--r--src/hardware/teleinfo/api.c3
-rw-r--r--src/hardware/tondaj-sl-814/api.c2
-rw-r--r--src/lcr/es51919.c3
-rw-r--r--src/libsigrok-internal.h3
-rw-r--r--src/std.c8
22 files changed, 23 insertions, 35 deletions
diff --git a/src/hardware/agilent-dmm/api.c b/src/hardware/agilent-dmm/api.c
index bfd2242..27db616 100644
--- a/src/hardware/agilent-dmm/api.c
+++ b/src/hardware/agilent-dmm/api.c
@@ -210,7 +210,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close);
+ return std_serial_dev_acquisition_stop(sdi);
}
static struct sr_dev_driver agdmm_driver_info = {
diff --git a/src/hardware/appa-55ii/api.c b/src/hardware/appa-55ii/api.c
index 9e4dec6..ca1ac40 100644
--- a/src/hardware/appa-55ii/api.c
+++ b/src/hardware/appa-55ii/api.c
@@ -217,8 +217,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- return std_serial_dev_acquisition_stop(sdi,
- std_serial_dev_close);
+ return std_serial_dev_acquisition_stop(sdi);
}
static struct sr_dev_driver appa_55ii_driver_info = {
diff --git a/src/hardware/arachnid-labs-re-load-pro/api.c b/src/hardware/arachnid-labs-re-load-pro/api.c
index 49d3908..49db531 100644
--- a/src/hardware/arachnid-labs-re-load-pro/api.c
+++ b/src/hardware/arachnid-labs-re-load-pro/api.c
@@ -337,8 +337,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- return std_serial_dev_acquisition_stop(sdi,
- std_serial_dev_close);
+ return std_serial_dev_acquisition_stop(sdi);
}
static struct sr_dev_driver arachnid_labs_re_load_pro_driver_info = {
diff --git a/src/hardware/brymen-dmm/api.c b/src/hardware/brymen-dmm/api.c
index cb7f875..d482536 100644
--- a/src/hardware/brymen-dmm/api.c
+++ b/src/hardware/brymen-dmm/api.c
@@ -178,7 +178,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close);
+ return std_serial_dev_acquisition_stop(sdi);
}
static struct sr_dev_driver brymen_bm857_driver_info = {
diff --git a/src/hardware/cem-dt-885x/api.c b/src/hardware/cem-dt-885x/api.c
index f7769b0..8c649c8 100644
--- a/src/hardware/cem-dt-885x/api.c
+++ b/src/hardware/cem-dt-885x/api.c
@@ -369,7 +369,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close);
+ return std_serial_dev_acquisition_stop(sdi);
}
static struct sr_dev_driver cem_dt_885x_driver_info = {
diff --git a/src/hardware/center-3xx/api.c b/src/hardware/center-3xx/api.c
index 98d0d40..c503da6 100644
--- a/src/hardware/center-3xx/api.c
+++ b/src/hardware/center-3xx/api.c
@@ -185,8 +185,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, int idx)
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- return std_serial_dev_acquisition_stop(sdi,
- std_serial_dev_close);
+ return std_serial_dev_acquisition_stop(sdi);
}
/* Driver-specific API function wrappers */
diff --git a/src/hardware/colead-slm/api.c b/src/hardware/colead-slm/api.c
index 59481df..3bfa91a 100644
--- a/src/hardware/colead-slm/api.c
+++ b/src/hardware/colead-slm/api.c
@@ -139,7 +139,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close);
+ return std_serial_dev_acquisition_stop(sdi);
}
static struct sr_dev_driver colead_slm_driver_info = {
diff --git a/src/hardware/fluke-dmm/api.c b/src/hardware/fluke-dmm/api.c
index a036997..423ca30 100644
--- a/src/hardware/fluke-dmm/api.c
+++ b/src/hardware/fluke-dmm/api.c
@@ -246,7 +246,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close);
+ return std_serial_dev_acquisition_stop(sdi);
}
static struct sr_dev_driver flukedmm_driver_info = {
diff --git a/src/hardware/gmc-mh-1x-2x/api.c b/src/hardware/gmc-mh-1x-2x/api.c
index 00789d4..6b2508d 100644
--- a/src/hardware/gmc-mh-1x-2x/api.c
+++ b/src/hardware/gmc-mh-1x-2x/api.c
@@ -470,7 +470,7 @@ static int dev_acquisition_start_2x_bd232(const struct sr_dev_inst *sdi)
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- return std_serial_dev_acquisition_stop(sdi, dev_close);
+ return std_serial_dev_acquisition_stop(sdi);
}
static struct sr_dev_driver gmc_mh_1x_2x_rs232_driver_info = {
diff --git a/src/hardware/kern-scale/api.c b/src/hardware/kern-scale/api.c
index 584702d..ed6c70e 100644
--- a/src/hardware/kern-scale/api.c
+++ b/src/hardware/kern-scale/api.c
@@ -176,7 +176,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close);
+ return std_serial_dev_acquisition_stop(sdi);
}
#define SCALE(ID, CHIPSET, VENDOR, MODEL, CONN, BAUDRATE, PACKETSIZE, \
diff --git a/src/hardware/korad-kaxxxxp/api.c b/src/hardware/korad-kaxxxxp/api.c
index dbff9db..da6c0de 100644
--- a/src/hardware/korad-kaxxxxp/api.c
+++ b/src/hardware/korad-kaxxxxp/api.c
@@ -365,8 +365,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
- return std_serial_dev_acquisition_stop(sdi,
- std_serial_dev_close);
+ return std_serial_dev_acquisition_stop(sdi);
}
static struct sr_dev_driver korad_kaxxxxp_driver_info = {
diff --git a/src/hardware/manson-hcs-3xxx/api.c b/src/hardware/manson-hcs-3xxx/api.c
index f22d733..d49f612 100644
--- a/src/hardware/manson-hcs-3xxx/api.c
+++ b/src/hardware/manson-hcs-3xxx/api.c
@@ -371,8 +371,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- return std_serial_dev_acquisition_stop(sdi,
- std_serial_dev_close);
+ return std_serial_dev_acquisition_stop(sdi);
}
static struct sr_dev_driver manson_hcs_3xxx_driver_info = {
diff --git a/src/hardware/mic-985xx/api.c b/src/hardware/mic-985xx/api.c
index 40a6bc3..4a070bc 100644
--- a/src/hardware/mic-985xx/api.c
+++ b/src/hardware/mic-985xx/api.c
@@ -197,7 +197,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, int idx)
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close);
+ return std_serial_dev_acquisition_stop(sdi);
}
/* Driver-specific API function wrappers */
diff --git a/src/hardware/motech-lps-30x/api.c b/src/hardware/motech-lps-30x/api.c
index c5e7b61..1b227e7 100644
--- a/src/hardware/motech-lps-30x/api.c
+++ b/src/hardware/motech-lps-30x/api.c
@@ -782,7 +782,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close);
+ return std_serial_dev_acquisition_stop(sdi);
}
static struct sr_dev_driver motech_lps_301_driver_info = {
diff --git a/src/hardware/norma-dmm/api.c b/src/hardware/norma-dmm/api.c
index 1ff354c..a4f33c0 100644
--- a/src/hardware/norma-dmm/api.c
+++ b/src/hardware/norma-dmm/api.c
@@ -221,7 +221,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close);
+ return std_serial_dev_acquisition_stop(sdi);
}
static struct sr_dev_driver norma_dmm_driver_info = {
diff --git a/src/hardware/pce-322a/api.c b/src/hardware/pce-322a/api.c
index 77d885e..f40db9e 100644
--- a/src/hardware/pce-322a/api.c
+++ b/src/hardware/pce-322a/api.c
@@ -321,7 +321,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- return std_serial_dev_acquisition_stop(sdi, dev_close);
+ return std_serial_dev_acquisition_stop(sdi);
}
static struct sr_dev_driver pce_322a_driver_info = {
diff --git a/src/hardware/serial-dmm/api.c b/src/hardware/serial-dmm/api.c
index 650aaf2..570ec78 100644
--- a/src/hardware/serial-dmm/api.c
+++ b/src/hardware/serial-dmm/api.c
@@ -197,7 +197,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close);
+ return std_serial_dev_acquisition_stop(sdi);
}
#define DMM(ID, CHIPSET, VENDOR, MODEL, CONN, BAUDRATE, PACKETSIZE, TIMEOUT, \
diff --git a/src/hardware/teleinfo/api.c b/src/hardware/teleinfo/api.c
index a1461f8..51ea118 100644
--- a/src/hardware/teleinfo/api.c
+++ b/src/hardware/teleinfo/api.c
@@ -181,8 +181,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- return std_serial_dev_acquisition_stop(sdi,
- std_serial_dev_close);
+ return std_serial_dev_acquisition_stop(sdi);
}
static struct sr_dev_driver teleinfo_driver_info = {
diff --git a/src/hardware/tondaj-sl-814/api.c b/src/hardware/tondaj-sl-814/api.c
index ad03350..68c0202 100644
--- a/src/hardware/tondaj-sl-814/api.c
+++ b/src/hardware/tondaj-sl-814/api.c
@@ -151,7 +151,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
static int dev_acquisition_stop(struct sr_dev_inst *sdi)
{
- return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close);
+ return std_serial_dev_acquisition_stop(sdi);
}
static struct sr_dev_driver tondaj_sl_814_driver_info = {
diff --git a/src/lcr/es51919.c b/src/lcr/es51919.c
index 7c084f7..ad36461 100644
--- a/src/lcr/es51919.c
+++ b/src/lcr/es51919.c
@@ -926,6 +926,5 @@ SR_PRIV int es51919_serial_acquisition_start(const struct sr_dev_inst *sdi)
SR_PRIV int es51919_serial_acquisition_stop(struct sr_dev_inst *sdi)
{
- return std_serial_dev_acquisition_stop(sdi,
- std_serial_dev_close);
+ return std_serial_dev_acquisition_stop(sdi);
}
diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h
index 49629d6..08c9b78 100644
--- a/src/libsigrok-internal.h
+++ b/src/libsigrok-internal.h
@@ -926,8 +926,7 @@ SR_PRIV int std_init(struct sr_dev_driver *di, struct sr_context *sr_ctx);
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,
- dev_close_callback dev_close_fn);
+SR_PRIV int std_serial_dev_acquisition_stop(struct sr_dev_inst *sdi);
#endif
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);
diff --git a/src/std.c b/src/std.c
index 218f8f3..7cd2313 100644
--- a/src/std.c
+++ b/src/std.c
@@ -203,17 +203,13 @@ SR_PRIV int std_serial_dev_close(struct sr_dev_inst *sdi)
*
* @param sdi The device instance for which acquisition should stop.
* Must not be NULL.
- * @param cb_data Opaque 'cb_data' pointer. Must not be NULL.
- * @param dev_close_fn Function pointer to the driver's dev_close().
- * Must not be NULL.
*
* @retval SR_OK Success.
* @retval SR_ERR_ARG Invalid arguments.
* @retval SR_ERR_DEV_CLOSED Device is closed.
* @retval SR_ERR Other errors.
*/
-SR_PRIV int std_serial_dev_acquisition_stop(struct sr_dev_inst *sdi,
- dev_close_callback dev_close_fn)
+SR_PRIV int std_serial_dev_acquisition_stop(struct sr_dev_inst *sdi)
{
struct sr_serial_dev_inst *serial = sdi->conn;
const char *prefix = sdi->driver->name;
@@ -231,7 +227,7 @@ SR_PRIV int std_serial_dev_acquisition_stop(struct sr_dev_inst *sdi,
return ret;
}
- if ((ret = dev_close_fn(sdi)) < 0) {
+ if ((ret = sdi->driver->dev_close(sdi)) < 0) {
sr_err("%s: Failed to close device: %d.", prefix, ret);
return ret;
}