Re: [PATCH v2 4/8] swnode: ignore primary nodes in device_remove_software_node()

From: Andy Shevchenko

Date: Tue Nov 10 2026 - 06:32:15 EST


On Tue, Nov 10, 2026 at 09:51:20AM +0100, Johan Hovold wrote:
> device_remove_software_node() should only be used to remove secondary
> firmware nodes added by device_add_software_node() but will currently
> drop a reference also if a device has a primary software node.
>
> Bail out early if device_remove_software_node() is called for a device
> whose primary firmware node is a software node and fix up the two
> callers that currently work around this themselves.

...

> -static inline bool fwnode_is_primary(struct fwnode_handle *fwnode)
> +bool fwnode_is_primary(struct fwnode_handle *fwnode)
> {
> return fwnode && !IS_ERR(fwnode->secondary);
> }

> +EXPORT_SYMBOL_GPL(fwnode_is_primary);

Do we need this export? I was expecting that this API shouldn't be used in any
of the modules.

...

> +bool fwnode_is_primary(struct fwnode_handle *fwnode);
> void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode);
> void set_secondary_fwnode(struct device *dev, struct fwnode_handle *fwnode);
> void device_set_node(struct device *dev, struct fwnode_handle *fwnode);

Yeah, I was proposing to have include/device/fwnode.h for these APIs and
accompanying data types...

--
With Best Regards,
Andy Shevchenko