Re: [PATCH v2 01/17] mod_devicetable.h: Split into per subsystem headers
From: Geert Uytterhoeven
Date: Thu Jul 02 2026 - 05:28:45 EST
Hi Uwe,
On Sun, 28 Jun 2026 at 17:11, Uwe Kleine-König (The Capable Hub)
<u.kleine-koenig@xxxxxxxxxxxx> wrote:
> <linux/mod_devicetable.h> is included transitively in nearly every
> driver in an x86_64 allmodconfig build of v7.1:
>
> $ find drivers -name \*.o -not -name \*.mod.o | wc -l
> 21330
> $ find drivers -name \*.o.cmd -not -name \*.mod.o.cmd | xargs grep -l mod_devicetable.h | wc -l
> 17038
>
> The result is that even when touching an obscure device id struct most
> of the kernel needs to be recompiled. Given that each driver typically
> only needs one or two of these structures, splitting into per subsystem
> headers and only including what is really needed reduces the amount of
> needed recompilation.
>
> Implement the first step and define each device id struct in a separate
> header (together with its associated #defines).
>
> <linux/mod_devicetable.h> is modified to include all the new headers to
> continue to provide the same symbols.
>
> Several headers currently include <linux/mod_devicetable.h>, those that
> are most lukrative to include only their subsystem headers only are:
>
> $ git -C source grep -l mod_devicetable.h include/linux | while read h; do echo -n "$h:"; find drivers -name \*.o.cmd -not -name \*.mod.o.cmd | xargs grep -l $h | wc -l; done | sort -t: -k2 -n -r | head
> include/linux/of.h:10897
> include/linux/pci.h:7920
> include/linux/acpi.h:7097
> include/linux/i2c.h:5402
> include/linux/spi/spi.h:1897
> include/linux/dmi.h:1643
> include/linux/usb.h:1222
> include/linux/input.h:1205
> include/linux/mdio.h:835
> include/linux/phy.h:733
>
> struct cpu_feature isn't really a device_id struct. That is kept in
> <linux/mod_devicetable.h> for now.
>
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@xxxxxxxxxxxx>
Thanks for your patch!
> include/linux/mod_device_id/zorro.h | 18 +
> include/linux/mod_devicetable.h | 1014 ++--------------------
For the Zorro parts:
Acked-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> # zorro
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds