Skip to content

Commit 4677510

Browse files
commodoTravis CI User
authored andcommitted
iio: buffer: update upstream HW consumer with ADI
The IIO HW consumer module has been upstreamed in a slightly different manner than the one in the ADI tree. The only change is the use of the scan-mask helpers, which needs to be set in the upstream IIO. This change has slipped through the merge, as there is no common history to track them, so the 2 files show up from 2 different histories. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> (cherry picked from commit 4c0820a)
1 parent 88e4fcc commit 4677510

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

drivers/iio/buffer/industrialio-hw-consumer.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ static void iio_hw_buf_release(struct iio_buffer *buffer)
4141
{
4242
struct hw_consumer_buffer *hw_buf =
4343
iio_buffer_to_hw_consumer_buffer(buffer);
44+
iio_buffer_free_scanmask(buffer);
4445
kfree(hw_buf);
4546
}
4647

@@ -54,6 +55,7 @@ static struct hw_consumer_buffer *iio_hw_consumer_get_buffer(
5455
{
5556
size_t mask_size = BITS_TO_LONGS(indio_dev->masklength) * sizeof(long);
5657
struct hw_consumer_buffer *buf;
58+
int ret;
5759

5860
list_for_each_entry(buf, &hwc->buffers, head) {
5961
if (buf->indio_dev == indio_dev)
@@ -69,9 +71,18 @@ static struct hw_consumer_buffer *iio_hw_consumer_get_buffer(
6971
buf->buffer.scan_mask = buf->scan_mask;
7072

7173
iio_buffer_init(&buf->buffer);
74+
75+
ret = iio_buffer_alloc_scanmask(&buf->buffer, indio_dev);
76+
if (ret)
77+
goto err_free_buf;
78+
7279
list_add_tail(&buf->head, &hwc->buffers);
7380

7481
return buf;
82+
83+
err_free_buf:
84+
kfree(buf);
85+
return NULL;
7586
}
7687

7788
/**
@@ -106,7 +117,7 @@ struct iio_hw_consumer *iio_hw_consumer_alloc(struct device *dev)
106117
ret = -ENOMEM;
107118
goto err_put_buffers;
108119
}
109-
set_bit(chan->channel->scan_index, buf->buffer.scan_mask);
120+
iio_buffer_channel_enable(&buf->buffer, chan);
110121
chan++;
111122
}
112123

0 commit comments

Comments
 (0)