Re: [PATCH 2/2] nvmem: expose NVMEM cells in sysfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Rafał,

Thank you for working on this.
I hacked together the same functionality based on kernel 5.10 some months ago,
while I was testing an MTD parser based TLV NVMEM cells parser,
and have some general comments.

On Mon, 20 Dec 2021, at 06:47, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@xxxxxxxxxx>
>
> This allows reading NVMEM cells using /sys/bus/nvmem/devices/*/cells/*
> which may be helpful for userspace & debugging purposes.
>
> Signed-off-by: Rafał Miłecki <rafal@xxxxxxxxxx>
> ---
>  Documentation/driver-api/nvmem.rst | 11 ++++++
>  drivers/nvmem/core.c               | 60 ++++++++++++++++++++++++++++++
>  2 files changed, 71 insertions(+)
>
> diff --git a/Documentation/driver-api/nvmem.rst 
> b/Documentation/driver-api/nvmem.rst
> index 287e86819640..20f7d68143be 100644
> --- a/Documentation/driver-api/nvmem.rst
> +++ b/Documentation/driver-api/nvmem.rst
> @@ -185,6 +185,17 @@ ex::
>    *
>    0001000
> 
> +Single cells can be read using files located at::
> +
> +	/sys/bus/nvmem/devices/*/cells/*
> +
> +ex::
> +
> +  hexdump -C /sys/bus/nvmem/devices/mtd0/cells/mac

I found that NVMEM cell names did not need to be unique, but sysfs entry names do.
I am not sure if there are characters that NVMEM cell names allow,
but sysfs entry names forbid.
I used an ID allocator, in a similar style to what is done for MTD sysfs devices in mtdcore.c.

Could the cell (data) binary attribute be in a subfolder for each cell?
Example:
/sys/bus/nvmem/devices/mtd0/cells/cell0/cell
or
/sys/bus/nvmem/devices/mtd0/cells/cell0/cell_data

This way, we can easily expose additional properties of the cell.
I exposed the name, offset, bytes, bit_offset, and an of_node link (where available) this way.
I only needed these for testing, but the cell length (bytes) provided a cheap means for initial validation.

I did not look into cell post-processing, but it should be considered:
https://lore.kernel.org/all/20211006144729.15268-1-srinivas.kandagatla@xxxxxxxxxx/
and RFC https://lore.kernel.org/all/CAL_JsqL55mZJ6jUyQACer2pKMNDV08-FgwBREsJVgitnuF18Cg@xxxxxxxxxxxxxx/
Will the cell data exposed here be prior to post-processing?


Thank you

Cheers,
-- 
  John Thomson




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux