Skip to content

Commit

Permalink
osc: Create channels mask at startup and keep reference to it
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Nechita <[email protected]>
  • Loading branch information
dNechita committed Feb 6, 2025
1 parent 04466e8 commit 4bcc940
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions datatypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ struct extra_dev_info {
gfloat **channels_data_copy;
GSList *plots_sample_counts;
struct iio_stream *stream;
struct iio_channels_mask *channels_mask;
};

struct buffer {
Expand Down
3 changes: 3 additions & 0 deletions osc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1863,6 +1863,7 @@ static void init_device_list(struct iio_context *_ctx)
struct extra_dev_info *dev_info = calloc(1, sizeof(*dev_info));
iio_device_set_data(dev, dev_info);
dev_info->input_device = is_input_device(dev);
dev_info->channels_mask = iio_create_channels_mask(nb_channels);

for (j = 0; j < nb_channels; j++) {
struct iio_channel *ch = iio_device_get_channel(dev, j);
Expand Down Expand Up @@ -1898,6 +1899,8 @@ static void cleanup_device_list(struct iio_context *_ctx)
}

dev_info = iio_device_get_data(dev);
if (dev_info->channels_mask)
iio_channels_mask_destroy(dev_info->channels_mask);
free(dev_info);
iio_device_set_data(dev, NULL);
}
Expand Down

0 comments on commit 4bcc940

Please sign in to comment.