struct list_head head;
struct iio_dev *indio_dev;
struct iio_buffer buffer;
- long scan_mask[];
};
static struct hw_consumer_buffer *iio_buffer_to_hw_consumer_buffer(
static struct hw_consumer_buffer *iio_hw_consumer_get_buffer(
struct iio_hw_consumer *hwc, struct iio_dev *indio_dev)
{
- unsigned int mask_longs = BITS_TO_LONGS(iio_get_masklength(indio_dev));
struct hw_consumer_buffer *buf;
list_for_each_entry(buf, &hwc->buffers, head) {
return buf;
}
- buf = kzalloc_flex(*buf, scan_mask, mask_longs);
+ buf = kzalloc_obj(*buf);
if (!buf)
return NULL;
buf->buffer.access = &iio_hw_buf_access;
buf->indio_dev = indio_dev;
- buf->buffer.scan_mask = buf->scan_mask;
+ buf->buffer.scan_mask = bitmap_zalloc(iio_get_masklength(indio_dev),
+ GFP_KERNEL);
+ if (!buf->buffer.scan_mask) {
+ kfree(buf);
+ return NULL;
+ }
iio_buffer_init(&buf->buffer);
list_add_tail(&buf->head, &hwc->buffers);