]> sigrok.org Git - libsigrok.git/commitdiff
sysclk-lwla: Remove global driver instance pointer
authorDaniel Elstner <redacted>
Tue, 10 Nov 2015 19:52:09 +0000 (20:52 +0100)
committerUwe Hermann <redacted>
Thu, 26 Nov 2015 20:44:31 +0000 (21:44 +0100)
Obtain the sr_dev_driver pointer from the device instance so that
the remaining references to the global di pointer can be removed.

src/hardware/sysclk-lwla/api.c

index 154d4f9000ee6247fb583f78eee49b93e0febbb5..1b9f1bce44dbc7b772b697f7e3b812d6d2c34d84 100644 (file)
@@ -72,9 +72,6 @@ static const char *const trigger_source_names[] = { "CH", "TRG" };
  */
 static const char *const signal_edge_names[] = { "r", "f" };
 
-SR_PRIV struct sr_dev_driver sysclk_lwla_driver_info;
-static struct sr_dev_driver *const di = &sysclk_lwla_driver_info;
-
 static int init(struct sr_dev_driver *di, struct sr_context *sr_ctx)
 {
        return std_init(sr_ctx, di, LOG_PREFIX);
@@ -187,7 +184,7 @@ static int dev_open(struct sr_dev_inst *sdi)
        struct sr_usb_dev_inst *usb;
        int ret;
 
-       drvc = di->context;
+       drvc = sdi->driver->context;
 
        if (!drvc) {
                sr_err("Driver was not initialized.");
@@ -238,7 +235,7 @@ static int dev_close(struct sr_dev_inst *sdi)
        struct dev_context *devc;
        int ret;
 
-       if (!di->context) {
+       if (!sdi->driver->context) {
                sr_err("Driver was not initialized.");
                return SR_ERR;
        }
@@ -576,7 +573,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
                return SR_ERR_DEV_CLOSED;
 
        devc = sdi->priv;
-       drvc = di->context;
+       drvc = sdi->driver->context;
 
        if (devc->acquisition) {
                sr_err("Acquisition still in progress?");