]> sigrok.org Git - libsigrok.git/blobdiff - src/lcr/es51919.c
Simplify channel creation.
[libsigrok.git] / src / lcr / es51919.c
index 862374129e3f836a226333cb413c86299dafbcb2..c6fddc11c87a882e18f562fbf97058fbe99cc69c 100644 (file)
@@ -792,16 +792,6 @@ static int receive_data(int fd, int revents, void *cb_data)
        return TRUE;
 }
 
-static int add_channel(struct sr_dev_inst *sdi, int idx, const char *name)
-{
-       struct sr_channel *ch;
-
-       ch = sr_channel_new(idx, SR_CHANNEL_ANALOG, TRUE, name);
-       sdi->channels = g_slist_append(sdi->channels, ch);
-
-       return SR_OK;
-}
-
 static const char *const channel_names[] = { "P1", "P2" };
 
 static int setup_channels(struct sr_dev_inst *sdi)
@@ -811,11 +801,8 @@ static int setup_channels(struct sr_dev_inst *sdi)
 
        ret = SR_ERR_BUG;
 
-       for (i = 0; i < ARRAY_SIZE(channel_names); i++) {
-               ret = add_channel(sdi, i, channel_names[i]);
-               if (ret != SR_OK)
-                       break;
-       }
+       for (i = 0; i < ARRAY_SIZE(channel_names); i++)
+               sr_channel_new(sdi, i, SR_CHANNEL_ANALOG, TRUE, channel_names[i]);
 
        return ret;
 }