Linux Documentation
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: David Lechner <dlechner@baylibre.com>
Cc: "Francesco Lavra" <flavra@baylibre.com>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-iio@vger.kernel.org
Subject: Re: [PATCH v7 2/6] iio: Replace 'sign' field with union in struct iio_scan_type
Date: Sat, 7 Mar 2026 12:47:50 +0000	[thread overview]
Message-ID: <20260307124750.29e7577a@jic23-huawei> (raw)
In-Reply-To: <2110d3be-b55d-4b39-a8f4-ebf1312ada96@baylibre.com>

On Wed, 4 Mar 2026 16:55:42 -0600
David Lechner <dlechner@baylibre.com> wrote:

> On 3/4/26 2:06 AM, Francesco Lavra wrote:
> > This field is used to differentiate between signed and unsigned integers.
> > A following commit will extend its use in order to add support for non-
> > integer scan elements; therefore, replace it with a union that contains a
> > more generic 'format' field. This union will be dropped when all drivers
> > are changed to use the format field.
> > 
> > Signed-off-by: Francesco Lavra <flavra@baylibre.com>
> > ---
> >  Documentation/driver-api/iio/buffers.rst | 4 ++--
> >  include/linux/iio/iio.h                  | 7 +++++--
> >  2 files changed, 7 insertions(+), 4 deletions(-)
> > 
> > diff --git a/Documentation/driver-api/iio/buffers.rst b/Documentation/driver-api/iio/buffers.rst
> > index 63f364e862d1..f36e6d00173f 100644
> > --- a/Documentation/driver-api/iio/buffers.rst
> > +++ b/Documentation/driver-api/iio/buffers.rst
> > @@ -78,7 +78,7 @@ fields in iio_chan_spec definition::
> >     /* other members */
> >             int scan_index
> >             struct {
> > -                   char sign;
> > +                   char format;
> >                     u8 realbits;
> >                     u8 storagebits;
> >                     u8 shift;
> > @@ -98,7 +98,7 @@ following channel definition::
> >  		   /* other stuff here */
> >  		   .scan_index = 0,
> >  		   .scan_type = {
> > -		           .sign = 's',
> > +		           .format = 's',
> >  			   .realbits = 12,
> >  			   .storagebits = 16,
> >  			   .shift = 4,
> > diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
> > index a9ecff191bd9..61f1dfc14e02 100644
> > --- a/include/linux/iio/iio.h
> > +++ b/include/linux/iio/iio.h
> > @@ -178,7 +178,7 @@ struct iio_event_spec {
> >  
> >  /**
> >   * struct iio_scan_type - specification for channel data format in buffer
> > - * @sign:		's' or 'u' to specify signed or unsigned

I think this is going to trigger kernel-doc warnings.  So I'd keep the docs
but mention it's deprecated in favour of format.

> > + * @format:		(signed or unsigned) integer, or floating point  
> 
> We should keep the list of valid values here.
> 
> >   * @realbits:		Number of valid bits of data
> >   * @storagebits:	Realbits + padding
> >   * @shift:		Shift right by this before masking out realbits.
> > @@ -189,7 +189,10 @@ struct iio_event_spec {
> >   * @endianness:		little or big endian
> >   */
> >  struct iio_scan_type {
> > -	char	sign;
> > +	union {
> > +		char sign;
> > +		char format;  
> 
> Could add some comments here to say that format should be used
> in new code and sign will be removed eventually.
> 
> > +	};
> >  	u8	realbits;
> >  	u8	storagebits;
> >  	u8	shift;  
> 


  reply	other threads:[~2026-03-07 12:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260304080519.2844101-1-flavra@baylibre.com>
2026-03-04  8:06 ` [PATCH v7 2/6] iio: Replace 'sign' field with union in struct iio_scan_type Francesco Lavra
2026-03-04 22:55   ` David Lechner
2026-03-07 12:47     ` Jonathan Cameron [this message]
2026-03-07 13:10   ` Jonathan Cameron
2026-03-04  8:06 ` [PATCH v7 4/6] iio: ABI: Add support for floating-point numbers in buffer scan elements Francesco Lavra
2026-03-04 22:45   ` David Lechner
2026-03-05  9:09     ` Francesco Lavra
2026-03-05  9:23       ` Andy Shevchenko
2026-03-05 14:37         ` David Lechner
2026-03-06 12:09           ` Andy Shevchenko
2026-03-07 12:51             ` Jonathan Cameron
2026-03-17 10:40               ` Francesco Lavra

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=20260307124750.29e7577a@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andy@kernel.org \
    --cc=corbet@lwn.net \
    --cc=dlechner@baylibre.com \
    --cc=flavra@baylibre.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=skhan@linuxfoundation.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