On Mon, Aug 18, 2025 at 07:44:44PM +0200, Marco Felsch wrote: > This ports the Linux nvmem-layout core infrastructure required for the > actual nvmem-layout drivers. This commit doesn't add any specific > nvmem-layout driver. > > A nvmem-layout is the new way to describe the nvmem storage format. The > nvmem-layout driver parses the nvmem sotrage format and provides the > information via nvmem-cells. > > Signed-off-by: Marco Felsch <m.fel...@pengutronix.de> > --- > drivers/nvmem/Kconfig | 7 ++ > drivers/nvmem/Makefile | 3 + > drivers/nvmem/core.c | 100 +++++++++++++++++++++++- > drivers/nvmem/internals.h | 22 ++++++ > drivers/nvmem/layouts.c | 173 > +++++++++++++++++++++++++++++++++++++++++ > drivers/nvmem/layouts/Kconfig | 13 ++++ > drivers/nvmem/layouts/Makefile | 7 ++ > include/linux/nvmem-provider.h | 63 +++++++++++++++ > 8 files changed, 385 insertions(+), 3 deletions(-) > > diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig > +struct device_node *of_nvmem_layout_get_container(struct nvmem_device *nvmem) > +{ > + return of_get_child_by_name(nvmem->dev.of_node, "nvmem-layout");
This also needs an additional if (!nvmem->dev.of_node) return NULL; check. This also goes down to of_get_child_by_name doing a for_each_child_of_node() which is defines as: #define for_each_child_of_node(parent, child) \ list_for_each_entry(child, &parent->children, parent_list) list_for_each_entry() does not work with NULL pointers. We might want to change this for Linux compatibility. Sascha -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |