From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: Rodrigo Alencar <455.rodrigo.alencar@gmail.com>,
rodrigo.alencar@analog.com, linux-kernel@vger.kernel.org,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
Michael Hennerich <Michael.Hennerich@analog.com>,
Lars-Peter Clausen <lars@metafoo.de>,
David Lechner <dlechner@baylibre.com>,
Andy Shevchenko <andy@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>
Subject: Re: [PATCH v4 03/11] iio: amplifiers: ad8366: remove unused include headers
Date: Sat, 14 Feb 2026 18:30:51 +0000 [thread overview]
Message-ID: <20260214183051.712c8c4b@jic23-huawei> (raw)
In-Reply-To: <aYyFpFAQcfn7Qifn@smile.fi.intel.com>
On Wed, 11 Feb 2026 15:35:32 +0200
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> 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.
Worth noting that I'm still evolving my config and suspect there will still
be a bit of 'taste' applied to the output even once I conclude what the
best combinations are. So to give my view on the following..
> #include <stddef.h> // for NULL
Not this one.
> #include "asm-generic/errno-base.h" // for EINVAL, ENOMEM
Something to get to errnos is good, but not that one.
> #include "linux/array_size.h" // for ARRAY_SIZE
Yes - this is part of the kernel.h split up work.
> #include "linux/compiler_attributes.h" // for __aligned
Never that one, but I sometimes feel compiler.h is fine.
> #include "linux/dev_printk.h" // for dev_err
Yes if device.h doesn't have to be there for other reasons.
> #include "linux/iio/types.h" // for iio_chan_info_enum, iio_chan_...
No. We always need iio.h which will always include that.
> #include "linux/math.h" // for abs
yes
> #include "linux/minmax.h" // for __cmp_op_max
yes
> #include "linux/mod_devicetable.h" // for spi_device_id
yes
> #include "linux/mutex.h" // for mutex_lock, mutex_unlock, mut...
yes
> #include "linux/mutex_types.h" // for mutex
no as mutex.h will alays include that.
> #include "vdso/bits.h" // for BIT
Usually via bitops.h or similar. But if none of those are there anyway linux/bits.h
Jonathan
>
> 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".
>
next prev parent reply other threads:[~2026-02-14 18:31 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-10 19:42 [PATCH v4 00/11] iio: amplifiers: ad8366: driver update and dt support Rodrigo Alencar via B4 Relay
2026-02-10 19:42 ` [PATCH v4 01/11] MAINTAINERS: Add missing maintainer entry for AD8366 driver Rodrigo Alencar via B4 Relay
2026-02-10 19:42 ` [PATCH v4 02/11] dt-bindings: iio: amplifiers: Add AD8366 support Rodrigo Alencar via B4 Relay
2026-02-10 19:42 ` [PATCH v4 03/11] iio: amplifiers: ad8366: remove unused include headers Rodrigo Alencar via B4 Relay
2026-02-10 19:57 ` Andy Shevchenko
2026-02-11 12:55 ` Rodrigo Alencar
2026-02-11 13:35 ` Andy Shevchenko
2026-02-14 18:30 ` Jonathan Cameron [this message]
2026-02-15 7:31 ` Andy Shevchenko
2026-02-15 16:03 ` Jonathan Cameron
2026-02-10 19:42 ` [PATCH v4 04/11] iio: amplifiers: ad8366: add local dev pointer to the probe function Rodrigo Alencar via B4 Relay
2026-02-10 19:58 ` Andy Shevchenko
2026-02-10 20:03 ` Andy Shevchenko
2026-02-14 18:34 ` Jonathan Cameron
2026-02-10 19:42 ` [PATCH v4 05/11] iio: amplifiers: ad8366: use devm_mutex_init() and drop mutex_init() Rodrigo Alencar via B4 Relay
2026-02-10 20:00 ` Andy Shevchenko
2026-02-14 18:36 ` Jonathan Cameron
2026-02-15 7:50 ` Andy Shevchenko
2026-02-10 19:42 ` [PATCH v4 06/11] iio: amplifiers: ad8366: replace reset-gpio with reset controller Rodrigo Alencar via B4 Relay
2026-02-14 18:37 ` Jonathan Cameron
2026-02-10 19:42 ` [PATCH v4 07/11] iio: amplifiers: ad8366: refactor device resource management Rodrigo Alencar via B4 Relay
2026-02-10 20:05 ` Andy Shevchenko
2026-02-11 12:10 ` Rodrigo Alencar
2026-02-11 13:30 ` Andy Shevchenko
2026-02-14 18:44 ` Jonathan Cameron
2026-02-10 19:42 ` [PATCH v4 08/11] iio: amplifiers: ad8366: prepare for device-tree support Rodrigo Alencar via B4 Relay
2026-02-14 18:56 ` Jonathan Cameron
2026-02-10 19:42 ` [PATCH v4 09/11] iio: amplifiers: ad8366: add device tree support Rodrigo Alencar via B4 Relay
2026-02-14 19:00 ` Jonathan Cameron
2026-02-10 19:42 ` [PATCH v4 10/11] iio: amplifiers: ad8366: consume enable gpio Rodrigo Alencar via B4 Relay
2026-02-10 19:42 ` [PATCH v4 11/11] iio: amplifiers: ad8366: update device support Rodrigo Alencar via B4 Relay
2026-02-14 19:02 ` 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=20260214183051.712c8c4b@jic23-huawei \
--to=jic23@kernel.org \
--cc=455.rodrigo.alencar@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=rodrigo.alencar@analog.com \
/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