From: Gerhard Sittig Date: Sun, 23 Jan 2022 20:15:28 +0000 (+0100) Subject: kingst-la2016: coding style, separate declaration from instructions X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=084d6b927163fb0881941ad13014e07a6a5e7a77;p=libsigrok.git kingst-la2016: coding style, separate declaration from instructions --- diff --git a/src/hardware/kingst-la2016/api.c b/src/hardware/kingst-la2016/api.c index af3a57a6..0b8bc1a5 100644 --- a/src/hardware/kingst-la2016/api.c +++ b/src/hardware/kingst-la2016/api.c @@ -574,14 +574,17 @@ static int config_list(uint32_t key, GVariant **data, static int configure_channels(const struct sr_dev_inst *sdi) { struct dev_context *devc; + GSList *l; + struct sr_channel *ch; devc = sdi->priv; + devc->cur_channels = 0; - for (GSList *l = sdi->channels; l; l = l->next) { - struct sr_channel *ch = (struct sr_channel*)l->data; - if (ch->enabled == FALSE) + for (l = sdi->channels; l; l = l->next) { + ch = l->data; + if (!ch->enabled) continue; - devc->cur_channels |= 1 << ch->index; + devc->cur_channels |= 1UL << ch->index; } return SR_OK; diff --git a/src/hardware/kingst-la2016/protocol.c b/src/hardware/kingst-la2016/protocol.c index 26a49c10..067ab4ad 100644 --- a/src/hardware/kingst-la2016/protocol.c +++ b/src/hardware/kingst-la2016/protocol.c @@ -343,13 +343,12 @@ static int set_threshold_voltage(const struct sr_dev_inst *sdi, float voltage) { struct dev_context *devc; int ret; - - devc = sdi->priv; - uint16_t duty_R79, duty_R56; uint8_t buf[2 * sizeof(uint16_t)]; uint8_t *wrptr; + devc = sdi->priv; + /* Clamp threshold setting to valid range for LA2016. */ if (voltage > 4.0) { voltage = 4.0;