]> sigrok.org Git - libsigrok.git/blobdiff - session.c
sr: fx2lafw: Add basic support for USBee DX and clones
[libsigrok.git] / session.c
index 0cd4e2000387c8591900e9495a3cc6d1700802e9..92ee648a631c77d41092beb3bf010f00c5537d30 100644 (file)
--- a/session.c
+++ b/session.c
@@ -88,7 +88,7 @@ SR_API int sr_session_destroy(void)
 
 static void sr_dev_close(struct sr_dev *dev)
 {
-       if (dev->driver->dev_close)
+       if (dev && dev->driver && dev->driver->dev_close)
                dev->driver->dev_close(dev->driver_index);
 }
 
@@ -321,22 +321,15 @@ SR_API int sr_session_run(void)
 /**
  * Halt the current session.
  *
- * This requests the current session be stopped as soon as possible, for
- * example on receiving an SR_DF_END packet.
+ * This function is deprecated and should not be used in new code, use
+ * sr_session_stop() instead. The behaviour of this function is identical to
+ * sr_session_stop().
  *
  * @return SR_OK upon success, SR_ERR_BUG if no session exists.
  */
 SR_API int sr_session_halt(void)
 {
-       if (!session) {
-               sr_err("session: %s: session was NULL", __func__);
-               return SR_ERR_BUG;
-       }
-
-       sr_info("session: halting");
-       session->running = FALSE;
-
-       return SR_OK;
+       return sr_session_stop();
 }
 
 /**
@@ -366,8 +359,6 @@ SR_API int sr_session_stop(void)
                if (dev->driver) {
                        if (dev->driver->dev_acquisition_stop)
                                dev->driver->dev_acquisition_stop(dev->driver_index, dev);
-                       if (dev->driver->cleanup)
-                               dev->driver->cleanup();
                }
        }