]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mod_devicetable.h: Split into per subsystem headers
authorUwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Tue, 30 Jun 2026 09:24:20 +0000 (11:24 +0200)
committerUwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Fri, 3 Jul 2026 05:37:43 +0000 (07:37 +0200)
commitad428f5811bd7fb3d91fa002174de533f9da94d7
treeaee60b8200d3570af5afa3a007a27cbd0e92e5d8
parentdc59e4fea9d83f03bad6bddf3fa2e52491777482
mod_devicetable.h: Split into per subsystem headers

<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.

Acked-by: Danilo Krummrich <dakr@kernel.org>
Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # zorro
Link: https://patch.msgid.link/41400e323be8640702b906d04327e833c5bdaf4a.1782808461.git.u.kleine-koenig@baylibre.com
[Drop "MOD" from the header guards]
Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
57 files changed:
include/linux/device-id/acpi.h [new file with mode: 0644]
include/linux/device-id/amba.h [new file with mode: 0644]
include/linux/device-id/ap.h [new file with mode: 0644]
include/linux/device-id/apr.h [new file with mode: 0644]
include/linux/device-id/auxiliary.h [new file with mode: 0644]
include/linux/device-id/bcma.h [new file with mode: 0644]
include/linux/device-id/ccw.h [new file with mode: 0644]
include/linux/device-id/cdx.h [new file with mode: 0644]
include/linux/device-id/coreboot.h [new file with mode: 0644]
include/linux/device-id/css.h [new file with mode: 0644]
include/linux/device-id/dfl.h [new file with mode: 0644]
include/linux/device-id/dmi.h [new file with mode: 0644]
include/linux/device-id/eisa.h [new file with mode: 0644]
include/linux/device-id/fsl_mc.h [new file with mode: 0644]
include/linux/device-id/hda.h [new file with mode: 0644]
include/linux/device-id/hid.h [new file with mode: 0644]
include/linux/device-id/hv_vmbus.h [new file with mode: 0644]
include/linux/device-id/i2c.h [new file with mode: 0644]
include/linux/device-id/i3c.h [new file with mode: 0644]
include/linux/device-id/ieee1394.h [new file with mode: 0644]
include/linux/device-id/input.h [new file with mode: 0644]
include/linux/device-id/ipack.h [new file with mode: 0644]
include/linux/device-id/isapnp.h [new file with mode: 0644]
include/linux/device-id/ishtp.h [new file with mode: 0644]
include/linux/device-id/mcb.h [new file with mode: 0644]
include/linux/device-id/mdio.h [new file with mode: 0644]
include/linux/device-id/mei_cl.h [new file with mode: 0644]
include/linux/device-id/mhi.h [new file with mode: 0644]
include/linux/device-id/mips_cdmm.h [new file with mode: 0644]
include/linux/device-id/of.h [new file with mode: 0644]
include/linux/device-id/parisc.h [new file with mode: 0644]
include/linux/device-id/pci.h [new file with mode: 0644]
include/linux/device-id/pcmcia.h [new file with mode: 0644]
include/linux/device-id/platform.h [new file with mode: 0644]
include/linux/device-id/pnp.h [new file with mode: 0644]
include/linux/device-id/rio.h [new file with mode: 0644]
include/linux/device-id/rpmsg.h [new file with mode: 0644]
include/linux/device-id/sdio.h [new file with mode: 0644]
include/linux/device-id/sdw.h [new file with mode: 0644]
include/linux/device-id/serio.h [new file with mode: 0644]
include/linux/device-id/slim.h [new file with mode: 0644]
include/linux/device-id/spi.h [new file with mode: 0644]
include/linux/device-id/spmi.h [new file with mode: 0644]
include/linux/device-id/ssam.h [new file with mode: 0644]
include/linux/device-id/ssb.h [new file with mode: 0644]
include/linux/device-id/tb.h [new file with mode: 0644]
include/linux/device-id/tee_client.h [new file with mode: 0644]
include/linux/device-id/typec.h [new file with mode: 0644]
include/linux/device-id/ulpi.h [new file with mode: 0644]
include/linux/device-id/usb.h [new file with mode: 0644]
include/linux/device-id/vchiq.h [new file with mode: 0644]
include/linux/device-id/vio.h [new file with mode: 0644]
include/linux/device-id/virtio.h [new file with mode: 0644]
include/linux/device-id/wmi.h [new file with mode: 0644]
include/linux/device-id/x86_cpu.h [new file with mode: 0644]
include/linux/device-id/zorro.h [new file with mode: 0644]
include/linux/mod_devicetable.h