Silly bug introduced during the chrdev merge series.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
#ifdef CONFIG_IIO_BUFFER
struct poll_table_struct;
-void iio_chrdev_buffer_open(struct iio_dev *indio_dev);
+int iio_chrdev_buffer_open(struct iio_dev *indio_dev);
void iio_chrdev_buffer_release(struct iio_dev *indio_dev);
unsigned int iio_buffer_poll(struct file *filp,
#else
-static inline void iio_chrdev_buffer_open(struct iio_dev *indio_dev)
-{}
+static inline int iio_chrdev_buffer_open(struct iio_dev *indio_dev)
+{
+ return -EINVAL;
+}
+
static inline void iio_chrdev_buffer_release(struct iio_dev *indio_dev)
{}
return 0;
}
-void iio_chrdev_buffer_open(struct iio_dev *indio_dev)
+int iio_chrdev_buffer_open(struct iio_dev *indio_dev)
{
struct iio_buffer *rb = indio_dev->buffer;
- if (rb && rb->access->mark_in_use)
+ if (!rb)
+ return -EINVAL;
+ if (rb->access->mark_in_use)
rb->access->mark_in_use(rb);
+ return 0;
}
void iio_chrdev_buffer_release(struct iio_dev *indio_dev)
clear_bit(IIO_BUSY_BIT_POS, &rb->flags);
if (rb->access->unmark_in_use)
rb->access->unmark_in_use(rb);
-
}
void iio_buffer_init(struct iio_buffer *buffer, struct iio_dev *dev_info)
struct iio_dev *dev_info = container_of(inode->i_cdev,
struct iio_dev, chrdev);
filp->private_data = dev_info;
- iio_chrdev_buffer_open(dev_info);
- return 0;
+
+ return iio_chrdev_buffer_open(dev_info);
}
/**