[PATCH v2 0/4] of: add of_property_alloc/free() and of_node_alloc()

From: Clément Léger
Date: Wed Jun 01 2022 - 04:19:51 EST


In order to be able to create new nodes and properties dynamically from
drivers, add of_property_alloc/free() and of_node_alloc(). These
functions can be used to create new nodes and properties flagged with
OF_DYNAMIC and to free them.

Some powerpc code was already doing such operations and thus, these
functions have been used to replace the manual creation of nodes and
properties.

---

Changes in V2:
- Remove of_node_free()
- Rework property allocation to allocate both property and value with
1 allocation
- Rework node allocation to allocate name at the same time the node is
allocated
- Remove extern from definitions
- Remove of_property_alloc() value_len parameter and add more
explanation for the arguments
- Add a check in of_property_free to check OF_DYNAMIC flag
- Add a commit which constify the property argument of
of_property_check_flags()

Clément Léger (4):
of: constify of_property_check_flags() prop argument
of: dynamic: add of_property_alloc() and of_property_free()
of: dynamic: add of_node_alloc()
powerpc/pseries: use of_property_alloc/free() and of_node_alloc()

arch/powerpc/platforms/pseries/dlpar.c | 51 +------
.../platforms/pseries/hotplug-memory.c | 21 +--
arch/powerpc/platforms/pseries/reconfig.c | 45 ++----
drivers/of/dynamic.c | 134 ++++++++++++------
drivers/of/of_private.h | 21 ++-
include/linux/of.h | 25 +++-
6 files changed, 153 insertions(+), 144 deletions(-)

--
2.36.0