struct iio_buffer *iio_kfifo_allocate(struct iio_dev *indio_dev) { struct iio_kfifo *kf; kf = kzalloc(sizeof *kf, GFP_KERNEL); if (!kf) return NULL; kf->update_needed = true; iio_buffer_init(&kf->buffer); kf->buffer.attrs = &iio_kfifo_attribute_group; kf->buffer.access = &kfifo_access_funcs; return &kf->buffer; }
struct iio_buffer *iio_kfifo_allocate(void) { struct iio_kfifo *kf; kf = kzalloc(sizeof(*kf), GFP_KERNEL); if (!kf) return NULL; kf->update_needed = true; iio_buffer_init(&kf->buffer); kf->buffer.access = &kfifo_access_funcs; kf->buffer.length = 2; mutex_init(&kf->user_lock); return &kf->buffer; }
struct iio_buffer *iio_sw_rb_allocate(struct iio_dev *indio_dev) { struct iio_buffer *buf; struct iio_sw_ring_buffer *ring; ring = kzalloc(sizeof *ring, GFP_KERNEL); if (!ring) return NULL; ring->update_needed = true; buf = &ring->buf; iio_buffer_init(buf); buf->attrs = &iio_ring_attribute_group; buf->access = &ring_sw_access_funcs; return buf; }