mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Francesco Lavra <flavra@baylibre.com>
To: "David Lechner" <dlechner@baylibre.com>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Jonathan Cameron" <jic23@kernel.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 v8 2/6] iio: Replace 'sign' field with union in struct iio_scan_type
Date: Mon, 23 Mar 2026 17:04:10 +0100	[thread overview]
Message-ID: <af2128c68d2a14e1eb664ce9dc075ed02b640407.camel@baylibre.com> (raw)
In-Reply-To: <4723284d-1e18-4a13-9ec1-878220af257e@baylibre.com>

On Sat, 2026-03-21 at 12:22 -0500, David Lechner wrote:
> On 3/17/26 10:04 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.
> > Opportunistically replace character literals with symbolic constants
> > that
> > represent the set of allowed values for the format field.
> > 
> > Signed-off-by: Francesco Lavra <flavra@baylibre.com>
> > ---
> >  Documentation/driver-api/iio/buffers.rst |  4 ++--
> >  include/linux/iio/iio.h                  | 17 +++++++++++++++--
> >  2 files changed, 17 insertions(+), 4 deletions(-)
> > 
> > diff --git a/Documentation/driver-api/iio/buffers.rst
> > b/Documentation/driver-api/iio/buffers.rst
> > index 63f364e862d1..e16abaf826fe 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 = IIO_SCAN_FORMAT_SIGNED_INT,
> >                            .realbits = 12,
> >                            .storagebits = 16,
> >                            .shift = 4,
> > diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
> > index a9ecff191bd9..d48a0ab01b8d 100644
> > --- a/include/linux/iio/iio.h
> > +++ b/include/linux/iio/iio.h
> > @@ -176,9 +176,19 @@ struct iio_event_spec {
> >         unsigned long mask_shared_by_all;
> >  };
> >  
> > +/*
> > + * Format values in scan type
> > + * @IIO_SCAN_FORMAT_SIGNED_INT: Signed integer (two's complement).
> > + * @IIO_SCAN_FORMAT_UNSIGNED_INT: Unsigned integer.
> > + */
> 
> We could make this proper kernel doc format with one comment per macro.

Actually, a set of related #defines can be documented with a single
comment. I see a few examples doing that in include/linux/gfp_types.h and
include/linux/fpga/fpga-mgr.h


> > +#define IIO_SCAN_FORMAT_SIGNED_INT     's'
> > +#define IIO_SCAN_FORMAT_UNSIGNED_INT   'u'
> > +


  reply	other threads:[~2026-03-23 16:04 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-17 15:03 [PATCH v8 0/6] imu: st_lsm6dsx: Add support for rotation sensor Francesco Lavra
2026-03-17 15:03 ` [PATCH v8 1/6] iio: imu: st_lsm6dsx: Fix check for invalid samples from FIFO Francesco Lavra
2026-03-17 15:04 ` [PATCH v8 2/6] iio: Replace 'sign' field with union in struct iio_scan_type Francesco Lavra
2026-03-21 17:22   ` David Lechner
2026-03-23 16:04     ` Francesco Lavra [this message]
2026-03-23 16:08       ` David Lechner
2026-03-23 16:49       ` Andy Shevchenko
2026-03-23 17:37         ` Francesco Lavra
2026-03-24 11:04           ` Andy Shevchenko
2026-03-24 11:42             ` Francesco Lavra
2026-03-24 11:52               ` Andy Shevchenko
2026-03-17 15:04 ` [PATCH v8 3/6] iio: tools: Add support for floating-point types in buffer scan elements Francesco Lavra
2026-03-21 17:26   ` David Lechner
2026-03-17 15:04 ` [PATCH v8 4/6] iio: ABI: Add support for floating-point numbers " Francesco Lavra
2026-03-17 15:04 ` [PATCH v8 5/6] iio: ABI: Add quaternion axis modifier Francesco Lavra
2026-03-21 17:29   ` David Lechner
2026-03-17 15:04 ` [PATCH v8 6/6] iio: imu: st_lsm6dsx: Add support for rotation sensor Francesco Lavra
2026-03-21 17:46   ` David Lechner
2026-03-21 18:51   ` Jonathan Cameron

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=af2128c68d2a14e1eb664ce9dc075ed02b640407.camel@baylibre.com \
    --to=flavra@baylibre.com \
    --cc=andy@kernel.org \
    --cc=corbet@lwn.net \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --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

Powered by JetHome