]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/atten-pps3xxx/api.c
Consistently don't check sdi->priv in dev_acquisition_start().
[libsigrok.git] / src / hardware / atten-pps3xxx / api.c
index 6b178ae9e6f8010ac0bff050a4895607267f2d92..c90ab12d9cdd78878d3059ddf2d51d835b1eb526 100644 (file)
@@ -17,8 +17,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <config.h>
 #include <string.h>
-#include <errno.h>
 #include "protocol.h"
 
 /*
@@ -100,7 +100,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options, int modelid)
        char channel[10];
 
        devices = NULL;
-       drvc = di->priv;
+       drvc = di->context;
        drvc->instances = NULL;
 
        conn = serialcomm = NULL;
@@ -142,7 +142,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options, int modelid)
        memset(packet, 0, PACKET_SIZE);
        if ((ret = serial_read_nonblocking(serial, packet, PACKET_SIZE)) < 0) {
                sr_err("Unable to read while probing for hardware: %s",
-                               strerror(errno));
+                               sr_strerror(ret));
                return NULL;
        }
        if (ret != PACKET_SIZE || packet[0] != 0xaa || packet[1] != 0xaa) {
@@ -201,7 +201,7 @@ static GSList *scan_3203(struct sr_dev_driver *di, GSList *options)
 
 static GSList *dev_list(const struct sr_dev_driver *di)
 {
-       return ((struct drv_context *)(di->priv))->instances;
+       return ((struct drv_context *)(di->context))->instances;
 }
 
 static int cleanup(const struct sr_dev_driver *di)
@@ -460,8 +460,7 @@ static int dev_close(struct sr_dev_inst *sdi)
        return std_serial_dev_close(sdi);
 }
 
-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, void *cb_data)
 {
        struct dev_context *devc;
        struct sr_serial_dev_inst *serial;
@@ -523,5 +522,5 @@ SR_PRIV struct sr_dev_driver atten_pps3203_driver_info = {
        .dev_close = dev_close,
        .dev_acquisition_start = dev_acquisition_start,
        .dev_acquisition_stop = dev_acquisition_stop,
-       .priv = NULL,
+       .context = NULL,
 };