]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/link-mso19/api.c
Introduce standard cleanup helper
[libsigrok.git] / src / hardware / link-mso19 / api.c
index 8b4ccc7fd43c6bea97a2a079b01388642c5f7209..5107d309f0d15ec172fa36ec60a0db0ac71199ab 100644 (file)
@@ -19,6 +19,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include "protocol.h"
 
 static const uint32_t devopts[] = {
@@ -263,11 +264,6 @@ static int dev_open(struct sr_dev_inst *sdi)
        return SR_OK;
 }
 
-static int cleanup(const struct sr_dev_driver *di)
-{
-       return dev_clear();
-}
-
 static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
                const struct sr_channel_group *cg)
 {
@@ -390,7 +386,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
        return SR_OK;
 }
 
-static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
        int ret = SR_ERR;
@@ -445,23 +441,20 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
        /* Reset trigger state. */
        devc->trigger_state = 0x00;
 
-       /* Send header packet to the session bus. */
-       std_session_send_df_header(cb_data, LOG_PREFIX);
+       std_session_send_df_header(sdi, LOG_PREFIX);
 
        /* Our first channel is analog, the other 8 are of type 'logic'. */
        /* TODO. */
 
        serial_source_add(sdi->session, devc->serial, G_IO_IN, -1,
-                       mso_receive_data, cb_data);
+                       mso_receive_data, sdi);
 
        return SR_OK;
 }
 
 /* This stops acquisition on ALL devices, ignoring dev_index. */
-static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
+static int dev_acquisition_stop(struct sr_dev_inst *sdi)
 {
-       (void)cb_data;
-
        stop_acquisition(sdi);
 
        return SR_OK;
@@ -472,7 +465,7 @@ SR_PRIV struct sr_dev_driver link_mso19_driver_info = {
        .longname = "Link Instruments MSO-19",
        .api_version = 1,
        .init = init,
-       .cleanup = cleanup,
+       .cleanup = std_cleanup,
        .scan = scan,
        .dev_list = dev_list,
        .dev_clear = dev_clear,