Skip to content

Commit

Permalink
iio:buffer: Push implementation of iio_device_attach_buffer into .c file
Browse files Browse the repository at this point in the history
This is a precursor to the splitting of buffer.h into parts relevant
to buffer implementation vs those for devices using buffers.
struct buffer is about to become opaque as far as the header is
concerned.

Signed-off-by: Jonathan Cameron <[email protected]>
Reviewed-by: Lars-Peter Clausen <[email protected]>
  • Loading branch information
jic23 committed Jan 10, 2017
1 parent 19a5a8a commit 2b827ad
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
16 changes: 16 additions & 0 deletions drivers/iio/industrialio-buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1445,3 +1445,19 @@ void iio_buffer_put(struct iio_buffer *buffer)
kref_put(&buffer->ref, iio_buffer_release);
}
EXPORT_SYMBOL_GPL(iio_buffer_put);

/**
* iio_device_attach_buffer - Attach a buffer to a IIO device
* @indio_dev: The device the buffer should be attached to
* @buffer: The buffer to attach to the device
*
* This function attaches a buffer to a IIO device. The buffer stays attached to
* the device until the device is freed. The function should only be called at
* most once per device.
*/
void iio_device_attach_buffer(struct iio_dev *indio_dev,
struct iio_buffer *buffer)
{
indio_dev->buffer = iio_buffer_get(buffer);
}
EXPORT_SYMBOL_GPL(iio_device_attach_buffer);
16 changes: 2 additions & 14 deletions include/linux/iio/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,20 +194,8 @@ bool iio_validate_scan_mask_onehot(struct iio_dev *indio_dev,
struct iio_buffer *iio_buffer_get(struct iio_buffer *buffer);
void iio_buffer_put(struct iio_buffer *buffer);

/**
* iio_device_attach_buffer - Attach a buffer to a IIO device
* @indio_dev: The device the buffer should be attached to
* @buffer: The buffer to attach to the device
*
* This function attaches a buffer to a IIO device. The buffer stays attached to
* the device until the device is freed. The function should only be called at
* most once per device.
*/
static inline void iio_device_attach_buffer(struct iio_dev *indio_dev,
struct iio_buffer *buffer)
{
indio_dev->buffer = iio_buffer_get(buffer);
}
void iio_device_attach_buffer(struct iio_dev *indio_dev,
struct iio_buffer *buffer);

#else /* CONFIG_IIO_BUFFER */

Expand Down

0 comments on commit 2b827ad

Please sign in to comment.