Re: [PATCH v7 4/6] iio: ABI: Add support for floating-point numbers in buffer scan elements

From: Francesco Lavra

Date: Thu Mar 05 2026 - 04:17:02 EST


On Wed, 2026-03-04 at 16:45 -0600, David Lechner wrote:
> On 3/4/26 2:06 AM, Francesco Lavra wrote:
> > In the data storage description of a scan element, the first character
> > after the colon can have the values 's' and 'u' to specify signed and
> > unsigned integers, respectively.
> > Add 'f' as an allowed value to specify floating-point numbers formatted
> > according to the IEEE 754 standard.
> >
> ...
>
> > diff --git a/Documentation/driver-api/iio/buffers.rst
> > b/Documentation/driver-api/iio/buffers.rst
> > index f36e6d00173f..2fc9c2951a9d 100644
> > --- a/Documentation/driver-api/iio/buffers.rst
> > +++ b/Documentation/driver-api/iio/buffers.rst
> > @@ -37,9 +37,10 @@ directory contains attributes of the following form:
> >  * :file:`index`, the scan_index of the channel.
> >  * :file:`type`, description of the scan element data storage within
> > the buffer
> >    and hence the form in which it is read from user space.
> > -  Format is [be|le]:[s|u]bits/storagebits[Xrepeat][>>shift] .
> > +  Format is [be|le]:[f|s|u]bits/storagebits[Xrepeat][>>shift] .
> >  
> >    * *be* or *le*, specifies big or little endian.
> > +  * *f*, specifies if floating-point.
> >    * *s* or *u*, specifies if signed (2's complement) or unsigned.
>
> I would keep all of the format options on one bullet point.

That's what I did initially, but Andy suggested doing differently [1].


> >    * *bits*, is the number of valid data bits.
> >    * *storagebits*, is the number of bits (after padding) that it
> > occupies in the
> > diff --git a/Documentation/iio/iio_devbuf.rst
> > b/Documentation/iio/iio_devbuf.rst
> > index dca1f0200b0d..e91730fa3cea 100644
> > --- a/Documentation/iio/iio_devbuf.rst
> > +++ b/Documentation/iio/iio_devbuf.rst
> > @@ -83,9 +83,10 @@ and the relevant _type attributes to establish the
> > data storage format.
> >  
> >  Read-only attribute containing the description of the scan element
> > data storage
> >  within the buffer and hence the form in which it is read from
> > userspace. Format
> > -is [be|le]:[s|u]bits/storagebits[Xrepeat][>>shift], where:
> > +is [be|le]:[f|s|u]bits/storagebits[Xrepeat][>>shift], where:
> >  
> >  - **be** or **le** specifies big or little-endian.
> > +- **f** specifies if floating-point.
> >  - **s** or **u** specifies if signed (2's complement) or unsigned.
>
> same here

[1] https://lore.kernel.org/linux-iio/aZ7dCdLs5xcJ4UGW@xxxxxxxxxxxxxxxxxx/
>