Re: [PATCH v7 1/5] driver core: Introduce device_{add,remove}_of_node()

From: Greg Kroah-Hartman
Date: Wed Feb 19 2025 - 03:27:53 EST


On Tue, Feb 04, 2025 at 08:34:56AM +0100, Herve Codina wrote:
> An of_node can be set to a device using device_set_node().
> This function cannot prevent any of_node and/or fwnode overwrites.
>
> When adding an of_node on an already present device, the following
> operations need to be done:
> - Attach the of_node if no of_node were already attached
> - Attach the of_node as a fwnode if no fwnode were already attached
>
> This is the purpose of device_add_of_node().
> device_remove_of_node() reverts the operations done by
> device_add_of_node().
>
> Signed-off-by: Herve Codina <herve.codina@xxxxxxxxxxx>
> ---
> drivers/base/core.c | 61 ++++++++++++++++++++++++++++++++++++++++++
> include/linux/device.h | 2 ++
> 2 files changed, 63 insertions(+)
>

Acked-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>