Re: [PATCH] mod_devicetable.h: Split into per subsystem headers
From: Uwe Kleine-König (The Capable Hub)
Date: Tue Jun 23 2026 - 10:49:07 EST
Hello Linus,
On Mon, Jun 22, 2026 at 03:06:43PM -0700, Linus Torvalds wrote:
> 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.
I think it's ok to not include <linux/mod_device_id/$something.h> if
<linux/$something.h> is included. With that my current expectation is
that there isn't much to do apart from identifying the files that rely
on <linux/$somethingelse.h> to pull in mod_devicetable.h providing
${something}_device_id.
I wrote a script---I don't feel that old, so I picked Python :-)---that
knows about these correlations and currently I have ~700 files left to
check.
So in the end I expect a handful of driver patches plus switching the
the most important (or maybe all) <linux/$something.h>s from
<linux/mod_devicetable.h> to <linux/mod_device_id/$something>.
I guess that is ok then, too?
> That obviously implies that you should also do that "struct
> cpu_feature" thing.
My plan for that is to keep it in <linux/mod_devicetable.h> for now and
then sort it out once linux/mod_devicetable.h has less impact on the
whole tree.
Best regards
Uwe
Attachment:
signature.asc
Description: PGP signature