Commit aaa0b4f0 authored by Andy Whitcroft's avatar Andy Whitcroft Committed by Linus Torvalds

iio: iio_event_getfd -- fix ev_int build failure

Fix build failure in staging iio driver:

.../drivers/staging/iio/industrialio-core.c: In function 'iio_event_getfd':
.../drivers/staging/iio/industrialio-core.c:262:32: error:
			'ev_int' undeclared (first use in this function)

Also convert the rest of the function to use the new variable.
Signed-off-by: default avatarAndy Whitcroft <apw@canonical.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ac03564f
...@@ -242,25 +242,24 @@ static const struct file_operations iio_event_chrdev_fileops = { ...@@ -242,25 +242,24 @@ static const struct file_operations iio_event_chrdev_fileops = {
static int iio_event_getfd(struct iio_dev *indio_dev) static int iio_event_getfd(struct iio_dev *indio_dev)
{ {
struct iio_event_interface *ev_int = indio_dev->event_interface;
int fd; int fd;
if (indio_dev->event_interface == NULL) if (ev_int == NULL)
return -ENODEV; return -ENODEV;
mutex_lock(&indio_dev->event_interface->event_list_lock); mutex_lock(&ev_int->event_list_lock);
if (test_and_set_bit(IIO_BUSY_BIT_POS, if (test_and_set_bit(IIO_BUSY_BIT_POS, &ev_int->flags)) {
&indio_dev->event_interface->flags)) { mutex_unlock(&ev_int->event_list_lock);
mutex_unlock(&indio_dev->event_interface->event_list_lock);
return -EBUSY; return -EBUSY;
} }
mutex_unlock(&indio_dev->event_interface->event_list_lock); mutex_unlock(&ev_int->event_list_lock);
fd = anon_inode_getfd("iio:event", fd = anon_inode_getfd("iio:event",
&iio_event_chrdev_fileops, &iio_event_chrdev_fileops, ev_int, O_RDONLY);
indio_dev->event_interface, O_RDONLY);
if (fd < 0) { if (fd < 0) {
mutex_lock(&indio_dev->event_interface->event_list_lock); mutex_lock(&ev_int->event_list_lock);
clear_bit(IIO_BUSY_BIT_POS, &ev_int->flags); clear_bit(IIO_BUSY_BIT_POS, &ev_int->flags);
mutex_unlock(&indio_dev->event_interface->event_list_lock); mutex_unlock(&ev_int->event_list_lock);
} }
return fd; return fd;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment