]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/openbench-logic-sniffer/protocol.c
Simplify channel creation.
[libsigrok.git] / src / hardware / openbench-logic-sniffer / protocol.c
index b732da59c19e5a271b553a9be7288186e6cb6530..d9c2c2bb18bb246a133a2aa6f14703817aff9240 100644 (file)
@@ -142,7 +142,6 @@ SR_PRIV struct sr_dev_inst *get_metadata(struct sr_serial_dev_inst *serial)
 {
        struct sr_dev_inst *sdi;
        struct dev_context *devc;
-       struct sr_channel *ch;
        uint32_t tmp_int, ui;
        uint8_t key, type, token;
        int delay_ms;
@@ -215,11 +214,9 @@ SR_PRIV struct sr_dev_inst *get_metadata(struct sr_serial_dev_inst *serial)
                        switch (token) {
                        case 0x00:
                                /* Number of usable channels */
-                               for (ui = 0; ui < tmp_int; ui++) {
-                                       ch = sr_channel_new(ui, SR_CHANNEL_LOGIC, TRUE,
+                               for (ui = 0; ui < tmp_int; ui++)
+                                       sr_channel_new(sdi, ui, SR_CHANNEL_LOGIC, TRUE,
                                                        ols_channel_names[ui]);
-                                       sdi->channels = g_slist_append(sdi->channels, ch);
-                               }
                                break;
                        case 0x01:
                                /* Amount of sample memory available (bytes) */
@@ -253,11 +250,9 @@ SR_PRIV struct sr_dev_inst *get_metadata(struct sr_serial_dev_inst *serial)
                        switch (token) {
                        case 0x00:
                                /* Number of usable channels */
-                               for (ui = 0; ui < tmp_c; ui++) {
-                                       ch = sr_channel_new(ui, SR_CHANNEL_LOGIC, TRUE,
+                               for (ui = 0; ui < tmp_c; ui++)
+                                       sr_channel_new(sdi, ui, SR_CHANNEL_LOGIC, TRUE,
                                                        ols_channel_names[ui]);
-                                       sdi->channels = g_slist_append(sdi->channels, ch);
-                               }
                                break;
                        case 0x01:
                                /* protocol version */