From: Jonathan Cameron <jic23@kernel.org>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Alexandru Ardelean <ardeleanalex@gmail.com>,
linux-iio@vger.kernel.org, michael.hennerich@analog.com,
nuno.sa@analog.com, dragos.bogdan@analog.com,
Alexandru Ardelean <alexandru.ardelean@analog.com>
Subject: Re: [RFC PATCH 3/3] iio: buffer: add output buffer support for chrdev
Date: Sun, 5 Apr 2020 11:53:41 +0100 [thread overview]
Message-ID: <20200405115341.631b8769@archlinux> (raw)
In-Reply-To: <db6bdd2b-cb9b-442f-46b9-557e1f31f431@metafoo.de>
On Sun, 5 Apr 2020 11:58:38 +0200
Lars-Peter Clausen <lars@metafoo.de> wrote:
> On 4/5/20 11:57 AM, Lars-Peter Clausen wrote:
> > On 4/5/20 11:49 AM, Jonathan Cameron wrote:
> >>>> 3. A side question is about the 'iio_buffer -> pollq' field. I was
> >>>> wondering if it would make sense to move that on to 'iio_dev
> >>>> pollq' if
> >>>> adding multiple buffers are added per-device. It almost makes sense to
> >>>> unify the 'pollq' on indio_dev.
> >>>> But, it looks a bit difficult, and would require some more change
> >>>> [which is
> >>>> doable] if it makes sense for whatever reason.
> >>>> The only reason to do it, is because the iio_buffer_fileops has a
> >>>> .poll =
> >>>> iio_buffer_poll() function attached to it. Adding multiple buffers
> >>>> for an
> >>>> IIO device may require some consideration on the iio_buffer_poll()
> >>>> function
> >>>> as well.
> >>> I think we need one chardev per buffer. Conceptually that is the right
> >>> approach in my option since the two buffers are independent streams.
> >>> But
> >>> also from a practical point of view we want to have the ability to have
> >>> the buffers opened by different applications. E.g. iio_readdev on the
> >>> input buffer and iio_writedev on the output buffer. And there might be
> >>> some other operations that wont multiplex as nicely as read/write. The
> >>> high speed interface for example would not work as it is right now.
> >>>
> >> Yup. Separate chardev is pretty much the only option given the poll
> >> infrastructure.
> >> In theory could do the anon file trick again but I'm not sure it's
> >> worth it
> >> - the vast majority of drivers are still going to be single buffer (I
> >> think!)
> > The main problem I see with the anon file trick is that we use the
> > open file also as mutual exclusion so only one application can access
> > a buffer at a time. This means if one application has the main chardev
> > open no other application will be able to access the buffers (or events).
>
> And of course also that you can use `cat`, `echo`, `dd` and so on.
True on both counts. For events I'm don't think this restriction really matters
because they are normally fairly tightly coupled to the data stream coming in
etc (though we should do an in kernel consumer at somepoint). I did have a plan
a long time ago to allow additional kfifos to be attached as consumer devices
to allow more complex multi user cases if needed but never implemented it.
Lets not go down the anon route for input vs output buffers as seems entirely
reasonable that they might be used by separate programs.
Jonathan
>
next prev parent reply other threads:[~2020-04-05 10:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-30 14:57 [RFC PATCH 0/3] iio: buffer: add output buffer support for chrdev Alexandru Ardelean
2020-03-30 14:57 ` [RFC PATCH 1/3] iio: core: rename 'indio_dev->buffer_list' -> 'indio_dev->active_buffers' Alexandru Ardelean
2020-04-05 9:56 ` Jonathan Cameron
2020-04-07 7:45 ` Ardelean, Alexandru
2020-03-30 14:57 ` [RFC PATCH 2/3] iio: buffer: extend short-hand use for 'indio_dev->buffer' Alexandru Ardelean
2020-03-30 14:57 ` [RFC PATCH 3/3] iio: buffer: add output buffer support for chrdev Alexandru Ardelean
2020-03-30 15:58 ` Lars-Peter Clausen
2020-03-30 17:27 ` Ardelean, Alexandru
2020-03-30 17:43 ` Lars-Peter Clausen
2020-04-05 9:33 ` Jonathan Cameron
2020-04-05 9:49 ` Jonathan Cameron
2020-04-05 9:57 ` Lars-Peter Clausen
2020-04-05 9:58 ` Lars-Peter Clausen
2020-04-05 10:53 ` Jonathan Cameron [this message]
2020-03-30 14:58 ` [RFC PATCH 0/3] " Ardelean, Alexandru
-- strict thread matches above, loose matches on Subject: below --
2020-03-30 14:56 Alexandru Ardelean
2020-03-30 14:56 ` [RFC PATCH 3/3] " 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=20200405115341.631b8769@archlinux \
--to=jic23@kernel.org \
--cc=alexandru.ardelean@analog.com \
--cc=ardeleanalex@gmail.com \
--cc=dragos.bogdan@analog.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=michael.hennerich@analog.com \
--cc=nuno.sa@analog.com \
/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).