Re: [PATCH v4 03/11] iio: amplifiers: ad8366: remove unused include headers

From: Andy Shevchenko

Date: Wed Feb 11 2026 - 08:36:23 EST


On Wed, Feb 11, 2026 at 12:55:30PM +0000, Rodrigo Alencar wrote:
> On 26/02/10 09:57PM, Andy Shevchenko wrote:
> > On Tue, Feb 10, 2026 at 07:42:03PM +0000, Rodrigo Alencar via B4 Relay wrote:
> >
> > > Apply IWYU principle, removing the following headers:
> > > - linux/device.h: no usage of devm_add_action_or_reset, device_attr...
> > > - linux/kernel.h: no usage of container_of, kasprintf, ...
> > > - linux/slab.h: memory management handled by iio
> > > - linux/sysfs.h: sysfs interaction is managed by iio
> > > - linux/iio/sysfs.h: not using iio device attributes in this driver
> >
> > Yeah, but it also means to add (a lot of) missed headers...
> >
> > array_size,h
> > dev_printk.h
> > mod_devicetable.h
> > mutex.h
> > stddef.h
>
> Are there proper guidelines for IWYU in the kernel?
> Include headers end up including a bunch of others, so
> the build finishes successfully anyways.

This is global stuff, no need to repeat this in the kernel documentation.
It's the same as asking documentation for KISS principle.

> I understand that the concern is build time, so we better
> include all small parts that are needed rather than a generic
> header that includes that and much more.

> This is the output of the iwyu tool without this patch series:

Have you applied the configuration Jonathan made for this tool in relation
to the Linux kernel project? By default the tool has a lot of noise, indeed.

And note, tool != principle. The tool is just an implementation of the helper
to enforce the principle in practice, but it may be not always suitable for
the certain project "as is".

In the below output some are valid, but some are just noise as there are
guarantees for the "proxying".

--
With Best Regards,
Andy Shevchenko