Re: [PATCH v8 2/6] iio: Replace 'sign' field with union in struct iio_scan_type

From: Andy Shevchenko

Date: Tue Mar 24 2026 - 08:01:40 EST


On Tue, Mar 24, 2026 at 12:42:19PM +0100, Francesco Lavra wrote:
> On Tue, 2026-03-24 at 13:04 +0200, Andy Shevchenko wrote:
> > On Mon, Mar 23, 2026 at 06:37:38PM +0100, Francesco Lavra wrote:
> > > On Mon, 2026-03-23 at 18:49 +0200, Andy Shevchenko wrote:
> > > > On Mon, Mar 23, 2026 at 05:04:10PM +0100, Francesco Lavra wrote:
> > > > > On Sat, 2026-03-21 at 12:22 -0500, David Lechner wrote:
> > > > > > On 3/17/26 10:04 AM, Francesco Lavra wrote:

...

> > > > > > > + * @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'
> > > >
> > > > ...or use enum
> > > >
> > > > /**
> > > >  * ...kernel-doc for enum...
> > > >  */
> > > > enum {
> > > >         IIO_SCAN_FORMAT_SIGNED_INT = 's',
> > > >         IIO_SCAN_FORMAT_UNSIGNED_INT = 'u',
> > > > };
> > >
> > > There is no standard kernel-doc format for anonymous enums.
> >
> > What do you mean? We have such in kernel, for example,
> > drivers/pinctrl/intel/pinctrl-intel.c.
>
> The kernel-doc guidelines at Documentation/doc-guide/kernel-doc.rst, in the
> section that describe structure, union, and enumeration documentation,
> include the name of the struct in the example, so I thought they wouldn't
> apply to anonymous types. But now I see that anonymous enum comments are
> processed just fine by the kernel-doc tool.
> Anyway, in v9 I switched to one comment per macro, as suggested by David.

WFM, thanks.

--
With Best Regards,
Andy Shevchenko