Lines Matching refs:ev_int

47 bool iio_event_enabled(const struct iio_event_interface *ev_int)  in iio_event_enabled()  argument
49 return !!test_bit(IIO_BUSY_BIT_POS, &ev_int->flags); in iio_event_enabled()
69 struct iio_event_interface *ev_int = iio_dev_opaque->event_interface; in iio_push_event() local
73 if (!ev_int) in iio_push_event()
77 if (iio_event_enabled(ev_int)) { in iio_push_event()
82 copied = kfifo_put(&ev_int->det_events, ev); in iio_push_event()
84 wake_up_poll(&ev_int->wait, EPOLLIN); in iio_push_event()
104 struct iio_event_interface *ev_int = iio_dev_opaque->event_interface; in iio_event_poll() local
110 poll_wait(filep, &ev_int->wait, wait); in iio_event_poll()
112 if (!kfifo_is_empty(&ev_int->det_events)) in iio_event_poll()
125 struct iio_event_interface *ev_int = iio_dev_opaque->event_interface; in iio_event_chrdev_read() local
136 if (kfifo_is_empty(&ev_int->det_events)) { in iio_event_chrdev_read()
140 ret = wait_event_interruptible(ev_int->wait, in iio_event_chrdev_read()
141 !kfifo_is_empty(&ev_int->det_events) || in iio_event_chrdev_read()
149 if (mutex_lock_interruptible(&ev_int->read_lock)) in iio_event_chrdev_read()
151 ret = kfifo_to_user(&ev_int->det_events, buf, count, &copied); in iio_event_chrdev_read()
152 mutex_unlock(&ev_int->read_lock); in iio_event_chrdev_read()
175 struct iio_event_interface *ev_int = iio_dev_opaque->event_interface; in iio_event_chrdev_release() local
177 clear_bit(IIO_BUSY_BIT_POS, &ev_int->flags); in iio_event_chrdev_release()
195 struct iio_event_interface *ev_int = iio_dev_opaque->event_interface; in iio_event_getfd() local
198 if (ev_int == NULL) in iio_event_getfd()
205 if (test_and_set_bit(IIO_BUSY_BIT_POS, &ev_int->flags)) { in iio_event_getfd()
215 clear_bit(IIO_BUSY_BIT_POS, &ev_int->flags); in iio_event_getfd()
218 kfifo_reset_out(&ev_int->det_events); in iio_event_getfd()
546 static void iio_setup_ev_int(struct iio_event_interface *ev_int) in iio_setup_ev_int() argument
548 INIT_KFIFO(ev_int->det_events); in iio_setup_ev_int()
549 init_waitqueue_head(&ev_int->wait); in iio_setup_ev_int()
550 mutex_init(&ev_int->read_lock); in iio_setup_ev_int()
575 struct iio_event_interface *ev_int; in iio_device_register_eventset() local
584 ev_int = kzalloc(sizeof(*ev_int), GFP_KERNEL); in iio_device_register_eventset()
585 if (!ev_int) in iio_device_register_eventset()
588 iio_dev_opaque->event_interface = ev_int; in iio_device_register_eventset()
590 INIT_LIST_HEAD(&ev_int->dev_attr_list); in iio_device_register_eventset()
592 iio_setup_ev_int(ev_int); in iio_device_register_eventset()
606 ev_int->group.name = iio_event_group_name; in iio_device_register_eventset()
607 ev_int->group.attrs = kcalloc(attrcount + 1, in iio_device_register_eventset()
608 sizeof(ev_int->group.attrs[0]), in iio_device_register_eventset()
610 if (ev_int->group.attrs == NULL) { in iio_device_register_eventset()
615 memcpy(ev_int->group.attrs, in iio_device_register_eventset()
617 sizeof(ev_int->group.attrs[0]) * attrcount_orig); in iio_device_register_eventset()
620 list_for_each_entry(p, &ev_int->dev_attr_list, l) in iio_device_register_eventset()
621 ev_int->group.attrs[attrn++] = &p->dev_attr.attr; in iio_device_register_eventset()
623 ret = iio_device_register_sysfs_group(indio_dev, &ev_int->group); in iio_device_register_eventset()
627 ev_int->ioctl_handler.ioctl = iio_event_ioctl; in iio_device_register_eventset()
629 &ev_int->ioctl_handler); in iio_device_register_eventset()
634 kfree(ev_int->group.attrs); in iio_device_register_eventset()
636 iio_free_chan_devattr_list(&ev_int->dev_attr_list); in iio_device_register_eventset()
637 kfree(ev_int); in iio_device_register_eventset()
661 struct iio_event_interface *ev_int = iio_dev_opaque->event_interface; in iio_device_unregister_eventset() local
663 if (ev_int == NULL) in iio_device_unregister_eventset()
666 iio_device_ioctl_handler_unregister(&ev_int->ioctl_handler); in iio_device_unregister_eventset()
667 iio_free_chan_devattr_list(&ev_int->dev_attr_list); in iio_device_unregister_eventset()
668 kfree(ev_int->group.attrs); in iio_device_unregister_eventset()
669 kfree(ev_int); in iio_device_unregister_eventset()