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

Xu Yang <[email protected]>
Newsgroups dev.linux.lists.driver-core,dev.linux.lists.imx,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel
Message-ID <cugdaqe42gmq73s4aowxyce4oppi3zi5r6jrq3xmbo3qdjrej7@u4wsvtyxj2vx>
On Mon, Jul 20, 2026 at 02:13:36PM +0300, Andy Shevchenko wrote:
> On Mon, Jul 20, 2026 at 06:47:29PM +0800, Xu Yang wrote:
> 
> > 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_GPL(of_node_ktype) so that GPL-licensed modules
> > such as the KUnit property-entry test can call of_node_init() without
> > hitting this linker error.
> 
> Use special one for KUnits: EXPORT_SYMBOL_IF_KUNIT().

OK. Thanks for the suggestion!

Thanks,
Xu Yang
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.