From: Vadym Kochan <vadym.kochan@plvision.eu>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>,
Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Maxime Ripard <maxime.ripard@free-electrons.com>,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/3] nvmem: core: allow to register cells during nvmem registration
Date: Fri, 4 Sep 2020 14:23:10 +0300 [thread overview]
Message-ID: <20200904112310.GD10654@plvision.eu> (raw)
In-Reply-To: <6ab47f55-af66-f035-d8d9-82d0c831b5b8@linaro.org>
Hi Srinivas,
On Fri, Sep 04, 2020 at 12:02:40PM +0100, Srinivas Kandagatla wrote:
> Hi Vadym,
>
> Thanks for the patch,
> On 31/08/2020 02:55, Vadym Kochan wrote:
> > Add NVMEM_PRE_ADD notification step which is called before any cells
> > binding - from lookup table or config, this allows to register cells
> > in some specific layout (tlv) which should be parsed first and then
> > registered. So there might be a cell parser driver which can register
> > lookup table during this notification step.
> >
> This is going in right direction but totally not correct way to do it.
>
> 1> this is not scalable as any consumer that will register for this even
> will have no idea of which what kind of parsing that provider needs.
> It can work in your case but not really useful.
>
> 2> this is a consumer API, not the provider api.
>
> How about adding a "parse_cells" callback in struct nvmem_config along with
> encoding type.
>
>
> thanks,
> srini
>
Looks like I missed main point here that this cells parser should be
registered as nvmem provider. I will think on it.
Thanks,
> > Signed-off-by: Vadym Kochan <vadym.kochan@plvision.eu>
> > ---
> > v3:
> > 1) Update core.c changes by extending notification mechanism
> > by adding new NVMEM_PRE_ADD event id which is called before lookup
> > table cells binding, this allows for notification handler to
> > register cells which require nvmem parsing.
> >
> > drivers/nvmem/core.c | 2 ++
> > include/linux/nvmem-consumer.h | 1 +
> > 2 files changed, 3 insertions(+)
> >
> > diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> > index 6cd3edb2eaf6..c48a69e0ebbe 100644
> > --- a/drivers/nvmem/core.c
> > +++ b/drivers/nvmem/core.c
> > @@ -668,6 +668,8 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
> > goto err_device_del;
> > }
> > + blocking_notifier_call_chain(&nvmem_notifier, NVMEM_PRE_ADD, nvmem);
> > +
> > if (config->cells) {
> > rval = nvmem_add_cells(nvmem, config->cells, config->ncells);
> > if (rval)
> > diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h
> > index 052293f4cbdb..0f7107276756 100644
> > --- a/include/linux/nvmem-consumer.h
> > +++ b/include/linux/nvmem-consumer.h
> > @@ -50,6 +50,7 @@ enum {
> > NVMEM_REMOVE,
> > NVMEM_CELL_ADD,
> > NVMEM_CELL_REMOVE,
> > + NVMEM_PRE_ADD,
> > };
> > #if IS_ENABLED(CONFIG_NVMEM)
> >
next prev parent reply other threads:[~2020-09-04 11:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-31 1:55 [PATCH v3 0/3] nvmem: add ONIE NVMEM cells provider Vadym Kochan
2020-08-31 1:55 ` [PATCH v3 1/3] nvmem: core: allow to register cells during nvmem registration Vadym Kochan
2020-09-04 11:02 ` Srinivas Kandagatla
2020-09-04 11:23 ` Vadym Kochan [this message]
2020-09-11 16:59 ` Vadym Kochan
2020-08-31 1:55 ` [PATCH v3 2/3] nvmem: add ONIE NVMEM cells support Vadym Kochan
2020-09-04 11:02 ` Srinivas Kandagatla
2020-08-31 1:55 ` [PATCH v3 3/3] misc: eeprom: at24: register nvmem only after eeprom is ready to use Vadym Kochan
2020-08-31 17:21 ` Bartosz Golaszewski
2020-08-31 17:24 ` Vadym Kochan
2020-09-01 8:06 ` Bartosz Golaszewski
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=20200904112310.GD10654@plvision.eu \
--to=vadym.kochan@plvision.eu \
--cc=arnd@arndb.de \
--cc=bgolaszewski@baylibre.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime.ripard@free-electrons.com \
--cc=srinivas.kandagatla@linaro.org \
/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).