From: Alexandru Ardelean <alexandru.ardelean@analog.com>
To: <linux-iio@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <lars@metafoo.de>, <jic23@kernel.org>, <pmeerw@pmeerw.net>,
Alexandru Ardelean <alexandru.ardelean@analog.com>
Subject: [PATCH v4 2/7] iio: buffer: add back-ref from iio_buffer to iio_dev
Date: Fri, 24 Apr 2020 07:56:37 +0300 [thread overview]
Message-ID: <20200424045642.4903-3-alexandru.ardelean@analog.com> (raw)
In-Reply-To: <20200424045642.4903-1-alexandru.ardelean@analog.com>
An IIO device will have multiple buffers, but it shouldn't be allowed that
an IIO buffer should belong to more than 1 IIO device.
Once things get moved more from IIO device to the IIO buffer, and an IIO
device will be able to have more than 1 buffer attached, there will be a
need for a back-ref to the IIO device [from the IIO buffer].
This change adds that.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
drivers/iio/industrialio-buffer.c | 2 ++
include/linux/iio/buffer_impl.h | 3 +++
2 files changed, 5 insertions(+)
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index f8706b065247..68c276edb071 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -1458,5 +1458,7 @@ void iio_device_attach_buffer(struct iio_dev *indio_dev,
struct iio_buffer *buffer)
{
indio_dev->buffer = iio_buffer_get(buffer);
+
+ indio_dev->buffer->indio_dev = indio_dev;
}
EXPORT_SYMBOL_GPL(iio_device_attach_buffer);
diff --git a/include/linux/iio/buffer_impl.h b/include/linux/iio/buffer_impl.h
index a63dc07b7350..67d73d465e02 100644
--- a/include/linux/iio/buffer_impl.h
+++ b/include/linux/iio/buffer_impl.h
@@ -69,6 +69,9 @@ struct iio_buffer_access_funcs {
* those writing new buffer implementations.
*/
struct iio_buffer {
+ /** @indio_dev: IIO device to which this buffer belongs to. */
+ struct iio_dev *indio_dev;
+
/** @length: Number of datums in buffer. */
unsigned int length;
--
2.17.1
next prev parent reply other threads:[~2020-04-24 4:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-24 4:56 [PATCH v4 0/7] iio: core,buffer: re-organize chardev creation Alexandru Ardelean
2020-04-24 4:56 ` [PATCH v4 1/7] iio: Use an early return in iio_device_alloc to simplify code Alexandru Ardelean
2020-04-26 7:28 ` Ardelean, Alexandru
2020-04-24 4:56 ` Alexandru Ardelean [this message]
2020-04-24 4:56 ` [PATCH v4 3/7] iio: core,buffer: wrap iio_buffer_put() call into iio_buffers_put() Alexandru Ardelean
2020-04-24 4:56 ` [PATCH v4 4/7] iio: core: register chardev only if needed Alexandru Ardelean
2020-04-24 4:56 ` [PATCH v4 5/7] iio: buffer,event: duplicate chardev creation for buffers & events Alexandru Ardelean
2020-04-24 4:56 ` [PATCH v4 6/7] iio: core: add simple centralized mechanism for ioctl() handlers Alexandru Ardelean
2020-04-24 4:56 ` [PATCH v4 7/7] iio: core: use new common ioctl() mechanism Alexandru Ardelean
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=20200424045642.4903-3-alexandru.ardelean@analog.com \
--to=alexandru.ardelean@analog.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®