From: "John Thomson" <lists@johnthomson.fastmail.com.au>
To: "Rafał Miłecki" <zajec5@gmail.com>,
"Srinivas Kandagatla" <srinivas.kandagatla@linaro.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Rafael J . Wysocki" <rafael@kernel.org>,
"Jonathan Corbet" <corbet@lwn.net>
Cc: "Daniel Vetter" <daniel.vetter@ffwll.ch>,
"Dan Williams" <dan.j.williams@intel.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Heiner Kallweit" <hkallweit1@gmail.com>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
"Rafał Miłecki" <rafal@milecki.pl>
Subject: Re: [PATCH 2/2] nvmem: expose NVMEM cells in sysfs
Date: Wed, 22 Dec 2021 00:11:01 +0000 [thread overview]
Message-ID: <e7173ab2-d3b2-4f75-beb8-32593b868774@www.fastmail.com> (raw)
In-Reply-To: <20211220064730.28806-2-zajec5@gmail.com>
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@milecki.pl>
>
> 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@milecki.pl>
> ---
> 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@linaro.org/
and RFC https://lore.kernel.org/all/CAL_JsqL55mZJ6jUyQACer2pKMNDV08-FgwBREsJVgitnuF18Cg@mail.gmail.com/
Will the cell data exposed here be prior to post-processing?
Thank you
Cheers,
--
John Thomson
next prev parent reply other threads:[~2021-12-22 0:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-20 6:47 [PATCH 1/2] sysfs: add sysfs_add_bin_file_to_group() Rafał Miłecki
2021-12-20 6:47 ` [PATCH 2/2] nvmem: expose NVMEM cells in sysfs Rafał Miłecki
2021-12-20 8:00 ` Greg Kroah-Hartman
2021-12-20 20:39 ` Rafał Miłecki
2021-12-21 6:33 ` Greg Kroah-Hartman
2021-12-21 6:39 ` Rafał Miłecki
2021-12-21 6:45 ` Greg Kroah-Hartman
2021-12-21 6:53 ` Rafał Miłecki
2021-12-21 7:13 ` Greg Kroah-Hartman
2021-12-21 12:24 ` Rafał Miłecki
2021-12-21 12:56 ` Greg Kroah-Hartman
2021-12-21 13:05 ` Rafał Miłecki
2021-12-21 13:27 ` Greg Kroah-Hartman
2021-12-21 13:52 ` Rafał Miłecki
2021-12-21 14:27 ` Greg Kroah-Hartman
2021-12-21 15:09 ` Rafał Miłecki
2021-12-21 15:18 ` Greg Kroah-Hartman
2021-12-21 15:33 ` Rafał Miłecki
2021-12-22 0:11 ` John Thomson [this message]
2021-12-20 8:01 ` [PATCH 1/2] sysfs: add sysfs_add_bin_file_to_group() Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e7173ab2-d3b2-4f75-beb8-32593b868774@www.fastmail.com \
--to=lists@johnthomson.fastmail.com.au \
--cc=bhelgaas@google.com \
--cc=corbet@lwn.net \
--cc=dan.j.williams@intel.com \
--cc=daniel.vetter@ffwll.ch \
--cc=gregkh@linuxfoundation.org \
--cc=hkallweit1@gmail.com \
--cc=kw@linux.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=rafal@milecki.pl \
--cc=srinivas.kandagatla@linaro.org \
--cc=zajec5@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).