Re: [PATCH] iio: mapping file for include-what-you-use tool
From: David Lechner
Date: Tue May 12 2026 - 11:41:25 EST
On 5/12/26 2:35 AM, Joshua Crofts wrote:
> As promised, I'm sending my IWYU mapping file, based on Jonathan's
> version with a few additional tweaks by me.
>
> Other than adding support for more assembly file business, I've also
> experimented with individual symbol definition (see BIT() and GENMASK()
> in the following file) - this is to prevent issues such as the tool
> wanting you to include <linux/bits.h> when you already have
> <linux/bitops.h> in the source file (I agree, doing this symbol by
> symbol is tedious, but BIT() and GENMASK() are symbols that especially
> do this, and they're included in most, if not all drivers).
TBH, I would favor rules that are easy for machines over rules that
follow existing human conventions. Is there really anything terribly
wrong with including both bits.h and bitops.h other than "convention"?
>
> Feel free to improve this file and pass it on. I wouldn't really fully
> rely on IWYU as even with the mapping file the results can be weird,
> but it definitely serves as a good starting point when doing driver
> cleanup.
>
> I'm making this patch an RFC - this is not intended for merging.
>
Sharing it is nice. Automating it would be amazing.
Not sure what the best way to do this would be though. I've considered
the idea of having an IIO linting service that could run iwyu and some
other checkers that catch common issues, like spaces in { }, where and
where not to use trailing commas, etc.
At first, it could just post the results on a public page (like sashisko).
And if it ends up working well, it could eventually automatically reply
to patch emails.
The hardest part would be finding someone willing to host and maintain it.