On 25-08-20, Sascha Hauer wrote:
> On Wed, Aug 20, 2025 at 11:11:19AM +0200, Marco Felsch wrote:
> > On 25-08-20, Sascha Hauer wrote:
> > > 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.
> > 
> > Thanks for testing and spotting this. I ran tests but of course all my
> > nvmem devices had an of_node :(
> 
> In this case you would have noticed it by running
> 
> labgrid-pytest --lg-env test/sandbox/sandbox_defconfig.yaml

I will try to remember this for the next time I make such a big core
change. Sorry for causing troubles.

Regards,
  Marco

> 
> 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 |
> 

Reply via email to