From: Jonathan Cameron <jic23@kernel.org>
To: linux-iio@vger.kernel.org
Cc: Daniel Baluta <daniel.baluta@gmail.com>,
Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
Jonathan Cameron <jic23@kernel.org>
Subject: [PATCH 09/11] iio:buffer: Push implementation of iio_device_attach_buffer into .c file
Date: Mon, 2 Jan 2017 19:28:32 +0000 [thread overview]
Message-ID: <20170102192834.26546-10-jic23@kernel.org> (raw)
In-Reply-To: <20170102192834.26546-1-jic23@kernel.org>
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 <jic23@kernel.org>
---
drivers/iio/industrialio-buffer.c | 16 ++++++++++++++++
include/linux/iio/buffer.h | 17 ++---------------
2 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index 0067e184c9ae..a04498231f94 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -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);
diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h
index 8c915c2c18f1..45a8d59e39cd 100644
--- a/include/linux/iio/buffer.h
+++ b/include/linux/iio/buffer.h
@@ -194,26 +194,13 @@ 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);
-}
-
#else /* CONFIG_IIO_BUFFER */
static inline void iio_buffer_get(struct iio_buffer *buffer) {}
static inline void iio_buffer_put(struct iio_buffer *buffer) {}
+void iio_device_attach_buffer(struct iio_dev *indio_dev,
+ struct iio_buffer *buffer);
#endif /* CONFIG_IIO_BUFFER */
#endif /* _IIO_BUFFER_GENERIC_H_ */
--
2.11.0
next prev parent reply other threads:[~2017-01-02 19:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-02 19:28 [PATCH 00/11] buffer.h cleanup and split Jonathan Cameron
2017-01-02 19:28 ` [PATCH 01/11] iio:buffer: Stop exporting iio_update_demux Jonathan Cameron
2017-01-02 19:28 ` [PATCH 02/11] iio:buffer.h Reformat structure comments to be inline Jonathan Cameron
2017-01-02 19:28 ` [PATCH 03/11] iio:buffer: Introduced a function to assign the buffer specific attrs Jonathan Cameron
2017-01-02 19:28 ` [PATCH 04/11] iio:buffer: Stop exporting iio_scan_mask_query Jonathan Cameron
2017-01-02 19:28 ` [PATCH 05/11] iio:buffers: Push some docs down into the .c file Jonathan Cameron
2017-01-02 19:28 ` [PATCH 06/11] iio:buffer:iio_push_to_buffers_with_timestamp fix kernel-doc Jonathan Cameron
2017-01-02 19:28 ` [PATCH 07/11] iio:kfifo_buf header include push down Jonathan Cameron
2017-01-07 21:52 ` Jonathan Cameron
2017-01-02 19:28 ` [PATCH 08/11] iio:buffer.h include pushdown into buffer implementations Jonathan Cameron
2017-01-02 19:28 ` Jonathan Cameron [this message]
2017-01-07 22:00 ` [PATCH 09/11] iio:buffer: Push implementation of iio_device_attach_buffer into .c file Jonathan Cameron
2017-01-02 19:28 ` [PATCH 10/11] iio:dummy: Stop enabling timestamp by default Jonathan Cameron
2017-01-02 19:28 ` [PATCH 11/11] iio:buffer.h - split into buffer.h and buffer_impl.h Jonathan Cameron
2017-01-04 18:41 ` [PATCH 00/11] buffer.h cleanup and split Lars-Peter Clausen
2017-01-07 19:45 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170102192834.26546-10-jic23@kernel.org \
--to=jic23@kernel.org \
--cc=daniel.baluta@gmail.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).