]> sigrok.org Git - libsigrok.git/commitdiff
std_serial_dev_acquisition_stop(): Remove serial parameter
authorLars-Peter Clausen <redacted>
Sat, 28 May 2016 11:41:03 +0000 (13:41 +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 sdi->conn
for the serial parameter. And the other std_serial helper functions already
require that the conn field of the sr_driver_inst passed to the functions
points to the sr_serial_dev_inst associated with the device.

Modify std_serial_dev_acquisition_stop() to follow the same pattern and
remove the serial parameter. 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 0cfb1ef07a337a85535e9cf08f316709edf82da2..bfd22424413942d080d898bab8cd1593d39ab5c0 100644 (file)
@@ -210,8 +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,
-                       sdi->conn);
+       return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close);
 }
 
 static struct sr_dev_driver agdmm_driver_info = {
index 4f1233e4f5e6b8b3dbc5e5129bcbf1198c7f366f..9e4dec62282aba3991713fc13c3556d9690b4fe3 100644 (file)
@@ -218,7 +218,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, sdi->conn);
+                       std_serial_dev_close);
 }
 
 static struct sr_dev_driver appa_55ii_driver_info = {
index 533be9269d8e92909291e29c2661cdd7aa2609b5..49d39086aed09e070c28451e322fd98cd6edf730 100644 (file)
@@ -338,7 +338,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, sdi->conn);
+               std_serial_dev_close);
 }
 
 static struct sr_dev_driver arachnid_labs_re_load_pro_driver_info = {
index 8dc7a160326b8da6a1ed40d506c7e3075aa71312..cb7f875ab2ed271de476cf862f71916a9f0c6e56 100644 (file)
@@ -178,8 +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,
-                       sdi->conn);
+       return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close);
 }
 
 static struct sr_dev_driver brymen_bm857_driver_info = {
index 37aa9bf069ff2605179bd272ede0ca9ef868b01d..f7769b0884324b41d8df06d1424113653dd5a538 100644 (file)
@@ -369,8 +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,
-                       sdi->conn);
+       return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close);
 }
 
 static struct sr_dev_driver cem_dt_885x_driver_info = {
index f5be8a8329997a89ed8643f3e92e43710576cc9a..98d0d40e5c21235955ba527f9ed2363e7787f9a0 100644 (file)
@@ -186,7 +186,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, sdi->conn);
+                       std_serial_dev_close);
 }
 
 /* Driver-specific API function wrappers */
index 3ed4c85a56c54b897ab93ec70b611b4a5261033e..59481dfab92eacabd8d4f5f2cc479f9884e6311d 100644 (file)
@@ -139,8 +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,
-                       sdi->conn);
+       return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close);
 }
 
 static struct sr_dev_driver colead_slm_driver_info = {
index f9683e6a68cce25680eb595810a790c088e5e2f9..a03699713470f4b591d4f30919bdbf0ce03e6f01 100644 (file)
@@ -246,8 +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,
-                       sdi->conn);
+       return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close);
 }
 
 static struct sr_dev_driver flukedmm_driver_info = {
index a2688eeeb4eb1c4fe3f5caccdae416b1643de868..00789d45e6c5b2e43c0cfccce895f907889fb765 100644 (file)
@@ -470,8 +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,
-                       sdi->conn);
+       return std_serial_dev_acquisition_stop(sdi, dev_close);
 }
 
 static struct sr_dev_driver gmc_mh_1x_2x_rs232_driver_info = {
index 1af8362aeb9ebd1673cfe2eebcdcbf10a89ce6f7..584702dacb9e3f457b65d995dcb3a396b03985c3 100644 (file)
@@ -176,8 +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,
-                       sdi->conn);
+       return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close);
 }
 
 #define SCALE(ID, CHIPSET, VENDOR, MODEL, CONN, BAUDRATE, PACKETSIZE, \
index 82a75376f63b1f262f2968fc032327e2aa6ee571..dbff9dbb611be3a9a8caf750f6cc15bfd5286aff 100644 (file)
@@ -366,7 +366,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
                return SR_ERR_DEV_CLOSED;
 
        return std_serial_dev_acquisition_stop(sdi,
-               std_serial_dev_close, sdi->conn);
+               std_serial_dev_close);
 }
 
 static struct sr_dev_driver korad_kaxxxxp_driver_info = {
index c7394e361beeb531960159511802de1c8f4689b1..f22d733461001689c268ec485d1131439d7edd06 100644 (file)
@@ -372,7 +372,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, sdi->conn);
+                       std_serial_dev_close);
 }
 
 static struct sr_dev_driver manson_hcs_3xxx_driver_info = {
index 510dbb819e7dd2a6d2003b6e314317a02aba4aa7..40a6bc3d186f3bdec9deb1268e0fa8ed152812b8 100644 (file)
@@ -197,8 +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,
-                       sdi->conn);
+       return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close);
 }
 
 /* Driver-specific API function wrappers */
index 59061530af4b0ffbe3c67d96a63519ae1bdc2ee0..c5e7b61771628425c003d2f863dd9c322c0981be 100644 (file)
@@ -782,8 +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,
-                       sdi->conn);
+       return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close);
 }
 
 static struct sr_dev_driver motech_lps_301_driver_info = {
index 0fcfff8fb5416ea86550a26c657840d8e058c0a3..1ff354c417db7675d19e45379443dd61b95945ba 100644 (file)
@@ -221,8 +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,
-                       sdi->conn);
+       return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close);
 }
 
 static struct sr_dev_driver norma_dmm_driver_info = {
index e53723c7873cdfb285dc2acb674f1ef9ce293149..77d885ee4fe86f93e8cfda77ca4277d4cff9d823 100644 (file)
@@ -321,8 +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,
-                       sdi->conn);
+       return std_serial_dev_acquisition_stop(sdi, dev_close);
 }
 
 static struct sr_dev_driver pce_322a_driver_info = {
index 7cd444fb188ec72d44dbf92aa60f20316aeb5ae9..650aaf245e3875444f566cc35c43c518344acbe6 100644 (file)
@@ -197,8 +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,
-                       sdi->conn);
+       return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close);
 }
 
 #define DMM(ID, CHIPSET, VENDOR, MODEL, CONN, BAUDRATE, PACKETSIZE, TIMEOUT, \
index d234bb10bba8ce1282c495671a1e7c221a42f03d..a1461f837ca90250b025a029d4feea9979f3f2c5 100644 (file)
@@ -182,7 +182,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, sdi->conn);
+                       std_serial_dev_close);
 }
 
 static struct sr_dev_driver teleinfo_driver_info = {
index d2ef328863a6a29be7a670d96101d1929e47ac49..ad03350fa9535102974973d6a71e3cdb4b339d6c 100644 (file)
@@ -151,8 +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,
-                       sdi->conn);
+       return std_serial_dev_acquisition_stop(sdi, std_serial_dev_close);
 }
 
 static struct sr_dev_driver tondaj_sl_814_driver_info = {
index d4b802dba9bed0b88f20dbde4e428b3f60add167..7c084f7f19287bd5192ba0d953f94634bba63947 100644 (file)
@@ -927,5 +927,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, sdi->conn);
+                       std_serial_dev_close);
 }
index 2ffffd3d59e260440da8a21c02a8c2f469d3a9c8..49629d656835806c65c2cf03b5d6667790cad387 100644 (file)
@@ -927,8 +927,7 @@ 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,
-               struct sr_serial_dev_inst *serial);
+               dev_close_callback dev_close_fn);
 #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 70632319ef149fcde245b3a386a0126424c86927..218f8f3f2f9490a735801125aecf4ecc97a37739 100644 (file)
--- a/src/std.c
+++ b/src/std.c
@@ -206,8 +206,6 @@ SR_PRIV int std_serial_dev_close(struct sr_dev_inst *sdi)
  * @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.
- * @param serial The serial device instance (struct serial_dev_inst *).
- *               Must not be NULL.
  *
  * @retval SR_OK Success.
  * @retval SR_ERR_ARG Invalid arguments.
@@ -215,9 +213,9 @@ SR_PRIV int std_serial_dev_close(struct sr_dev_inst *sdi)
  * @retval SR_ERR Other errors.
  */
 SR_PRIV int std_serial_dev_acquisition_stop(struct sr_dev_inst *sdi,
-                       dev_close_callback dev_close_fn,
-                       struct sr_serial_dev_inst *serial)
+                       dev_close_callback dev_close_fn)
 {
+       struct sr_serial_dev_inst *serial = sdi->conn;
        const char *prefix = sdi->driver->name;
        int ret;