Re: [PATCH v1 0/3] <linux/mod_devicetable.h> deprecation continues
From: Nathan Chancellor
Date: Tue Oct 06 2026 - 04:55:54 EST
On Mon, Oct 05, 2026 at 05:23:16PM +0200, Nathan Chancellor wrote:
> > this is a next step in the deprecation of <linux/mod_devicetable.h>.
> > scripts/mod/devicetable-offsets.c and scripts/mod/file2alias.c are the
> > only users of that header that use more than a few device-id structs. So
> > their number of lines actually grows when unfolding the needed includes
> > into them. Still it is a reduction in build dependencies.
> >
> > I suggest to take this via kbuild during the merge window. Would be great to
> > cook in next for a while before.
> >
> > Best regards
> > Uwe
> >
> > Uwe Kleine-König (The Capable Hub) (3):
> > Move struct cpu_feature to <linux/cpufeature.h>
> > devicetable-offsets: Include the needed device-id headers instead of
> > the catch-all
> > file2alias: Include the needed device-id headers instead of the
> > catch-all
> >
> > arch/loongarch/kvm/main.c | 2 +-
> > include/linux/cpufeature.h | 12 ++++++-
> > include/linux/mod_devicetable.h | 13 -------
> > scripts/mod/devicetable-offsets.c | 57 ++++++++++++++++++++++++++++++-
> > scripts/mod/file2alias.c | 56 +++++++++++++++++++++++++++++-
> > 5 files changed, 123 insertions(+), 17 deletions(-)
>
> My apologies for taking some time to get to this. I was planning on
> building it using my personal test matrix on a local machine at home
> while travelling for Plumbers to avoid tying up my main workstation but
> my home's internet connection has been down for two weeks with very
> little hope of getting it online before I am back...
>
> Sashiko has a few comments that seem relevant (most of them are the same
> issue):
>
> https://sashiko.dev/#/patchset/cover.1789988540.git.u.kleine-koenig@xxxxxxxxxxxx
>
> I have applied it on top of next-20261005 to see what conflicts are
> looking like. I see a merge conflict with this series from
>
> d59717cfbe1e ("firmware: arm_scmi: Add SCMI device table alias support")
>
> in the soc tree, which is fairly trivial. There is a semantic conflict
> that results in a build error from
>
> fe7f2a805443 ("firmware: smccc: Add an Arm SMCCC bus")
>
> in the arm64 tree, which is also trivial but subtle.
>
> scripts/mod/devicetable-offsets.c:317:2: error: invalid application of 'sizeof' to an incomplete type 'struct arm_smccc_device_id'
> 317 | DEVID(arm_smccc_device_id);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~
> scripts/mod/devicetable-offsets.c:62:43: note: expanded from macro 'DEVID'
> 62 | #define DEVID(devid) DEFINE(SIZE_##devid, sizeof(struct devid))
> | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
> include/linux/kbuild.h:6:62: note: expanded from macro 'DEFINE'
> 6 | asm volatile("\n.ascii \"->" #sym " %0 " #val "\"" : : "i" (val))
> | ^~~
> scripts/mod/devicetable-offsets.c:317:8: note: forward declaration of 'struct arm_smccc_device_id'
> 317 | DEVID(arm_smccc_device_id);
> | ^
> scripts/mod/devicetable-offsets.c:318:2: error: offsetof of incomplete type 'struct arm_smccc_device_id'
> 318 | DEVID_FIELD(arm_smccc_device_id, func_id);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> scripts/mod/devicetable-offsets.c:64:32: note: expanded from macro 'DEVID_FIELD'
> 64 | DEFINE(OFF_##devid##_##field, offsetof(struct devid, field))
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/stddef.h:16:32: note: expanded from macro 'offsetof'
> 16 | #define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER)
> | ^
> include/linux/kbuild.h:6:62: note: expanded from macro 'DEFINE'
> 6 | asm volatile("\n.ascii \"->" #sym " %0 " #val "\"" : : "i" (val))
> | ^~~
> scripts/mod/devicetable-offsets.c:317:8: note: forward declaration of 'struct arm_smccc_device_id'
> 317 | DEVID(arm_smccc_device_id);
> | ^
> 2 errors generated.
>
> If you would like this in 7.4-rc1, I am not opposed to sticking your v2
> into -next now but I plan to finalize the Kbuild tree for 7.4 around
> October 15, so we'd only get a week or so of build coverage. If that
> feels like too little, we should defer this until after 7.4-rc1 is out.
Two more issues came up in my testing.
ARCH=loongarch defconfig:
In file included from include/linux/mmzone.h:20,
from include/linux/gfp.h:7,
from include/linux/xarray.h:16,
from include/linux/list_lru.h:14,
from include/linux/fs/super_types.h:7,
from include/linux/fs/super.h:5,
from include/linux/fs.h:5,
from arch/loongarch/include/asm/elf.h:9,
from arch/loongarch/include/asm/cpufeature.h:13,
from include/linux/cpufeature.h:23,
from scripts/mod/devicetable-offsets.c:3:
include/linux/page-flags-layout.h:6:10: fatal error: generated/bounds.h: No such file or directory
6 | #include <generated/bounds.h>
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[4]: *** [scripts/Makefile.build:185: scripts/mod/devicetable-offsets.s] Error 1
ARCH=s390 defconfig:
drivers/s390/crypto/pkey_ep11.c:23:28: error: array type has incomplete element type 'struct ap_device_id'
23 | static struct ap_device_id pkey_ep11_card_ids[] = {
| ^~~~~~~~~~~~~~~~~~
make[7]: *** [scripts/Makefile.build:290: drivers/s390/crypto/pkey_ep11.o] Error 1
drivers/s390/crypto/pkey_cca.c:22:28: error: array type has incomplete element type 'struct ap_device_id'
22 | static struct ap_device_id pkey_cca_card_ids[] = {
| ^~~~~~~~~~~~~~~~~
make[7]: *** [scripts/Makefile.build:290: drivers/s390/crypto/pkey_cca.o] Error 1
--
Cheers,
Nathan