From: Uwe Hermann Date: Thu, 20 Mar 2014 20:58:01 +0000 (+0100) Subject: Consistently use 'cg' for channel group variables. X-Git-Tag: libsigrok-0.3.0~110 X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=53b4680fceab9351fc87b8c5b34854733f5fdac0 Consistently use 'cg' for channel group variables. This matches how we consistently use sdi, devc, and so on all over the code-base. This fixes parts of bug #259. --- diff --git a/hardware/agilent-dmm/api.c b/hardware/agilent-dmm/api.c index 2c2a88bf..8c1f3b4a 100644 --- a/hardware/agilent-dmm/api.c +++ b/hardware/agilent-dmm/api.c @@ -170,11 +170,11 @@ static int cleanup(void) } static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -208,10 +208,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { (void)sdi; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_SCAN_OPTIONS: diff --git a/hardware/alsa/api.c b/hardware/alsa/api.c index 5538e4f0..5590d79a 100644 --- a/hardware/alsa/api.c +++ b/hardware/alsa/api.c @@ -129,11 +129,11 @@ static int cleanup(void) } static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; - (void)channel_group; + (void)cg; switch (id) { case SR_CONF_SAMPLERATE: @@ -148,11 +148,11 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, } static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -174,14 +174,14 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; GVariant *gvar; GVariantBuilder gvb; int i; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_DEVICE_OPTIONS: diff --git a/hardware/appa-55ii/api.c b/hardware/appa-55ii/api.c index af22cb5c..77bd50a7 100644 --- a/hardware/appa-55ii/api.c +++ b/hardware/appa-55ii/api.c @@ -138,11 +138,11 @@ static int cleanup(void) } static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc = sdi->priv; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_LIMIT_SAMPLES: @@ -162,13 +162,13 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, } static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; const char *tmp_str; unsigned int i; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -206,10 +206,10 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { (void)sdi; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_SCAN_OPTIONS: diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c index 3909638f..5b39f0a2 100644 --- a/hardware/asix-sigma/asix-sigma.c +++ b/hardware/asix-sigma/asix-sigma.c @@ -745,11 +745,11 @@ static int cleanup(void) } static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; - (void)channel_group; + (void)cg; switch (id) { case SR_CONF_SAMPLERATE: @@ -767,12 +767,12 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, } static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; int ret; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -801,13 +801,13 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { GVariant *gvar; GVariantBuilder gvb; (void)sdi; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_DEVICE_OPTIONS: diff --git a/hardware/atten-pps3xxx/api.c b/hardware/atten-pps3xxx/api.c index a52c4e4d..102940b7 100644 --- a/hardware/atten-pps3xxx/api.c +++ b/hardware/atten-pps3xxx/api.c @@ -206,7 +206,7 @@ static int cleanup(void) } static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; struct sr_probe *probe; @@ -218,7 +218,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, devc = sdi->priv; ret = SR_OK; - if (!channel_group) { + if (!cg) { /* No channel group: global options. */ switch (key) { case SR_CONF_OUTPUT_CHANNEL: @@ -232,7 +232,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, } } else { /* We only ever have one channel per channel group in this driver. */ - probe = channel_group->channels->data; + probe = cg->channels->data; channel = probe->index; switch (key) { @@ -275,7 +275,7 @@ static int find_str(const char *str, const char **strings, int array_size) } static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; struct sr_probe *probe; @@ -289,7 +289,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, ret = SR_OK; devc = sdi->priv; - if (!channel_group) { + if (!cg) { /* No channel group: global options. */ switch (key) { case SR_CONF_OUTPUT_CHANNEL: @@ -323,7 +323,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, } else { /* Channel group specified: per-channel options. */ /* We only ever have one channel per channel group in this driver. */ - probe = channel_group->channels->data; + probe = cg->channels->data; channel = probe->index; switch (key) { @@ -359,7 +359,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; struct sr_probe *probe; @@ -379,7 +379,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, devc = sdi->priv; ret = SR_OK; - if (!channel_group) { + if (!cg) { /* No channel group: global options. */ switch (key) { case SR_CONF_DEVICE_OPTIONS: @@ -403,7 +403,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, if (!sdi) return SR_ERR_ARG; /* We only ever have one channel per channel group in this driver. */ - probe = channel_group->channels->data; + probe = cg->channels->data; channel = probe->index; switch (key) { diff --git a/hardware/brymen-bm86x/api.c b/hardware/brymen-bm86x/api.c index 2a5d5feb..a42aebca 100644 --- a/hardware/brymen-bm86x/api.c +++ b/hardware/brymen-bm86x/api.c @@ -183,11 +183,11 @@ static int cleanup(void) } static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc = sdi->priv; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_LIMIT_SAMPLES: @@ -204,11 +204,11 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, } static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -235,10 +235,10 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { (void)sdi; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_SCAN_OPTIONS: diff --git a/hardware/brymen-dmm/api.c b/hardware/brymen-dmm/api.c index 0b5a272d..9af92f1d 100644 --- a/hardware/brymen-dmm/api.c +++ b/hardware/brymen-dmm/api.c @@ -150,12 +150,12 @@ static int cleanup(void) } static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; int ret; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -181,10 +181,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { (void)sdi; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_SCAN_OPTIONS: diff --git a/hardware/cem-dt-885x/api.c b/hardware/cem-dt-885x/api.c index 3dbb9a39..d996b03d 100644 --- a/hardware/cem-dt-885x/api.c +++ b/hardware/cem-dt-885x/api.c @@ -166,14 +166,14 @@ static int cleanup(void) } static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; GVariant *range[2]; uint64_t low, high; int tmp, ret; - (void)channel_group; + (void)cg; if (!sdi) return SR_ERR_ARG; @@ -238,7 +238,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, } static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; uint64_t tmp_u64, low, high; @@ -246,7 +246,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, int tmp, ret; const char *tmp_str; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -328,7 +328,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { GVariant *tuple, *range[2]; GVariantBuilder gvb; @@ -336,7 +336,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, int ret; (void)sdi; - (void)channel_group; + (void)cg; ret = SR_OK; switch (key) { diff --git a/hardware/center-3xx/api.c b/hardware/center-3xx/api.c index c7539da8..376563a7 100644 --- a/hardware/center-3xx/api.c +++ b/hardware/center-3xx/api.c @@ -161,11 +161,11 @@ static int cleanup(int idx) } static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -191,10 +191,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { (void)sdi; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_SCAN_OPTIONS: diff --git a/hardware/chronovu-la8/api.c b/hardware/chronovu-la8/api.c index c14d63ad..f73a7fd4 100644 --- a/hardware/chronovu-la8/api.c +++ b/hardware/chronovu-la8/api.c @@ -263,11 +263,11 @@ static int cleanup(void) } static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; - (void)channel_group; + (void)cg; switch (id) { case SR_CONF_SAMPLERATE: @@ -287,11 +287,11 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, } static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -333,13 +333,13 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { GVariant *gvar, *grange[2]; GVariantBuilder gvb; (void)sdi; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_DEVICE_OPTIONS: diff --git a/hardware/colead-slm/api.c b/hardware/colead-slm/api.c index c3046d4b..99773a80 100644 --- a/hardware/colead-slm/api.c +++ b/hardware/colead-slm/api.c @@ -130,11 +130,11 @@ static int cleanup(void) } static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -168,10 +168,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { (void)sdi; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_SCAN_OPTIONS: diff --git a/hardware/conrad-digi-35-cpu/api.c b/hardware/conrad-digi-35-cpu/api.c index 29a0f375..99e9916f 100644 --- a/hardware/conrad-digi-35-cpu/api.c +++ b/hardware/conrad-digi-35-cpu/api.c @@ -122,12 +122,12 @@ static int cleanup(void) } static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { int ret; double dblval; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -165,12 +165,12 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { int ret; (void)sdi; - (void)channel_group; + (void)cg; ret = SR_OK; switch (key) { diff --git a/hardware/demo/demo.c b/hardware/demo/demo.c index 19742309..3a8d277d 100644 --- a/hardware/demo/demo.c +++ b/hardware/demo/demo.c @@ -171,7 +171,7 @@ static int init(struct sr_context *sr_ctx) return std_init(sr_ctx, di, LOG_PREFIX); } -static void generate_analog_pattern(const struct sr_channel_group *channel_group, uint64_t sample_rate) +static void generate_analog_pattern(const struct sr_channel_group *cg, uint64_t sample_rate) { struct analog_gen *ag; double t, frequency; @@ -179,12 +179,11 @@ static void generate_analog_pattern(const struct sr_channel_group *channel_group unsigned int num_samples, i; int last_end; - ag = channel_group->priv; + ag = cg->priv; num_samples = ANALOG_BUFSIZE / sizeof(float); sr_dbg("Generating %s pattern for channel group %s", - analog_pattern_str[ag->pattern], - channel_group->name); + analog_pattern_str[ag->pattern], cg->name); switch (ag->pattern) { case PATTERN_SQUARE: @@ -383,7 +382,7 @@ static int cleanup(void) } static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; struct sr_probe *probe; @@ -405,14 +404,14 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, *data = g_variant_new_uint64(devc->limit_msec); break; case SR_CONF_PATTERN_MODE: - if (!channel_group) + if (!cg) return SR_ERR_CHANNEL_GROUP; - probe = channel_group->channels->data; + probe = cg->channels->data; if (probe->type == SR_PROBE_LOGIC) { pattern = devc->logic_pattern; *data = g_variant_new_string(logic_pattern_str[pattern]); } else if (probe->type == SR_PROBE_ANALOG) { - ag = channel_group->priv; + ag = cg->priv; pattern = ag->pattern; *data = g_variant_new_string(analog_pattern_str[pattern]); } else @@ -432,7 +431,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, } static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; struct analog_gen *ag; @@ -463,10 +462,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, sr_dbg("Setting time limit to %" PRIu64"ms", devc->limit_msec); break; case SR_CONF_PATTERN_MODE: - if (!channel_group) + if (!cg) return SR_ERR_CHANNEL_GROUP; stropt = g_variant_get_string(data, NULL); - probe = channel_group->channels->data; + probe = cg->channels->data; pattern = -1; if (probe->type == SR_PROBE_LOGIC) { for (i = 0; i < ARRAY_SIZE(logic_pattern_str); i++) { @@ -496,9 +495,8 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, if (pattern == -1) return SR_ERR_ARG; sr_dbg("Setting analog pattern for channel group %s to %s", - channel_group->name, - analog_pattern_str[pattern]); - ag = channel_group->priv; + cg->name, analog_pattern_str[pattern]); + ag = cg->priv; ag->pattern = pattern; } else return SR_ERR_BUG; @@ -511,7 +509,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct sr_probe *probe; GVariant *gvar; @@ -528,7 +526,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, if (!sdi) return SR_ERR_ARG; - if (!channel_group) { + if (!cg) { switch (key) { case SR_CONF_DEVICE_OPTIONS: *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, @@ -545,7 +543,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, return SR_ERR_NA; } } else { - probe = channel_group->channels->data; + probe = cg->channels->data; switch (key) { case SR_CONF_DEVICE_OPTIONS: *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, diff --git a/hardware/fluke-dmm/api.c b/hardware/fluke-dmm/api.c index 26d12669..3613e9b4 100644 --- a/hardware/fluke-dmm/api.c +++ b/hardware/fluke-dmm/api.c @@ -204,11 +204,11 @@ static int cleanup(void) } static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -242,10 +242,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { (void)sdi; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_SCAN_OPTIONS: diff --git a/hardware/fx2lafw/api.c b/hardware/fx2lafw/api.c index 7b9c2226..777bd148 100644 --- a/hardware/fx2lafw/api.c +++ b/hardware/fx2lafw/api.c @@ -347,13 +347,13 @@ static int cleanup(void) } static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; struct sr_usb_dev_inst *usb; char str[128]; - (void)channel_group; + (void)cg; switch (id) { case SR_CONF_CONN: @@ -381,12 +381,12 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, } static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; int ret; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR; @@ -407,13 +407,13 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { GVariant *gvar; GVariantBuilder gvb; (void)sdi; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_SCAN_OPTIONS: diff --git a/hardware/gmc-mh-1x-2x/api.c b/hardware/gmc-mh-1x-2x/api.c index e79bdbcf..33a3eee7 100644 --- a/hardware/gmc-mh-1x-2x/api.c +++ b/hardware/gmc-mh-1x-2x/api.c @@ -423,18 +423,18 @@ static int cleanup_2x_bd232(void) /** Get value of configuration item */ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { int ret; struct dev_context *devc; (void)sdi; (void)data; - (void)channel_group; + (void)cg; ret = SR_OK; - (void)channel_group; + (void)cg; if (!sdi || !(devc = sdi->priv)) return SR_ERR_ARG; @@ -460,10 +460,10 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, /** Implementation of config_list, auxiliary function for common parts, */ static int config_list_common(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { (void)sdi; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_SCAN_OPTIONS: @@ -479,10 +479,9 @@ static int config_list_common(int key, GVariant **data, const struct sr_dev_inst /** Implementation of config_list for Metrahit 1x/2x send mode */ static int config_list_sm(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { (void)sdi; - (void)channel_group; switch (key) { case SR_CONF_DEVICE_OPTIONS: @@ -490,7 +489,7 @@ static int config_list_sm(int key, GVariant **data, const struct sr_dev_inst *sd hwcaps_sm, ARRAY_SIZE(hwcaps_sm), sizeof(int32_t)); break; default: - return config_list_common(key, data, sdi, channel_group); + return config_list_common(key, data, sdi, cg); } return SR_OK; @@ -498,10 +497,9 @@ static int config_list_sm(int key, GVariant **data, const struct sr_dev_inst *sd /** Implementation of config_list for Metrahit 2x bidirectional mode */ static int config_list_bd(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { (void)sdi; - (void)channel_group; switch (key) { case SR_CONF_DEVICE_OPTIONS: @@ -509,7 +507,7 @@ static int config_list_bd(int key, GVariant **data, const struct sr_dev_inst *sd hwcaps_bd, ARRAY_SIZE(hwcaps_bd), sizeof(int32_t)); break; default: - return config_list_common(key, data, sdi, channel_group); + return config_list_common(key, data, sdi, cg); } return SR_OK; diff --git a/hardware/gmc-mh-1x-2x/protocol.c b/hardware/gmc-mh-1x-2x/protocol.c index 551a92b0..85228ab5 100644 --- a/hardware/gmc-mh-1x-2x/protocol.c +++ b/hardware/gmc-mh-1x-2x/protocol.c @@ -1492,13 +1492,13 @@ SR_PRIV const char *gmc_model_str(enum model mcode) /** @copydoc sr_dev_driver.config_set */ SR_PRIV int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; uint8_t params[9]; uint8_t msg[42]; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; diff --git a/hardware/gmc-mh-1x-2x/protocol.h b/hardware/gmc-mh-1x-2x/protocol.h index 335b9372..3d34d9ab 100644 --- a/hardware/gmc-mh-1x-2x/protocol.h +++ b/hardware/gmc-mh-1x-2x/protocol.h @@ -120,7 +120,7 @@ struct dev_context { /* Forward declarations */ SR_PRIV int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group); + const struct sr_channel_group *cg); SR_PRIV void create_cmd_14(guchar addr, guchar func, guchar* params, guchar* buf); SR_PRIV void dump_msg14(guchar* buf, gboolean raw); SR_PRIV int gmc_decode_model_bd(uint8_t mcode); diff --git a/hardware/hameg-hmo/api.c b/hardware/hameg-hmo/api.c index 6b6e5ab7..3200d64c 100644 --- a/hardware/hameg-hmo/api.c +++ b/hardware/hameg-hmo/api.c @@ -184,22 +184,22 @@ static int cleanup(void) } static int check_channel_group(struct dev_context *devc, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { unsigned int i; struct scope_config *model; model = devc->model_config; - if (!channel_group) + if (!cg) return PG_NONE; for (i = 0; i < model->analog_channels; ++i) - if (channel_group == &devc->analog_groups[i]) + if (cg == &devc->analog_groups[i]) return PG_ANALOG; for (i = 0; i < model->digital_pods; ++i) - if (channel_group == &devc->digital_groups[i]) + if (cg == &devc->digital_groups[i]) return PG_DIGITAL; sr_err("Invalid channel group specified."); @@ -208,7 +208,7 @@ static int check_channel_group(struct dev_context *devc, } static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { int ret, pg_type; unsigned int i; @@ -219,7 +219,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, if (!sdi || !(devc = sdi->priv)) return SR_ERR_ARG; - if ((pg_type = check_channel_group(devc, channel_group)) == PG_INVALID) + if ((pg_type = check_channel_group(devc, cg)) == PG_INVALID) return SR_ERR; ret = SR_ERR_NA; @@ -242,7 +242,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, return SR_ERR_CHANNEL_GROUP; } else if (pg_type == PG_ANALOG) { for (i = 0; i < model->analog_channels; ++i) { - if (channel_group != &devc->analog_groups[i]) + if (cg != &devc->analog_groups[i]) continue; *data = g_variant_new_int32(model->num_ydivs); ret = SR_OK; @@ -290,7 +290,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, return SR_ERR_CHANNEL_GROUP; } else if (pg_type == PG_ANALOG) { for (i = 0; i < model->analog_channels; ++i) { - if (channel_group != &devc->analog_groups[i]) + if (cg != &devc->analog_groups[i]) continue; *data = g_variant_new_string((*model->coupling_options)[state->analog_channels[i].coupling]); ret = SR_OK; @@ -332,7 +332,7 @@ static GVariant *build_tuples(const uint64_t (*array)[][2], unsigned int n) } static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { int ret, pg_type; unsigned int i, j; @@ -348,7 +348,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, if (!sdi || !(devc = sdi->priv)) return SR_ERR_ARG; - if ((pg_type = check_channel_group(devc, channel_group)) == PG_INVALID) + if ((pg_type = check_channel_group(devc, cg)) == PG_INVALID) return SR_ERR; model = devc->model_config; @@ -389,7 +389,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, q != (*model->vdivs)[i][1]) continue; for (j = 1; j <= model->analog_channels; ++j) { - if (channel_group != &devc->analog_groups[j - 1]) + if (cg != &devc->analog_groups[j - 1]) continue; state->analog_channels[j - 1].vdiv = i; g_ascii_formatd(float_str, sizeof(float_str), "%E", (float) p / q); @@ -471,7 +471,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, if (strcmp(tmp, (*model->coupling_options)[i]) != 0) continue; for (j = 1; j <= model->analog_channels; ++j) { - if (channel_group != &devc->analog_groups[j - 1]) + if (cg != &devc->analog_groups[j - 1]) continue; state->analog_channels[j-1].coupling = i; @@ -504,7 +504,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { int pg_type; struct dev_context *devc; @@ -513,7 +513,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, if (!sdi || !(devc = sdi->priv)) return SR_ERR_ARG; - if ((pg_type = check_channel_group(devc, channel_group)) == PG_INVALID) + if ((pg_type = check_channel_group(devc, cg)) == PG_INVALID) return SR_ERR; model = devc->model_config; diff --git a/hardware/hantek-dso/api.c b/hardware/hantek-dso/api.c index 3553b574..a10af6c5 100644 --- a/hardware/hantek-dso/api.c +++ b/hardware/hantek-dso/api.c @@ -423,12 +423,12 @@ static int cleanup(void) } static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct sr_usb_dev_inst *usb; char str[128]; - (void)channel_group; + (void)cg; switch (id) { case SR_CONF_CONN: @@ -456,7 +456,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, } static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; double tmp_double; @@ -466,7 +466,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, const char *tmp_str; char **targets; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -587,14 +587,14 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; GVariant *tuple, *rational[2]; GVariantBuilder gvb; unsigned int i; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_SCAN_OPTIONS: diff --git a/hardware/ikalogic-scanalogic2/api.c b/hardware/ikalogic-scanalogic2/api.c index 052369a7..ac5084d3 100644 --- a/hardware/ikalogic-scanalogic2/api.c +++ b/hardware/ikalogic-scanalogic2/api.c @@ -308,12 +308,12 @@ static int cleanup(void) } static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; int ret; - (void)channel_group; + (void)cg; ret = SR_OK; devc = sdi->priv; @@ -333,12 +333,12 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, } static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { uint64_t samplerate, limit_samples, capture_ratio; int ret; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -366,14 +366,14 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { GVariant *gvar, *grange[2]; GVariantBuilder gvb; int ret; (void)sdi; - (void)channel_group; + (void)cg; ret = SR_OK; diff --git a/hardware/ikalogic-scanaplus/api.c b/hardware/ikalogic-scanaplus/api.c index a0efca8d..04ae5c99 100644 --- a/hardware/ikalogic-scanaplus/api.c +++ b/hardware/ikalogic-scanaplus/api.c @@ -280,10 +280,10 @@ static int cleanup(void) } static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { (void)sdi; - (void)channel_group; + (void)cg; switch (id) { case SR_CONF_SAMPLERATE: @@ -298,11 +298,11 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, } static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -335,13 +335,13 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { GVariant *gvar; GVariantBuilder gvb; (void)sdi; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_DEVICE_OPTIONS: diff --git a/hardware/kecheng-kc-330b/api.c b/hardware/kecheng-kc-330b/api.c index 177884e5..d9e4d5cf 100644 --- a/hardware/kecheng-kc-330b/api.c +++ b/hardware/kecheng-kc-330b/api.c @@ -249,13 +249,13 @@ static int cleanup(void) } static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; GVariant *rational[2]; const uint64_t *si; - (void)channel_group; + (void)cg; devc = sdi->priv; switch (key) { @@ -298,7 +298,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, } static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; uint64_t p, q; @@ -306,7 +306,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, int tmp, ret; const char *tmp_str; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -378,14 +378,14 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { GVariant *tuple, *rational[2]; GVariantBuilder gvb; unsigned int i; (void)sdi; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_DEVICE_OPTIONS: diff --git a/hardware/lascar-el-usb/api.c b/hardware/lascar-el-usb/api.c index 6014a8f6..657d9935 100644 --- a/hardware/lascar-el-usb/api.c +++ b/hardware/lascar-el-usb/api.c @@ -159,14 +159,14 @@ static int cleanup(void) } static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; struct sr_usb_dev_inst *usb; int ret; char str[128]; - (void)channel_group; + (void)cg; devc = sdi->priv; switch (id) { @@ -195,12 +195,12 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, } static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; int ret; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -235,10 +235,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { (void)sdi; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_SCAN_OPTIONS: diff --git a/hardware/link-mso19/api.c b/hardware/link-mso19/api.c index a657e270..3d40015c 100644 --- a/hardware/link-mso19/api.c +++ b/hardware/link-mso19/api.c @@ -276,11 +276,11 @@ static int cleanup(void) } static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; - (void)channel_group; + (void)cg; switch (id) { case SR_CONF_SAMPLERATE: @@ -298,7 +298,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, } static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { int ret; struct dev_context *devc; @@ -307,7 +307,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, int trigger_pos; double pos; - (void)channel_group; + (void)cg; devc = sdi->priv; if (sdi->status != SR_ST_ACTIVE) @@ -369,12 +369,12 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { GVariant *gvar; GVariantBuilder gvb; - (void)channel_group; + (void)cg; (void)sdi; switch (key) { diff --git a/hardware/mic-985xx/api.c b/hardware/mic-985xx/api.c index 5a75be7a..1368b35e 100644 --- a/hardware/mic-985xx/api.c +++ b/hardware/mic-985xx/api.c @@ -163,11 +163,11 @@ static int cleanup(int idx) } static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -193,10 +193,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { (void)sdi; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_SCAN_OPTIONS: diff --git a/hardware/norma-dmm/api.c b/hardware/norma-dmm/api.c index 92b60cbf..35a5d706 100644 --- a/hardware/norma-dmm/api.c +++ b/hardware/norma-dmm/api.c @@ -185,11 +185,11 @@ static int cleanup(void) } static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -223,10 +223,10 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { (void)sdi; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_SCAN_OPTIONS: diff --git a/hardware/openbench-logic-sniffer/api.c b/hardware/openbench-logic-sniffer/api.c index 468b55d6..76942437 100644 --- a/hardware/openbench-logic-sniffer/api.c +++ b/hardware/openbench-logic-sniffer/api.c @@ -213,11 +213,11 @@ static int cleanup(void) } static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; - (void)channel_group; + (void)cg; if (!sdi) return SR_ERR_ARG; @@ -252,7 +252,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, } static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; uint16_t flag; @@ -260,7 +260,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, int ret; const char *stropt; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -349,14 +349,14 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; GVariant *gvar, *grange[2]; GVariantBuilder gvb; int num_channels, i; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_SCAN_OPTIONS: diff --git a/hardware/rigol-ds/api.c b/hardware/rigol-ds/api.c index 917e3de6..da1fe250 100644 --- a/hardware/rigol-ds/api.c +++ b/hardware/rigol-ds/api.c @@ -477,7 +477,7 @@ static int digital_frame_size(const struct sr_dev_inst *sdi) } static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; struct sr_probe *probe; @@ -492,13 +492,13 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, return SR_ERR_ARG; /* If a channel group is specified, it must be a valid one. */ - if (channel_group && !g_slist_find(sdi->channel_groups, channel_group)) { + if (cg && !g_slist_find(sdi->channel_groups, cg)) { sr_err("Invalid channel group specified."); return SR_ERR; } - if (channel_group) { - probe = g_slist_nth_data(channel_group->channels, 0); + if (cg) { + probe = g_slist_nth_data(cg->channels, 0); if (!probe) return SR_ERR; if (probe->type == SR_PROBE_ANALOG) { @@ -588,7 +588,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, } static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; uint64_t p, q; @@ -605,7 +605,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, return SR_ERR_DEV_CLOSED; /* If a channel group is specified, it must be a valid one. */ - if (channel_group && !g_slist_find(sdi->channel_groups, channel_group)) { + if (cg && !g_slist_find(sdi->channel_groups, cg)) { sr_err("Invalid channel group specified."); return SR_ERR; } @@ -676,13 +676,13 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, ret = SR_ERR_ARG; break; case SR_CONF_VDIV: - if (!channel_group) { + if (!cg) { sr_err("No channel group specified."); return SR_ERR_CHANNEL_GROUP; } g_variant_get(data, "(tt)", &p, &q); for (i = 0; i < 2; i++) { - if (channel_group == &devc->analog_groups[i]) { + if (cg == &devc->analog_groups[i]) { for (j = 0; j < ARRAY_SIZE(vdivs); j++) { if (vdivs[j][0] != p || vdivs[j][1] != q) continue; @@ -697,13 +697,13 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, } return SR_ERR_NA; case SR_CONF_COUPLING: - if (!channel_group) { + if (!cg) { sr_err("No channel group specified."); return SR_ERR_CHANNEL_GROUP; } tmp_str = g_variant_get_string(data, NULL); for (i = 0; i < 2; i++) { - if (channel_group == &devc->analog_groups[i]) { + if (cg == &devc->analog_groups[i]) { for (j = 0; j < ARRAY_SIZE(coupling); j++) { if (!strcmp(tmp_str, coupling[j])) { g_free(devc->coupling[i]); @@ -738,7 +738,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { GVariant *tuple, *rational[2]; GVariantBuilder gvb; @@ -752,7 +752,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, hwopts, ARRAY_SIZE(hwopts), sizeof(int32_t)); return SR_OK; - } else if (key == SR_CONF_DEVICE_OPTIONS && channel_group == NULL) { + } else if (key == SR_CONF_DEVICE_OPTIONS && cg == NULL) { *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); return SR_OK; @@ -763,9 +763,9 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, return SR_ERR_ARG; /* If a channel group is specified, it must be a valid one. */ - if (channel_group) { - if (channel_group != &devc->analog_groups[0] - && channel_group != &devc->analog_groups[1]) { + if (cg) { + if (cg != &devc->analog_groups[0] + && cg != &devc->analog_groups[1]) { sr_err("Invalid channel group specified."); return SR_ERR; } @@ -773,17 +773,17 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, switch (key) { case SR_CONF_DEVICE_OPTIONS: - if (!channel_group) { + if (!cg) { sr_err("No channel group specified."); return SR_ERR_CHANNEL_GROUP; } - if (channel_group == &devc->digital_group) { + if (cg == &devc->digital_group) { *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, NULL, 0, sizeof(int32_t)); return SR_OK; } else { for (i = 0; i < 2; i++) { - if (channel_group == &devc->analog_groups[i]) { + if (cg == &devc->analog_groups[i]) { *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, analog_hwcaps, ARRAY_SIZE(analog_hwcaps), sizeof(int32_t)); return SR_OK; @@ -793,7 +793,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, } break; case SR_CONF_COUPLING: - if (!channel_group) { + if (!cg) { sr_err("No channel group specified."); return SR_ERR_CHANNEL_GROUP; } @@ -803,7 +803,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, if (!devc) /* Can't know this until we have the exact model. */ return SR_ERR_ARG; - if (!channel_group) { + if (!cg) { sr_err("No channel group specified."); return SR_ERR_CHANNEL_GROUP; } diff --git a/hardware/saleae-logic16/api.c b/hardware/saleae-logic16/api.c index d0a63dc9..40f7812c 100644 --- a/hardware/saleae-logic16/api.c +++ b/hardware/saleae-logic16/api.c @@ -428,7 +428,7 @@ static int cleanup(void) } static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; struct sr_usb_dev_inst *usb; @@ -437,7 +437,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, int ret; unsigned int i; - (void)channel_group; + (void)cg; ret = SR_OK; switch (key) { @@ -482,14 +482,14 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, } static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; gdouble low, high; int ret; unsigned int i; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -525,7 +525,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { GVariant *gvar, *range[2]; GVariantBuilder gvb; @@ -533,7 +533,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, unsigned int i; (void)sdi; - (void)channel_group; + (void)cg; ret = SR_OK; switch (key) { diff --git a/hardware/serial-dmm/api.c b/hardware/serial-dmm/api.c index cddc11b8..3efe4f6a 100644 --- a/hardware/serial-dmm/api.c +++ b/hardware/serial-dmm/api.c @@ -460,11 +460,11 @@ static int cleanup(int dmm) } static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -493,10 +493,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { (void)sdi; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_SCAN_OPTIONS: diff --git a/hardware/sysclk-lwla/api.c b/hardware/sysclk-lwla/api.c index 1ff49bf4..f693b434 100644 --- a/hardware/sysclk-lwla/api.c +++ b/hardware/sysclk-lwla/api.c @@ -265,12 +265,12 @@ static int cleanup(void) } static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; size_t idx; - (void)channel_group; + (void)cg; if (!sdi) return SR_ERR_ARG; @@ -337,13 +337,13 @@ static int lookup_index(GVariant *value, const char *const *table, int len) } static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { uint64_t value; struct dev_context *devc; int idx; - (void)channel_group; + (void)cg; devc = sdi->priv; if (!devc) @@ -477,13 +477,13 @@ static int config_commit(const struct sr_dev_inst *sdi) } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { GVariant *gvar; GVariantBuilder gvb; (void)sdi; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_SCAN_OPTIONS: diff --git a/hardware/teleinfo/api.c b/hardware/teleinfo/api.c index 024f611a..f8fb3243 100644 --- a/hardware/teleinfo/api.c +++ b/hardware/teleinfo/api.c @@ -178,11 +178,11 @@ static int cleanup(void) } static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -209,10 +209,10 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { (void)sdi; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_SCAN_OPTIONS: diff --git a/hardware/tondaj-sl-814/api.c b/hardware/tondaj-sl-814/api.c index 0eb14b06..e6e28472 100644 --- a/hardware/tondaj-sl-814/api.c +++ b/hardware/tondaj-sl-814/api.c @@ -129,11 +129,11 @@ static int cleanup(void) } static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -154,10 +154,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { (void)sdi; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_SCAN_OPTIONS: diff --git a/hardware/uni-t-dmm/api.c b/hardware/uni-t-dmm/api.c index a91af6cc..2ec99ca1 100644 --- a/hardware/uni-t-dmm/api.c +++ b/hardware/uni-t-dmm/api.c @@ -272,11 +272,11 @@ static int cleanup(int dmm) } static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; - (void)channel_group; + (void)cg; devc = sdi->priv; @@ -307,10 +307,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { (void)sdi; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_SCAN_OPTIONS: diff --git a/hardware/uni-t-ut32x/api.c b/hardware/uni-t-ut32x/api.c index caea61f7..3a0327bb 100644 --- a/hardware/uni-t-ut32x/api.c +++ b/hardware/uni-t-ut32x/api.c @@ -200,11 +200,11 @@ static int cleanup(void) } static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; - (void)channel_group; + (void)cg; devc = sdi->priv; switch (key) { @@ -225,13 +225,13 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, } static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; int ret; const char *tmp_str; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -266,11 +266,11 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { (void)sdi; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_DEVICE_OPTIONS: diff --git a/hardware/victor-dmm/api.c b/hardware/victor-dmm/api.c index 4c7cdc20..f7944973 100644 --- a/hardware/victor-dmm/api.c +++ b/hardware/victor-dmm/api.c @@ -202,12 +202,12 @@ static int cleanup(void) } static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct sr_usb_dev_inst *usb; char str[128]; - (void)channel_group; + (void)cg; switch (id) { case SR_CONF_CONN: @@ -225,13 +225,13 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, } static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; gint64 now; int ret; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -264,10 +264,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { (void)sdi; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_SCAN_OPTIONS: diff --git a/hardware/zeroplus-logic-cube/api.c b/hardware/zeroplus-logic-cube/api.c index 177c1841..63b2efd9 100644 --- a/hardware/zeroplus-logic-cube/api.c +++ b/hardware/zeroplus-logic-cube/api.c @@ -467,11 +467,11 @@ static int cleanup(void) } static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; - (void)channel_group; + (void)cg; switch (id) { case SR_CONF_SAMPLERATE: @@ -508,12 +508,12 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, } static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; gdouble low, high; - (void)channel_group; + (void)cg; if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -541,7 +541,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; GVariant *gvar, *grange[2]; @@ -549,7 +549,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, double v; GVariant *range[2]; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_DEVICE_OPTIONS: diff --git a/hwdriver.c b/hwdriver.c index f508a469..f198e863 100644 --- a/hwdriver.c +++ b/hwdriver.c @@ -587,7 +587,7 @@ SR_PRIV void sr_config_free(struct sr_config *src) * @param[in] sdi (optional) If the key is specific to a device, this must * contain a pointer to the struct sr_dev_inst to be checked. * Otherwise it must be NULL. - * @param[in] channel_group The channel group on the device for which to list the + * @param[in] cg The channel group on the device for which to list the * values, or NULL. * @param[in] key The configuration key (SR_CONF_*). * @param[in,out] data Pointer to a GVariant where the value will be stored. @@ -604,7 +604,7 @@ SR_PRIV void sr_config_free(struct sr_config *src) */ SR_API int sr_config_get(const struct sr_dev_driver *driver, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group, + const struct sr_channel_group *cg, int key, GVariant **data) { int ret; @@ -615,7 +615,7 @@ SR_API int sr_config_get(const struct sr_dev_driver *driver, if (!driver->config_get) return SR_ERR_ARG; - if ((ret = driver->config_get(key, data, sdi, channel_group)) == SR_OK) { + if ((ret = driver->config_get(key, data, sdi, cg)) == SR_OK) { /* Got a floating reference from the driver. Sink it here, * caller will need to unref when done with it. */ g_variant_ref_sink(*data); @@ -628,7 +628,7 @@ SR_API int sr_config_get(const struct sr_dev_driver *driver, * Set value of a configuration key in a device instance. * * @param[in] sdi The device instance. - * @param[in] channel_group The channel group on the device for which to list the + * @param[in] cg The channel group on the device for which to list the * values, or NULL. * @param[in] key The configuration key (SR_CONF_*). * @param data The new value for the key, as a GVariant with GVariantType @@ -642,7 +642,7 @@ SR_API int sr_config_get(const struct sr_dev_driver *driver, * that it's not applicable. */ SR_API int sr_config_set(const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group, + const struct sr_channel_group *cg, int key, GVariant *data) { int ret; @@ -654,7 +654,7 @@ SR_API int sr_config_set(const struct sr_dev_inst *sdi, else if (!sdi->driver->config_set) ret = SR_ERR_ARG; else - ret = sdi->driver->config_set(key, data, sdi, channel_group); + ret = sdi->driver->config_set(key, data, sdi, cg); g_variant_unref(data); @@ -688,7 +688,7 @@ SR_API int sr_config_commit(const struct sr_dev_inst *sdi) * @param[in] driver The sr_dev_driver struct to query. * @param[in] sdi (optional) If the key is specific to a device, this must * contain a pointer to the struct sr_dev_inst to be checked. - * @param[in] channel_group The channel group on the device for which to list the + * @param[in] cg The channel group on the device for which to list the * values, or NULL. * @param[in] key The configuration key (SR_CONF_*). * @param[in,out] data A pointer to a GVariant where the list will be stored. @@ -705,7 +705,7 @@ SR_API int sr_config_commit(const struct sr_dev_inst *sdi) */ SR_API int sr_config_list(const struct sr_dev_driver *driver, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group, + const struct sr_channel_group *cg, int key, GVariant **data) { int ret; @@ -714,7 +714,7 @@ SR_API int sr_config_list(const struct sr_dev_driver *driver, ret = SR_ERR; else if (!driver->config_list) ret = SR_ERR_ARG; - else if ((ret = driver->config_list(key, data, sdi, channel_group)) == SR_OK) + else if ((ret = driver->config_list(key, data, sdi, cg)) == SR_OK) g_variant_ref_sink(*data); return ret; diff --git a/libsigrok.h b/libsigrok.h index 48bddab4..382f502b 100644 --- a/libsigrok.h +++ b/libsigrok.h @@ -986,12 +986,12 @@ struct sr_dev_driver { */ int (*config_get) (int id, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group); + const struct sr_channel_group *cg); /** Set value of a configuration key in driver or a given device instance. * @see sr_config_set(). */ int (*config_set) (int id, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group); + const struct sr_channel_group *cg); /** Probe status change. * @see sr_dev_probe_enable(), sr_dev_trigger_set(). */ int (*config_probe_set) (const struct sr_dev_inst *sdi, @@ -1004,7 +1004,7 @@ struct sr_dev_driver { */ int (*config_list) (int info_id, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group); + const struct sr_channel_group *cg); /* Device-specific */ /** Open device */ diff --git a/proto.h b/proto.h index 75ece6c8..3d860e4b 100644 --- a/proto.h +++ b/proto.h @@ -72,15 +72,15 @@ SR_API int sr_driver_init(struct sr_context *ctx, SR_API GSList *sr_driver_scan(struct sr_dev_driver *driver, GSList *options); SR_API int sr_config_get(const struct sr_dev_driver *driver, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group, + const struct sr_channel_group *cg, int key, GVariant **data); SR_API int sr_config_set(const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group, + const struct sr_channel_group *cg, int key, GVariant *data); SR_API int sr_config_commit(const struct sr_dev_inst *sdi); SR_API int sr_config_list(const struct sr_dev_driver *driver, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group, + const struct sr_channel_group *cg, int key, GVariant **data); SR_API const struct sr_config_info *sr_config_info_get(int key); SR_API const struct sr_config_info *sr_config_info_name_get(const char *optname); diff --git a/session_driver.c b/session_driver.c index f64d203d..5018298d 100644 --- a/session_driver.c +++ b/session_driver.c @@ -211,11 +211,11 @@ static int dev_close(struct sr_dev_inst *sdi) } static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct session_vdev *vdev; - (void)channel_group; + (void)cg; switch (id) { case SR_CONF_SAMPLERATE: @@ -233,11 +233,11 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, } static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct session_vdev *vdev; - (void)channel_group; + (void)cg; vdev = sdi->priv; @@ -270,10 +270,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, } static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { (void)sdi; - (void)channel_group; + (void)cg; switch (key) { case SR_CONF_DEVICE_OPTIONS: