Lines Matching refs:kf
18 struct kfifo kf; member
38 return __kfifo_alloc((struct __kfifo *)&buf->kf, length, in __iio_allocate_kfifo()
49 kfifo_free(&buf->kf); in iio_request_update_kfifo()
55 kfifo_reset_out(&buf->kf); in iio_request_update_kfifo()
64 struct iio_kfifo *kf = iio_to_kfifo(r); in iio_mark_update_needed_kfifo() local
65 kf->update_needed = true; in iio_mark_update_needed_kfifo()
94 struct iio_kfifo *kf = iio_to_kfifo(r); in iio_store_to_kfifo() local
95 ret = kfifo_in(&kf->kf, data, 1); in iio_store_to_kfifo()
104 struct iio_kfifo *kf = iio_to_kfifo(r); in iio_read_kfifo() local
106 if (mutex_lock_interruptible(&kf->user_lock)) in iio_read_kfifo()
109 if (!kfifo_initialized(&kf->kf) || n < kfifo_esize(&kf->kf)) in iio_read_kfifo()
112 ret = kfifo_to_user(&kf->kf, buf, n, &copied); in iio_read_kfifo()
113 mutex_unlock(&kf->user_lock); in iio_read_kfifo()
122 struct iio_kfifo *kf = iio_to_kfifo(r); in iio_kfifo_buf_data_available() local
125 mutex_lock(&kf->user_lock); in iio_kfifo_buf_data_available()
126 samples = kfifo_len(&kf->kf); in iio_kfifo_buf_data_available()
127 mutex_unlock(&kf->user_lock); in iio_kfifo_buf_data_available()
134 struct iio_kfifo *kf = iio_to_kfifo(buffer); in iio_kfifo_buffer_release() local
136 mutex_destroy(&kf->user_lock); in iio_kfifo_buffer_release()
137 kfifo_free(&kf->kf); in iio_kfifo_buffer_release()
138 kfree(kf); in iio_kfifo_buffer_release()
143 struct iio_kfifo *kf = iio_to_kfifo(r); in iio_kfifo_buf_space_available() local
146 mutex_lock(&kf->user_lock); in iio_kfifo_buf_space_available()
147 avail = kfifo_avail(&kf->kf); in iio_kfifo_buf_space_available()
148 mutex_unlock(&kf->user_lock); in iio_kfifo_buf_space_available()
156 struct iio_kfifo *kf = iio_to_kfifo(r); in iio_kfifo_remove_from() local
158 if (kfifo_size(&kf->kf) < 1) in iio_kfifo_remove_from()
161 ret = kfifo_out(&kf->kf, data, 1); in iio_kfifo_remove_from()
173 struct iio_kfifo *kf = iio_to_kfifo(r); in iio_kfifo_write() local
176 mutex_lock(&kf->user_lock); in iio_kfifo_write()
177 if (!kfifo_initialized(&kf->kf) || n < kfifo_esize(&kf->kf)) in iio_kfifo_write()
180 ret = kfifo_from_user(&kf->kf, buf, n, &copied); in iio_kfifo_write()
181 mutex_unlock(&kf->user_lock); in iio_kfifo_write()
205 struct iio_kfifo *kf; in iio_kfifo_allocate() local
207 kf = kzalloc(sizeof(*kf), GFP_KERNEL); in iio_kfifo_allocate()
208 if (!kf) in iio_kfifo_allocate()
211 kf->update_needed = true; in iio_kfifo_allocate()
212 iio_buffer_init(&kf->buffer); in iio_kfifo_allocate()
213 kf->buffer.access = &kfifo_access_funcs; in iio_kfifo_allocate()
214 kf->buffer.length = 2; in iio_kfifo_allocate()
215 mutex_init(&kf->user_lock); in iio_kfifo_allocate()
217 return &kf->buffer; in iio_kfifo_allocate()