Re: [PATCH v6 1/2] of: kobj: export of_node_ktype for use by modules

Rob Herring <[email protected]> Tue, 21 Jul 2026 08:37:47 -0500
Newsgroups dev.linux.lists.driver-core,dev.linux.lists.imx,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel
Message-ID <CAL_JsqKEUMW1UXmWJ8AEpSOjVuc5bL3wKY39Y1XXXNtk967JMg@mail.gmail.com>
On Tue, Jul 21, 2026 at 5:51 AM Xu Yang <[email protected]> wrote:
>
> From: Xu Yang <[email protected]>
>
> of_node_init() is a static inline that references of_node_ktype when
> CONFIG_OF_KOBJ=y. Any module that calls of_node_init() will therefore
> have an unresolved reference to of_node_ktype at load time, because
> the symbol is defined in drivers/of/kobj.c but was never exported.
>
> This causes a modpost build error when CONFIG_OF_KOBJ=y and
> CONFIG_DRIVER_PE_KUNIT_TEST=m:
>
>   ERROR: modpost: "of_node_ktype"
>   [drivers/base/test/property-entry-test.ko] undefined!
>
> Add EXPORT_SYMBOL_IF_KUNIT(of_node_ktype) so that modules such as the
> KUnit property-entry test can call of_node_init() without hitting this
> linker error.
>
> Reported-by: kernel test robot <[email protected]>
> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
> Signed-off-by: Xu Yang <[email protected]>

Acked-by: Rob Herring (Arm) <[email protected]>