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

From: Andy Shevchenko

Date: Mon Mar 23 2026 - 14:14:20 EST


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',
};


--
With Best Regards,
Andy Shevchenko