]> sigrok.org Git - libsigrok.git/commitdiff
kingst-la2016: coding style, separate declaration from instructions
authorGerhard Sittig <redacted>
Sun, 23 Jan 2022 20:15:28 +0000 (21:15 +0100)
committerGerhard Sittig <redacted>
Sun, 6 Feb 2022 17:53:53 +0000 (18:53 +0100)
src/hardware/kingst-la2016/api.c
src/hardware/kingst-la2016/protocol.c

index af3a57a658d29f887518c9385586c88772c85311..0b8bc1a59b40cf63aef9d10caddef6206ef65c84 100644 (file)
@@ -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;
index 26a49c10d4fde52fa1bbd42996783a3f7a2cae09..067ab4ada9df4fc795dd4ff6795cbae5ee1024a3 100644 (file)
@@ -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;