From: Joshua Crofts <joshua.crofts1@gmail.com>
To: jic23@kernel.org
Cc: dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] iio: mapping file for include-what-you-use tool
Date: Tue, 12 May 2026 07:35:05 +0000 [thread overview]
Message-ID: <20260512073505.1310-1-joshua.crofts1@gmail.com> (raw)
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).
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.
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
---
tools/iio/iio.imp | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
create mode 100644 tools/iio/iio.imp
diff --git a/tools/iio/iio.imp b/tools/iio/iio.imp
new file mode 100644
index 000000000000..c8e9c509bb93
--- /dev/null
+++ b/tools/iio/iio.imp
@@ -0,0 +1,46 @@
+[
+ { "include": ["\"linux/bitops.h\"", "private", "<linux/bitops.h>", "public"] },
+ { "include": ["\"linux/bits.h\"", "private", "<linux/bits.h>", "public"] },
+ { "include": ["\"linux/byteorder/generic.h\"", "private", "<asm/byteorder.h>", "public"] },
+ { "include": ["\"linux/device.h\"", "private", "<linux/device.h>", "public"] },
+ { "include": ["\"linux/ktime.h\"", "private", "<linux/ktime.h>", "public"] },
+ { "include": ["\"linux/limits.h\"", "private", "<linux/limits.h>", "public"] },
+ { "include": ["\"linux/mod_devicetable.h\"", "private", "<linux/mod_devicetable.h>", "public"] },
+ { "include": ["\"linux/mutex_types.h\"", "private", "<linux/mutex.h>", "public"] },
+ { "include": ["\"linux/pm.h\"", "private", "<linux/pm.h>", "public"] },
+ { "include": ["\"linux/sched.h\"", "private", "<linux/sched.h>", "public"] },
+ { "include": ["\"linux/sizes.h\"", "private", "<linux/sizes.h>", "public"] },
+ { "include": ["\"linux/slab.h\"", "private", "<linux/slab.h>", "public"] },
+ { "include": ["\"linux/spi/spi.h\"", "private", "<linux/spi/spi.h>", "public"] },
+ { "include": ["\"linux/spinlock_types.h\"", "private", "<linux/spinlock.h>", "public"] },
+ { "include": ["\"linux/spinlock.h\"", "private", "<linux/spinlock.h>", "public"] },
+ { "include": ["\"linux/stat.h\"", "private", "<linux/stat.h>", "public"] },
+ { "include": ["\"linux/stdarg.h\"", "private", "<linux/stdarg.h>", "public"] },
+ { "include": ["\"linux/stddef.h\"", "private", "<linux/stddef.h>", "public"] },
+ { "include": ["\"linux/string.h\"", "private", "<linux/string.h>", "public"] },
+ { "include": ["\"linux/stringify.h\"", "private", "<linux/stringify.h>", "public"] },
+ { "include": ["\"linux/sysfs.h\"", "private", "<linux/sysfs.h>", "public"] },
+ { "include": ["\"linux/time.h\"", "private", "<linux/time.h>", "public"] },
+ { "include": ["\"linux/timer.h\"", "private", "<linux/timer.h>", "public"] },
+ { "include": ["\"linux/types.h\"", "private", "<linux/types.h>", "public"] },
+ { "include": ["\"linux/uuid.h\"", "private", "<linux/uuid.h>", "public"] },
+ { "include": ["\"linux/wait.h\"", "private", "<linux/wait.h>", "public"] },
+ { "include": ["\"linux/workqueue.h\"", "private", "<linux/workqueue.h>", "public"] },
+
+ { "include": ["\"vdso/bits.h\"", "private", "<linux/bits.h>", "public"] },
+ { "include": ["\"vdso/ktime.h\"", "private", "<linux/ktime.h>", "public"] },
+ { "include": ["\"vdso/limits.h\"", "private", "<linux/limits.h>", "public"] },
+ { "include": ["\"vdso/time64.h\"", "private", "<linux/time64.h>", "public"] },
+
+ { "include": ["\"asm-generic/div64.h\"", "private", "<linux/math64.h>", "public"] },
+ { "include": ["\"asm-generic/errno.h\"", "private", "<linux/errno.h>", "public"] },
+ { "include": ["\"asm-generic/errno-base.h\"", "private", "<linux/errno.h>", "public"] },
+ { "include": ["\"asm-generic/int-ll64.h\"", "private", "<linux/types.h>", "public"] },
+
+ { "include": ["\"linux/iio/types.h\"", "private", "<linux/iio/iio.h>", "public"] },
+
+ { "symbol": ["BIT", "private", "<linux/bits.h>", "public"] },
+ { "symbol": ["BIT", "private", "<linux/bitops.h>", "public"] },
+ { "symbol": ["GENMASK", "private", "<linux/bits.h>", "public"] },
+ { "symbol": ["GENMASK", "private", "<linux/bitops.h>", "public"] }
+]
--
2.47.3
next reply other threads:[~2026-05-12 7:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 7:35 Joshua Crofts [this message]
2026-05-12 7:36 ` [PATCH] iio: mapping file for include-what-you-use tool Joshua Crofts
2026-05-12 8:00 ` Andy Shevchenko
2026-05-12 8:00 ` Andy Shevchenko
2026-05-12 8:04 ` Joshua Crofts
2026-05-12 8:07 ` Andy Shevchenko
2026-05-12 8:10 ` Joshua Crofts
2026-05-12 15:36 ` David Lechner
2026-05-12 15:51 ` Andy Shevchenko
2026-05-12 15:57 ` David Lechner
2026-05-13 8:24 ` Joshua Crofts
2026-05-12 17:07 ` 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=20260512073505.1310-1-joshua.crofts1@gmail.com \
--to=joshua.crofts1@gmail.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@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