From: Ben Collins <bcollins@kernel.org>
To: David Lechner <dlechner@baylibre.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Antoniu Miclaus" <antoniu.miclaus@analog.com>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 1/5] iio: core: Add IIO_VAL_EMPTY type
Date: Tue, 26 Aug 2025 14:52:27 -0400 [thread overview]
Message-ID: <2025082614-passionate-panther-8016ba@boujee-and-buff> (raw)
In-Reply-To: <9fd7f08f-51cc-4155-a5e2-c6ba2f1c4897@baylibre.com>
On Tue, Aug 26, 2025 at 12:00:05PM -0500, David Lechner wrote:
> On 8/25/25 7:10 PM, Ben Collins wrote:
> > In certain situations it may be necessary to return nothing when reading
> > an attribute.
> >
> > For example, when a driver has a filter_type of "none" it should not
> > print any information for frequency or available frequencies.
> >
> > Signed-off-by: Ben Collins <bcollins@kernel.org>
> > ---
> > drivers/iio/industrialio-core.c | 1 +
> > include/linux/iio/types.h | 1 +
> > 2 files changed, 2 insertions(+)
> >
> > diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> > index 159d6c5ca3cec3f5c37ee9b85ef1681cca36f5c7..e4ff5b940223ab58bf61b394cc9357cd3674cfda 100644
> > --- a/drivers/iio/industrialio-core.c
> > +++ b/drivers/iio/industrialio-core.c
> > @@ -702,6 +702,7 @@ static ssize_t __iio_format_value(char *buf, size_t offset, unsigned int type,
> > case IIO_VAL_INT_64:
> > tmp2 = (s64)((((u64)vals[1]) << 32) | (u32)vals[0]);
> > return sysfs_emit_at(buf, offset, "%lld", tmp2);
> > + case IIO_VAL_EMPTY:
> > default:
> > return 0;
> > }
> > diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
> > index ad2761efcc8315e1f9907d2a7159447fb463333e..261745c2d94e582bcca1a2abb297436e8314c930 100644
> > --- a/include/linux/iio/types.h
> > +++ b/include/linux/iio/types.h
> > @@ -32,6 +32,7 @@ enum iio_event_info {
> > #define IIO_VAL_FRACTIONAL 10
> > #define IIO_VAL_FRACTIONAL_LOG2 11
> > #define IIO_VAL_CHAR 12
> > +#define IIO_VAL_EMPTY 13
> >
> > enum iio_available_type {
> > IIO_AVAIL_LIST,
> >
>
> This is an interesting idea, but I think it would be a lot of work
> to teach existing userspace tools to handle this new possibility.
>
> On top of that, I'm not quite convinced it is necessary. If a numeric
> value is undefined, then there is already a well known expression for
> that: "nan". Or in the case of this series, the 3dB point when the
> filter is disable could also be considered "inf". Using these would have
> a better chance of working with existing userspace tools since things
> like `scanf()` can already handle these.
I'm ok with "inf", but then would there also be an "inf" in available
frequencies?
This would take us all the way back to where I could just not even need
a filter_type==none and make the 3db available values:
{ inf, 0.5xxx, ... }
And inf would just be the filter is disabled.
--
Ben Collins
https://libjwt.io
https://github.com/benmcollins
--
3EC9 7598 1672 961A 1139 173A 5D5A 57C7 242B 22CF
next prev parent reply other threads:[~2025-08-26 18:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-26 0:10 [PATCH v7 0/5] iio: mcp9600: Implement IIR feature and add iio core support Ben Collins
2025-08-26 0:10 ` [PATCH v7 1/5] iio: core: Add IIO_VAL_EMPTY type Ben Collins
2025-08-26 17:00 ` David Lechner
2025-08-26 18:52 ` Ben Collins [this message]
2025-08-31 15:19 ` Jonathan Cameron
2025-08-26 0:10 ` [PATCH v7 2/5] ABI: sysfs-bus-iio: Disambiguate usage for filter_type "none" Ben Collins
2025-08-26 0:10 ` [PATCH v7 3/5] ABI: sysfs-bus-iio: Document "ema" filter_type Ben Collins
2025-08-26 0:10 ` [PATCH v7 4/5] iio: mcp9600: Add support for IIR filter Ben Collins
2025-08-26 17:20 ` David Lechner
2025-08-26 19:08 ` Ben Collins
2025-08-26 0:10 ` [PATCH v7 5/5] iio: ad4080: Rework filter_type "none" logic Ben Collins
2025-08-26 16:51 ` David Lechner
2025-08-26 19:11 ` Ben Collins
2025-08-31 15:25 ` Jonathan Cameron
2025-08-26 8:14 ` [PATCH v7 0/5] iio: mcp9600: Implement IIR feature and add iio core support Andy Shevchenko
2025-08-26 9:38 ` Ben Collins
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=2025082614-passionate-panther-8016ba@boujee-and-buff \
--to=bcollins@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=antoniu.miclaus@analog.com \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®