]> sigrok.org Git - libsigrok.git/commitdiff
std_serial_dev_acquisition_stop(): Remove dev_close_fn parameter
authorLars-Peter Clausen <redacted>
Sat, 28 May 2016 11:54:08 +0000 (13:54 +0200)
committerUwe Hermann <redacted>
Tue, 31 May 2016 13:54:52 +0000 (15:54 +0200)
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 <redacted>
22 files changed:
src/hardware/agilent-dmm/api.c
src/hardware/appa-55ii/api.c
src/hardware/arachnid-labs-re-load-pro/api.c
src/hardware/brymen-dmm/api.c
src/hardware/cem-dt-885x/api.c
src/hardware/center-3xx/api.c
src/hardware/colead-slm/api.c
src/hardware/fluke-dmm/api.c
src/hardware/gmc-mh-1x-2x/api.c
src/hardware/kern-scale/api.c
src/hardware/korad-kaxxxxp/api.c
src/hardware/manson-hcs-3xxx/api.c
src/hardware/mic-985xx/api.c
src/hardware/motech-lps-30x/api.c
src/hardware/norma-dmm/api.c
src/hardware/pce-322a/api.c
src/hardware/serial-dmm/api.c
src/hardware/teleinfo/api.c
src/hardware/tondaj-sl-814/api.c
src/lcr/es51919.c
src/libsigrok-internal.h
src/std.c

index bfd22424413942d080d898bab8cd1593d39ab5c0..27db616202d4c356dec9fa958ea88cb7ff51a977 100644 (file)
@@ -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 = {
index 9e4dec62282aba3991713fc13c3556d9690b4fe3..ca1ac4014a157edb2e8c223dff896a9c98ced2e7 100644 (file)
@@ -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 = {
index 49d39086aed09e070c28451e322fd98cd6edf730..49db531f65feaeb71f4c9b4cb55df712f7be00ba 100644 (file)
@@ -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 = {
index cb7f875ab2ed271de476cf862f71916a9f0c6e56..d4825362af44785d8b5d3aff1a48a74a74115a41 100644 (file)
@@ -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 = {
index f7769b0884324b41d8df06d1424113653dd5a538..8c649c855b1911d3b3715c02d5050abe8d6dbf07 100644 (file)
@@ -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 = {
index 98d0d40e5c21235955ba527f9ed2363e7787f9a0..c503da665b82539a4d5c892dc1a78a1dcd0d7158 100644 (file)
@@ -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 */
index 59481dfab92eacabd8d4f5f2cc479f9884e6311d..3bfa91a13c48f3e0c6de20ae554edf2ee45195fe 100644 (file)
@@ -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 = {
index a03699713470f4b591d4f30919bdbf0ce03e6f01..423ca309f98ee96e4e60469f4c47b1ebc966d46b 100644 (file)
@@ -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 = {
index 00789d45e6c5b2e43c0cfccce895f907889fb765..6b2508dd76c6f8b5f6f2a304e80ac63501cbfb10 100644 (file)
@@ -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 = {
index 584702dacb9e3f457b65d995dcb3a396b03985c3..ed6c70e880f8c9c8bf0a78a55e075e67f8fdec00 100644 (file)
@@ -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, \
index dbff9dbb611be3a9a8caf750f6cc15bfd5286aff..da6c0de9f0719ab04cadf3c8f12323261c0e6258 100644 (file)
@@ -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 = {
index f22d733461001689c268ec485d1131439d7edd06..d49f6129312790b637d0c002caa70d2f7c75b6ba 100644 (file)
@@ -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 = {
index 40a6bc3d186f3bdec9deb1268e0fa8ed152812b8..4a070bcc0a8c28b38a70ef71f9096145863dfa85 100644 (file)
@@ -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 */
index c5e7b61771628425c003d2f863dd9c322c0981be..1b227e7844b143318caa8bf4ed750fe03b5643b6 100644 (file)
@@ -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 = {
index 1ff354c417db7675d19e45379443dd61b95945ba..a4f33c078baafd968eaa0e68faddcb40129d8c72 100644 (file)
@@ -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 = {
index 77d885ee4fe86f93e8cfda77ca4277d4cff9d823..f40db9e6a5d29303fa4d7dbcc5e9181416a3fe2c 100644 (file)
@@ -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 = {
index 650aaf245e3875444f566cc35c43c518344acbe6..570ec7850c519d3dc6105e8b70ece70298331309 100644 (file)
@@ -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, \
index a1461f837ca90250b025a029d4feea9979f3f2c5..51ea11862a52182d61f9e6fa5bfbdce9013fd533 100644 (file)
@@ -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 = {
index ad03350fa9535102974973d6a71e3cdb4b339d6c..68c02026d36b83f0f1a2146ef284083c04a4cdc9 100644 (file)
@@ -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 = {
index 7c084f7f19287bd5192ba0d953f94634bba63947..ad36461171902320ab0ff19fb2fefea477ef4305 100644 (file)
@@ -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);
 }
index 49629d656835806c65c2cf03b5d6667790cad387..08c9b78823900795098397e4f7056c8f451ae823 100644 (file)
@@ -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);
index 218f8f3f2f9490a735801125aecf4ecc97a37739..7cd2313129456605a970924232b0ec990a8e04a7 100644 (file)
--- 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;
        }