Re: [PATCH] mod_devicetable.h: Split into per subsystem headers
From: Linus Torvalds
Date: Mon Jun 22 2026 - 18:07:12 EST
On Mon, 22 Jun 2026 at 14:07, Uwe Kleine-König (The Capable Hub)
<u.kleine-koenig@xxxxxxxxxxxx> wrote:
>
> Maybe it's sensible to adapt the top-5 or so
> headers from the above list in the same go, as these will trigger quite
> some recompilation again!?
Oh, and on this side - I really think the "convert drivers / headers"
should be driven by some automated script.
Literally something that does the equivalent of
for i in include/linux/mod_device_id/*.h
do
# The new include line
line=$(echo $i | sed 's:include/\(.*\)$:#include <\1>:')
# get the struct name with grep/sed/whatever
struct_name=$(grep 'struct.*device_id.*{' $i | ...)
# find any users of it, insert new include
git grep -l "struct $struct_name" -- '*.c' |
xargs sed -i "/mod_devicetable.h/a $line"
done
and after that has script (and by "that script" I don't mean the
above, but some fixed and fleshed-out version that does something
similar) has added all the new includes after the existing
"mod_devicetable.h" include, a final script just removes the
mod_devicetable.h include lines entirely.
That obviously implies that you should also do that "struct cpu_feature" thing.
Anyway, I *think* it's scriptable using something like the above - a
competent person would probably rewrite it into something like perl,
but I'm old and a 'shell script and sed' kind of person, so the above
is meant as a "you get the idea, I'm sure, and can improve on my
broken scripting".
Because doing the 1600+ existing includes by hand sounds like a nightmare.
Linus