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

From: Andy Shevchenko

Date: Tue Jul 21 2026 - 07:16:35 EST


On Tue, Jul 21, 2026 at 06:54:47PM +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_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.

...

> #include <linux/of.h>
> #include <linux/slab.h>

+ blank line.

> +#include <kunit/visibility.h>
>
> #include "of_private.h"

--
With Best Regards,
Andy Shevchenko