]> www.infradead.org Git - users/jedix/linux-maple.git/commit
driver core: Introduce device_{add,remove}_of_node()
authorHerve Codina <herve.codina@bootlin.com>
Mon, 24 Feb 2025 14:13:51 +0000 (15:13 +0100)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 28 Feb 2025 21:12:58 +0000 (15:12 -0600)
commit3b62449da444502d8b87bf090d8ec4a57d47eda5
tree28f825bfea53cc17ffe5df01100e66102c182029
parent2014c95afecee3e76ca4a56956a936e23283f05b
driver core: Introduce device_{add,remove}_of_node()

An of_node can be set to a device using device_set_node(), which does not
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 only if no of_node is 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().

Link: https://lore.kernel.org/r/20250224141356.36325-2-herve.codina@bootlin.com
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/core.c
include/linux/device.h