From: Lars-Peter Clausen Date: Sat, 28 May 2016 11:41:03 +0000 (+0200) Subject: std_serial_dev_acquisition_stop(): Remove serial parameter X-Git-Tag: libsigrok-0.5.0~355 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=15f96409dc54fd2ef784c59156daedd9acfa78ed;p=libsigrok.git std_serial_dev_acquisition_stop(): Remove serial parameter 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 --- diff --git a/src/hardware/agilent-dmm/api.c b/src/hardware/agilent-dmm/api.c index 0cfb1ef0..bfd22424 100644 --- a/src/hardware/agilent-dmm/api.c +++ b/src/hardware/agilent-dmm/api.c @@ -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 = { diff --git a/src/hardware/appa-55ii/api.c b/src/hardware/appa-55ii/api.c index 4f1233e4..9e4dec62 100644 --- a/src/hardware/appa-55ii/api.c +++ b/src/hardware/appa-55ii/api.c @@ -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 = { diff --git a/src/hardware/arachnid-labs-re-load-pro/api.c b/src/hardware/arachnid-labs-re-load-pro/api.c index 533be926..49d39086 100644 --- a/src/hardware/arachnid-labs-re-load-pro/api.c +++ b/src/hardware/arachnid-labs-re-load-pro/api.c @@ -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 = { diff --git a/src/hardware/brymen-dmm/api.c b/src/hardware/brymen-dmm/api.c index 8dc7a160..cb7f875a 100644 --- a/src/hardware/brymen-dmm/api.c +++ b/src/hardware/brymen-dmm/api.c @@ -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 = { diff --git a/src/hardware/cem-dt-885x/api.c b/src/hardware/cem-dt-885x/api.c index 37aa9bf0..f7769b08 100644 --- a/src/hardware/cem-dt-885x/api.c +++ b/src/hardware/cem-dt-885x/api.c @@ -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 = { diff --git a/src/hardware/center-3xx/api.c b/src/hardware/center-3xx/api.c index f5be8a83..98d0d40e 100644 --- a/src/hardware/center-3xx/api.c +++ b/src/hardware/center-3xx/api.c @@ -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 */ diff --git a/src/hardware/colead-slm/api.c b/src/hardware/colead-slm/api.c index 3ed4c85a..59481dfa 100644 --- a/src/hardware/colead-slm/api.c +++ b/src/hardware/colead-slm/api.c @@ -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 = { diff --git a/src/hardware/fluke-dmm/api.c b/src/hardware/fluke-dmm/api.c index f9683e6a..a0369971 100644 --- a/src/hardware/fluke-dmm/api.c +++ b/src/hardware/fluke-dmm/api.c @@ -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 = { diff --git a/src/hardware/gmc-mh-1x-2x/api.c b/src/hardware/gmc-mh-1x-2x/api.c index a2688eee..00789d45 100644 --- a/src/hardware/gmc-mh-1x-2x/api.c +++ b/src/hardware/gmc-mh-1x-2x/api.c @@ -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 = { diff --git a/src/hardware/kern-scale/api.c b/src/hardware/kern-scale/api.c index 1af8362a..584702da 100644 --- a/src/hardware/kern-scale/api.c +++ b/src/hardware/kern-scale/api.c @@ -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, \ diff --git a/src/hardware/korad-kaxxxxp/api.c b/src/hardware/korad-kaxxxxp/api.c index 82a75376..dbff9dbb 100644 --- a/src/hardware/korad-kaxxxxp/api.c +++ b/src/hardware/korad-kaxxxxp/api.c @@ -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 = { diff --git a/src/hardware/manson-hcs-3xxx/api.c b/src/hardware/manson-hcs-3xxx/api.c index c7394e36..f22d7334 100644 --- a/src/hardware/manson-hcs-3xxx/api.c +++ b/src/hardware/manson-hcs-3xxx/api.c @@ -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 = { diff --git a/src/hardware/mic-985xx/api.c b/src/hardware/mic-985xx/api.c index 510dbb81..40a6bc3d 100644 --- a/src/hardware/mic-985xx/api.c +++ b/src/hardware/mic-985xx/api.c @@ -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 */ diff --git a/src/hardware/motech-lps-30x/api.c b/src/hardware/motech-lps-30x/api.c index 59061530..c5e7b617 100644 --- a/src/hardware/motech-lps-30x/api.c +++ b/src/hardware/motech-lps-30x/api.c @@ -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 = { diff --git a/src/hardware/norma-dmm/api.c b/src/hardware/norma-dmm/api.c index 0fcfff8f..1ff354c4 100644 --- a/src/hardware/norma-dmm/api.c +++ b/src/hardware/norma-dmm/api.c @@ -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 = { diff --git a/src/hardware/pce-322a/api.c b/src/hardware/pce-322a/api.c index e53723c7..77d885ee 100644 --- a/src/hardware/pce-322a/api.c +++ b/src/hardware/pce-322a/api.c @@ -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 = { diff --git a/src/hardware/serial-dmm/api.c b/src/hardware/serial-dmm/api.c index 7cd444fb..650aaf24 100644 --- a/src/hardware/serial-dmm/api.c +++ b/src/hardware/serial-dmm/api.c @@ -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, \ diff --git a/src/hardware/teleinfo/api.c b/src/hardware/teleinfo/api.c index d234bb10..a1461f83 100644 --- a/src/hardware/teleinfo/api.c +++ b/src/hardware/teleinfo/api.c @@ -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 = { diff --git a/src/hardware/tondaj-sl-814/api.c b/src/hardware/tondaj-sl-814/api.c index d2ef3288..ad03350f 100644 --- a/src/hardware/tondaj-sl-814/api.c +++ b/src/hardware/tondaj-sl-814/api.c @@ -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 = { diff --git a/src/lcr/es51919.c b/src/lcr/es51919.c index d4b802db..7c084f7f 100644 --- a/src/lcr/es51919.c +++ b/src/lcr/es51919.c @@ -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); } diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h index 2ffffd3d..49629d65 100644 --- a/src/libsigrok-internal.h +++ b/src/libsigrok-internal.h @@ -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); diff --git a/src/std.c b/src/std.c index 70632319..218f8f3f 100644 --- 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;