Re: [PATCH] mod_devicetable.h: Split into per subsystem headers

From: Linus Torvalds

Date: Wed Jun 24 2026 - 12:43:23 EST


On Tue, 23 Jun 2026 at 23:31, Uwe Kleine-König (The Capable Hub)
<u.kleine-koenig@xxxxxxxxxxxx> wrote:
>
> Heads up: It's not as easy as anticipated. Two (similar) types of
> difficulties I hit are:
>
> - drivers/platform/x86/msi-ec.c doesn't include
> <linux/mod_devicetable.h> but (e.g.) <linux/acpi.h>.

So this is why I really think you need to just automate it.

Do a script that is just based around

git grep 'struct [a-z0-9_]*device_id\>'

and makes sure that the proper header exists each file.

There's a ton of those, and many of those files are
architecture-specific. And not all of them may be actually from the
old mod_devicetable.h header: some random grepping found things like
"struct gio_device_id" in the MIPS tree which is something else
entirely.

So the script probably needs to be fairly flexible, but I really think
there should be some automated part here, because there's just a *lot*
of possible cases:

$ git grep -l 'struct [a-z0-9_]*device_id\>' | wc -l
9496

(although in fairness, about 6k of those files are from just
"of_device_id", so handling just a few handful of the most common
cases probably will take care of 90% of it).

> - <linux/of_platform.h> makes use of resource_size_t. That was defined
> before via <linux/mod_devicetable.h> -> <linux/types.h>, but
> <linux/mod_device_id/of.h> doesn't include <linux/types.h>. Just
> adding that to be sure not to introduce build regessions is sad.

This kind of issue is probably inevitable. *Some* "find problems by
build errors" will happen when it's this massive a re-org. I think
that pain is worth it, as long as some basic automation means that all
the normal cases are handled.

Linus