linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Alexandru Ardelean <alexandru.ardelean@analog.com>
Cc: <linux-iio@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<lars@metafoo.de>
Subject: Re: [PATCH v3 2/5] iio: buffer: add back-ref from iio_buffer to iio_dev
Date: Mon, 13 Apr 2020 16:48:53 +0100	[thread overview]
Message-ID: <20200413164853.3bd73d25@archlinux> (raw)
In-Reply-To: <20200410141729.82834-3-alexandru.ardelean@analog.com>

On Fri, 10 Apr 2020 17:17:26 +0300
Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:

> 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>

Much as I hate circular references, I can't see a way around this one...

> ---
>  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 e6fa1a4e135d..f9ffc7762f6c 100644
> --- a/drivers/iio/industrialio-buffer.c
> +++ b/drivers/iio/industrialio-buffer.c
> @@ -1478,5 +1478,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 1e7edf6bed96..8fb92250a190 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;
>  


  reply	other threads:[~2020-04-13 15:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-10 14:17 [PATCH v3 0/5] iio: core,buffer: re-organize chardev creation Alexandru Ardelean
2020-04-10 14:17 ` [PATCH v3 1/5] iio: core: register buffer fileops only if buffer present Alexandru Ardelean
2020-04-13 15:47   ` Jonathan Cameron
2020-04-14  5:20     ` Ardelean, Alexandru
2020-04-14  6:07       ` Ardelean, Alexandru
2020-04-10 14:17 ` [PATCH v3 2/5] iio: buffer: add back-ref from iio_buffer to iio_dev Alexandru Ardelean
2020-04-13 15:48   ` Jonathan Cameron [this message]
2020-04-10 14:17 ` [PATCH v3 3/5] iio: buffer: move iio buffer chrdev in industrialio-buffer.c Alexandru Ardelean
2020-04-13 15:58   ` Jonathan Cameron
2020-04-14  5:43     ` Ardelean, Alexandru
2020-04-14 17:50       ` Jonathan Cameron
2020-04-10 14:17 ` [PATCH v3 4/5] iio: buffer: move sysfs alloc/free " Alexandru Ardelean
2020-04-13 16:00   ` Jonathan Cameron
2020-04-10 14:17 ` [PATCH v3 5/5] iio: event: move event-only chardev in industrialio-event.c Alexandru Ardelean
2020-04-12 14:29 ` [PATCH v3 0/5] iio: core,buffer: re-organize chardev creation Ardelean, Alexandru

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=20200413164853.3bd73d25@archlinux \
    --to=jic23@kernel.org \
    --cc=alexandru.ardelean@analog.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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).