On Mon, Aug 18, 2025 at 07:44:40PM +0200, Marco Felsch wrote:
> Linux has added the support to expose nvmem-cells via the sysfs by
> commit 0331c611949f ("nvmem: core: Expose cells through sysfs"). This
> commit adds an equivalent mechanism by exposing the nvmem-cells via
> cdevs. The name scheme is: <nvmem-dev-name>.<cell-name>.
> 
> With this in place it is possible for board code and/or shell to query
> the nvmem-cell values without specifying the consumer API within DT. At
> the moment the access is RO like Linux does since write support requires
> more corner case handling.
> 
> The naming scheme for nvmem_populate_sysfs_cells() was kept to reduce the
> Linux diff.
> 
> Signed-off-by: Marco Felsch <m.fel...@pengutronix.de>
> ---
>  drivers/nvmem/core.c | 93 
> ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 93 insertions(+)
> 
> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> index 
> c252f17ef0b24e8199e199db086aeec8d09fdf94..4dbeb1e116ae398f1f2748238d97468c1096262a
>  100644
> --- a/drivers/nvmem/core.c
> +++ b/drivers/nvmem/core.c
> @@ -45,6 +45,8 @@ struct nvmem_cell_entry {
>       struct device_node      *np;
>       struct nvmem_device     *nvmem;
>       struct list_head        node;
> +
> +     struct cdev             cdev;
>  };
>  
>  struct nvmem_cell {
> @@ -167,6 +169,71 @@ static struct nvmem_device *of_nvmem_find(struct 
> device_node *nvmem_np)
>       return NULL;
>  }
>  
> +static struct nvmem_cell *nvmem_create_cell(struct nvmem_cell_entry *entry,
> +                                         const char *id, int index);

This causes intermediate breakage. The prototype at this point is still:

static struct nvmem_cell *nvmem_create_cell(struct nvmem_cell_entry *entry,
                                            const char *id);

The index parameter is only added later in this series.

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