Lines Matching defs:ev_int
47 bool iio_event_enabled(const struct iio_event_interface *ev_int)
49 return !!test_bit(IIO_BUSY_BIT_POS, &ev_int->flags);
69 struct iio_event_interface *ev_int = iio_dev_opaque->event_interface;
73 if (!ev_int)
77 if (iio_event_enabled(ev_int)) {
82 copied = kfifo_put(&ev_int->det_events, ev);
84 wake_up_poll(&ev_int->wait, EPOLLIN);
104 struct iio_event_interface *ev_int = iio_dev_opaque->event_interface;
110 poll_wait(filep, &ev_int->wait, wait);
112 if (!kfifo_is_empty(&ev_int->det_events))
125 struct iio_event_interface *ev_int = iio_dev_opaque->event_interface;
136 if (kfifo_is_empty(&ev_int->det_events)) {
140 ret = wait_event_interruptible(ev_int->wait,
141 !kfifo_is_empty(&ev_int->det_events) ||
149 if (mutex_lock_interruptible(&ev_int->read_lock))
151 ret = kfifo_to_user(&ev_int->det_events, buf, count, &copied);
152 mutex_unlock(&ev_int->read_lock);
175 struct iio_event_interface *ev_int = iio_dev_opaque->event_interface;
177 clear_bit(IIO_BUSY_BIT_POS, &ev_int->flags);
195 struct iio_event_interface *ev_int = iio_dev_opaque->event_interface;
198 if (ev_int == NULL)
205 if (test_and_set_bit(IIO_BUSY_BIT_POS, &ev_int->flags)) {
215 clear_bit(IIO_BUSY_BIT_POS, &ev_int->flags);
218 kfifo_reset_out(&ev_int->det_events);
482 static void iio_setup_ev_int(struct iio_event_interface *ev_int)
484 INIT_KFIFO(ev_int->det_events);
485 init_waitqueue_head(&ev_int->wait);
486 mutex_init(&ev_int->read_lock);
511 struct iio_event_interface *ev_int;
520 ev_int = kzalloc(sizeof(struct iio_event_interface), GFP_KERNEL);
521 if (ev_int == NULL)
524 iio_dev_opaque->event_interface = ev_int;
526 INIT_LIST_HEAD(&ev_int->dev_attr_list);
528 iio_setup_ev_int(ev_int);
542 ev_int->group.name = iio_event_group_name;
543 ev_int->group.attrs = kcalloc(attrcount + 1,
544 sizeof(ev_int->group.attrs[0]),
546 if (ev_int->group.attrs == NULL) {
551 memcpy(ev_int->group.attrs,
553 sizeof(ev_int->group.attrs[0]) * attrcount_orig);
556 list_for_each_entry(p, &ev_int->dev_attr_list, l)
557 ev_int->group.attrs[attrn++] = &p->dev_attr.attr;
559 ret = iio_device_register_sysfs_group(indio_dev, &ev_int->group);
563 ev_int->ioctl_handler.ioctl = iio_event_ioctl;
565 &ev_int->ioctl_handler);
570 kfree(ev_int->group.attrs);
572 iio_free_chan_devattr_list(&ev_int->dev_attr_list);
573 kfree(ev_int);
597 struct iio_event_interface *ev_int = iio_dev_opaque->event_interface;
599 if (ev_int == NULL)
602 iio_device_ioctl_handler_unregister(&ev_int->ioctl_handler);
603 iio_free_chan_devattr_list(&ev_int->dev_attr_list);
604 kfree(ev_int->group.attrs);
605 kfree(ev_int);