From: Uwe Hermann Date: Mon, 17 Dec 2012 23:52:39 +0000 (+0100) Subject: Consistently use 'di' as variable name. X-Git-Tag: dsupstream~436 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=a873c5940cc6d2d8f54f2dfdac3a98c4a3d302ee;p=libsigrok.git Consistently use 'di' as variable name. Use 'di' consistently in all drivers as the name for a local, static pointer to the respective driver's 'struct sr_dev_driver'. --- diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c index ed263acb..7ae16bc9 100644 --- a/hardware/asix-sigma/asix-sigma.c +++ b/hardware/asix-sigma/asix-sigma.c @@ -41,7 +41,7 @@ #define NUM_PROBES 16 SR_PRIV struct sr_dev_driver asix_sigma_driver_info; -static struct sr_dev_driver *adi = &asix_sigma_driver_info; +static struct sr_dev_driver *di = &asix_sigma_driver_info; static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data); static const uint64_t supported_samplerates[] = { @@ -411,7 +411,7 @@ static int clear_instances(void) struct drv_context *drvc; struct dev_context *devc; - drvc = adi->priv; + drvc = di->priv; /* Properly close all devices. */ for (l = drvc->instances; l; l = l->next) { @@ -441,7 +441,7 @@ static int hw_init(struct sr_context *sr_ctx) return SR_ERR_MALLOC; } drvc->sr_ctx = sr_ctx; - adi->priv = drvc; + di->priv = drvc; return SR_OK; } @@ -460,7 +460,7 @@ static GSList *hw_scan(GSList *options) (void)options; - drvc = adi->priv; + drvc = di->priv; devices = NULL; clear_instances(); @@ -508,7 +508,7 @@ static GSList *hw_scan(GSList *options) sr_err("%s: sdi was NULL", __func__); goto free; } - sdi->driver = adi; + sdi->driver = di; for (i = 0; probe_names[i]; i++) { if (!(probe = sr_probe_new(i, SR_PROBE_LOGIC, TRUE, @@ -536,7 +536,7 @@ static GSList *hw_dev_list(void) { struct drv_context *drvc; - drvc = adi->priv; + drvc = di->priv; return drvc->instances; } @@ -791,7 +791,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi) static int hw_cleanup(void) { - if (!adi->priv) + if (!di->priv) return SR_OK; clear_instances(); diff --git a/hardware/demo/demo.c b/hardware/demo/demo.c index 68fda728..aac585a2 100644 --- a/hardware/demo/demo.c +++ b/hardware/demo/demo.c @@ -138,7 +138,7 @@ static uint8_t pattern_sigrok[] = { /* List of struct sr_dev_inst, maintained by dev_open()/dev_close(). */ SR_PRIV struct sr_dev_driver demo_driver_info; -static struct sr_dev_driver *ddi = &demo_driver_info; +static struct sr_dev_driver *di = &demo_driver_info; static uint64_t cur_samplerate = SR_KHZ(200); static uint64_t limit_samples = 0; static uint64_t limit_msec = 0; @@ -162,7 +162,7 @@ static int hw_init(struct sr_context *sr_ctx) return SR_ERR_MALLOC; } drvc->sr_ctx = sr_ctx; - ddi->priv = drvc; + di->priv = drvc; return SR_OK; } @@ -177,7 +177,7 @@ static GSList *hw_scan(GSList *options) (void)options; - drvc = ddi->priv; + drvc = di->priv; devices = NULL; sdi = sr_dev_inst_new(0, SR_ST_ACTIVE, DEMONAME, NULL, NULL); @@ -185,7 +185,7 @@ static GSList *hw_scan(GSList *options) sr_err("%s: sr_dev_inst_new failed", __func__); return 0; } - sdi->driver = ddi; + sdi->driver = di; for (i = 0; probe_names[i]; i++) { if (!(probe = sr_probe_new(i, SR_PROBE_LOGIC, TRUE, @@ -204,7 +204,7 @@ static GSList *hw_dev_list(void) { struct drv_context *drvc; - drvc = ddi->priv; + drvc = di->priv; return drvc->instances; } diff --git a/hardware/fx2lafw/fx2lafw.c b/hardware/fx2lafw/fx2lafw.c index 22fff927..8aba386c 100644 --- a/hardware/fx2lafw/fx2lafw.c +++ b/hardware/fx2lafw/fx2lafw.c @@ -139,7 +139,7 @@ static const struct sr_samplerates samplerates = { }; SR_PRIV struct sr_dev_driver fx2lafw_driver_info; -static struct sr_dev_driver *fdi = &fx2lafw_driver_info; +static struct sr_dev_driver *di = &fx2lafw_driver_info; static int hw_dev_close(struct sr_dev_inst *sdi); static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, const void *value); @@ -194,7 +194,7 @@ static int fx2lafw_dev_open(struct sr_dev_inst *sdi) libusb_device **devlist; struct libusb_device_descriptor des; struct dev_context *devc; - struct drv_context *drvc = fdi->priv; + struct drv_context *drvc = di->priv; struct version_info vi; int ret, skip, i; uint8_t revid; @@ -368,7 +368,7 @@ static int clear_instances(void) struct dev_context *devc; int ret; - drvc = fdi->priv; + drvc = di->priv; ret = SR_OK; for (l = drvc->instances; l; l = l->next) { if (!(sdi = l->data)) { @@ -412,7 +412,7 @@ static int hw_init(struct sr_context *sr_ctx) } drvc->sr_ctx = sr_ctx; - fdi->priv = drvc; + di->priv = drvc; return SR_OK; } @@ -431,7 +431,7 @@ static GSList *hw_scan(GSList *options) (void)options; - drvc = fdi->priv; + drvc = di->priv; /* This scan always invalidates any previous scans. */ clear_instances(); @@ -465,7 +465,7 @@ static GSList *hw_scan(GSList *options) prof->vendor, prof->model, prof->model_version); if (!sdi) return NULL; - sdi->driver = fdi; + sdi->driver = di; /* Fill in probelist according to this device's profile. */ num_logic_probes = prof->dev_caps & DEV_CAPS_16BIT ? 16 : 8; @@ -510,7 +510,7 @@ static GSList *hw_dev_list(void) { struct drv_context *drvc; - drvc = fdi->priv; + drvc = di->priv; return drvc->instances; } @@ -614,13 +614,13 @@ static int hw_cleanup(void) struct drv_context *drvc; int ret; - if (!(drvc = fdi->priv)) + if (!(drvc = di->priv)) return SR_OK; ret = clear_instances(); g_free(drvc); - fdi->priv = NULL; + di->priv = NULL; return ret; } @@ -690,7 +690,7 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap, static int receive_data(int fd, int revents, void *cb_data) { struct timeval tv; - struct drv_context *drvc = fdi->priv; + struct drv_context *drvc = di->priv; (void)fd; (void)revents; @@ -717,7 +717,7 @@ static void abort_acquisition(struct dev_context *devc) static void finish_acquisition(struct dev_context *devc) { struct sr_datafeed_packet packet; - struct drv_context *drvc = fdi->priv; + struct drv_context *drvc = di->priv; int i; @@ -956,7 +956,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, struct sr_datafeed_header header; struct sr_datafeed_meta_logic meta; struct dev_context *devc; - struct drv_context *drvc = fdi->priv; + struct drv_context *drvc = di->priv; struct libusb_transfer *transfer; const struct libusb_pollfd **lupfd; unsigned int i; diff --git a/hardware/hantek-dso/api.c b/hardware/hantek-dso/api.c index 01a08001..a617e551 100644 --- a/hardware/hantek-dso/api.c +++ b/hardware/hantek-dso/api.c @@ -143,7 +143,7 @@ static const char *coupling[] = { }; SR_PRIV struct sr_dev_driver hantek_dso_driver_info; -static struct sr_dev_driver *hdi = &hantek_dso_driver_info; +static struct sr_dev_driver *di = &hantek_dso_driver_info; static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data); @@ -159,7 +159,7 @@ static struct sr_dev_inst *dso_dev_new(int index, const struct dso_profile *prof prof->vendor, prof->model, NULL); if (!sdi) return NULL; - sdi->driver = hdi; + sdi->driver = di; /* * Add only the real probes -- EXT isn't a source of data, only @@ -194,7 +194,7 @@ static struct sr_dev_inst *dso_dev_new(int index, const struct dso_profile *prof devc->triggersource = g_strdup(DEFAULT_TRIGGER_SOURCE); devc->triggerposition = DEFAULT_HORIZ_TRIGGERPOS; sdi->priv = devc; - drvc = hdi->priv; + drvc = di->priv; drvc->instances = g_slist_append(drvc->instances, sdi); return sdi; @@ -228,7 +228,7 @@ static int clear_instances(void) struct dev_context *devc; GSList *l; - drvc = hdi->priv; + drvc = di->priv; for (l = drvc->instances; l; l = l->next) { if (!(sdi = l->data)) { /* Log error, but continue cleaning up the rest. */ @@ -263,7 +263,7 @@ static int hw_init(struct sr_context *sr_ctx) } drvc->sr_ctx = sr_ctx; - hdi->priv = drvc; + di->priv = drvc; return SR_OK; } @@ -283,7 +283,7 @@ static GSList *hw_scan(GSList *options) devcnt = 0; devices = 0; - drvc = hdi->priv; + drvc = di->priv; drvc->instances = NULL; clear_instances(); @@ -348,7 +348,7 @@ static GSList *hw_dev_list(void) { struct drv_context *drvc; - drvc = hdi->priv; + drvc = di->priv; return drvc->instances; } @@ -410,7 +410,7 @@ static int hw_cleanup(void) { struct drv_context *drvc; - if (!(drvc = hdi->priv)) + if (!(drvc = di->priv)) return SR_OK; clear_instances(); @@ -734,7 +734,7 @@ static int handle_event(int fd, int revents, void *cb_data) struct sr_datafeed_packet packet; struct timeval tv; struct dev_context *devc; - struct drv_context *drvc = hdi->priv; + struct drv_context *drvc = di->priv; const struct libusb_pollfd **lupfd; int num_probes, i; uint32_t trigger_offset; @@ -851,7 +851,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, struct sr_datafeed_header header; struct sr_datafeed_meta_analog meta; struct dev_context *devc; - struct drv_context *drvc = hdi->priv; + struct drv_context *drvc = di->priv; int i; if (sdi->status != SR_ST_ACTIVE) diff --git a/hardware/openbench-logic-sniffer/ols.c b/hardware/openbench-logic-sniffer/ols.c index 23104cfd..94fc4b7e 100644 --- a/hardware/openbench-logic-sniffer/ols.c +++ b/hardware/openbench-logic-sniffer/ols.c @@ -99,7 +99,7 @@ static const struct sr_samplerates samplerates = { }; SR_PRIV struct sr_dev_driver ols_driver_info; -static struct sr_dev_driver *odi = &ols_driver_info; +static struct sr_dev_driver *di = &ols_driver_info; static int send_shortcommand(struct sr_serial_dev_inst *serial, uint8_t command) @@ -236,7 +236,7 @@ static struct sr_dev_inst *get_metadata(struct sr_serial_dev_inst *serial) guchar tmp_c; sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, NULL, NULL, NULL); - sdi->driver = odi; + sdi->driver = di; devc = ols_dev_new(); sdi->priv = devc; @@ -371,7 +371,7 @@ static int hw_init(struct sr_context *sr_ctx) return SR_ERR_MALLOC; } drvc->sr_ctx = sr_ctx; - odi->priv = drvc; + di->priv = drvc; return SR_OK; } @@ -391,7 +391,7 @@ static GSList *hw_scan(GSList *options) char buf[8]; (void)options; - drvc = odi->priv; + drvc = di->priv; devices = NULL; conn = serialcomm = NULL; @@ -466,7 +466,7 @@ static GSList *hw_scan(GSList *options) /* Not an OLS -- some other board that uses the sump protocol. */ sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, "Sump", "Logic Analyzer", "v1.0"); - sdi->driver = odi; + sdi->driver = di; devc = ols_dev_new(); for (i = 0; i < 32; i++) { if (!(probe = sr_probe_new(i, SR_PROBE_LOGIC, TRUE, @@ -489,7 +489,7 @@ static GSList *hw_dev_list(void) { struct drv_context *drvc; - drvc = odi->priv; + drvc = di->priv; return drvc->instances; } @@ -530,7 +530,7 @@ static int hw_cleanup(void) struct dev_context *devc; int ret = SR_OK; - if (!(drvc = odi->priv)) + if (!(drvc = di->priv)) return SR_OK; /* Properly close and free all devices. */ @@ -700,7 +700,7 @@ static int receive_data(int fd, int revents, void *cb_data) int num_channels, offset, i, j; unsigned char byte; - drvc = odi->priv; + drvc = di->priv; /* Find this device's devc struct by its fd. */ devc = NULL; diff --git a/hardware/zeroplus-logic-cube/zeroplus.c b/hardware/zeroplus-logic-cube/zeroplus.c index 56b02022..739e490e 100644 --- a/hardware/zeroplus-logic-cube/zeroplus.c +++ b/hardware/zeroplus-logic-cube/zeroplus.c @@ -106,7 +106,7 @@ static const char *probe_names[NUM_PROBES + 1] = { /* List of struct sr_dev_inst, maintained by dev_open()/dev_close(). */ SR_PRIV struct sr_dev_driver zeroplus_logic_cube_driver_info; -static struct sr_dev_driver *zdi = &zeroplus_logic_cube_driver_info; +static struct sr_dev_driver *di = &zeroplus_logic_cube_driver_info; /* * The hardware supports more samplerates than these, but these are the @@ -277,7 +277,7 @@ static int clear_instances(void) struct drv_context *drvc; struct dev_context *devc; - drvc = zdi->priv; + drvc = di->priv; for (l = drvc->instances; l; l = l->next) { sdi = l->data; if (!(devc = sdi->priv)) { @@ -310,7 +310,7 @@ static int hw_init(struct sr_context *sr_ctx) return SR_ERR_MALLOC; } drvc->sr_ctx = sr_ctx; - zdi->priv = drvc; + di->priv = drvc; return SR_OK; } @@ -329,7 +329,7 @@ static GSList *hw_scan(GSList *options) (void)options; - drvc = zdi->priv; + drvc = di->priv; devices = NULL; clear_instances(); @@ -364,7 +364,7 @@ static GSList *hw_scan(GSList *options) sr_err("zp: %s: sr_dev_inst_new failed", __func__); return NULL; } - sdi->driver = zdi; + sdi->driver = di; /* Allocate memory for our private driver context. */ if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) { @@ -409,7 +409,7 @@ static GSList *hw_dev_list(void) { struct drv_context *drvc; - drvc = zdi->priv; + drvc = di->priv; return drvc->instances; } @@ -417,7 +417,7 @@ static GSList *hw_dev_list(void) static int hw_dev_open(struct sr_dev_inst *sdi) { struct dev_context *devc; - struct drv_context *drvc = zdi->priv; + struct drv_context *drvc = di->priv; libusb_device **devlist, *dev; struct libusb_device_descriptor des; int device_count, ret, i; @@ -535,7 +535,7 @@ static int hw_cleanup(void) { struct drv_context *drvc; - if (!(drvc = zdi->priv)) + if (!(drvc = di->priv)) return SR_OK; clear_instances();