From: POPESCU Catalin <catalin.popescu@leica-geosystems.com>
To: "srinivas.kandagatla@linaro.org" <srinivas.kandagatla@linaro.org>,
"miquel.raynal@bootlin.com" <miquel.raynal@bootlin.com>,
"michael@walle.cc" <michael@walle.cc>,
"rafal@milecki.pl" <rafal@milecki.pl>,
"robh@kernel.org" <robh@kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
GEO-CHHER-bsp-development
<bsp-development.geo@leica-geosystems.com>
Subject: Re: [PATCH] nvmem: fix issue within nvmem_register with fixed-layout.
Date: Tue, 5 Dec 2023 08:48:27 +0000 [thread overview]
Message-ID: <16c4c272-1a19-4fb8-8a2d-b2cf61ba37f2@leica-geosystems.com> (raw)
In-Reply-To: <20231130162922.2989774-1-catalin.popescu@leica-geosystems.com>
Adding more people.
On 30.11.23 17:29, Catalin Popescu wrote:
> fixed-layout is natively supported by NVMEM framework.
> Yet, it's not been declared as a supported layout. As a
> result, nvmem_register always returns -EPROBE_DEFER if
> configuration has no layout and the NVMEM provider DT
> uses a fixed layout.
>
> As a fix, declare fixed-layout as a supported layout
> and use add_cells callback to parse the cells. This adds
> consistency over layouts parsing as fixed-layout parsing
> is handled in the same way than others nvmem layouts.
>
> Signed-off-by: Catalin Popescu <catalin.popescu@leica-geosystems.com>
> ---
> drivers/nvmem/core.c | 24 +++++++++++++++++-------
> 1 file changed, 17 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> index bf42b7e826db..3467c94207e8 100644
> --- a/drivers/nvmem/core.c
> +++ b/drivers/nvmem/core.c
> @@ -746,7 +746,9 @@ static int nvmem_add_cells_from_legacy_of(struct nvmem_device *nvmem)
> return nvmem_add_cells_from_dt(nvmem, nvmem->dev.of_node);
> }
>
> -static int nvmem_add_cells_from_fixed_layout(struct nvmem_device *nvmem)
> +static int nvmem_add_cells_from_fixed_layout(struct device *dev,
> + struct nvmem_device *nvmem,
> + struct nvmem_layout *layout)
> {
> struct device_node *layout_np;
> int err = 0;
> @@ -755,8 +757,7 @@ static int nvmem_add_cells_from_fixed_layout(struct nvmem_device *nvmem)
> if (!layout_np)
> return 0;
>
> - if (of_device_is_compatible(layout_np, "fixed-layout"))
> - err = nvmem_add_cells_from_dt(nvmem, layout_np);
> + err = nvmem_add_cells_from_dt(nvmem, layout_np);
>
> of_node_put(layout_np);
>
> @@ -1003,10 +1004,6 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
> goto err_remove_cells;
> }
>
> - rval = nvmem_add_cells_from_fixed_layout(nvmem);
> - if (rval)
> - goto err_remove_cells;
> -
> rval = nvmem_add_cells_from_layout(nvmem);
> if (rval)
> goto err_remove_cells;
> @@ -2126,6 +2123,19 @@ const char *nvmem_dev_name(struct nvmem_device *nvmem)
> }
> EXPORT_SYMBOL_GPL(nvmem_dev_name);
>
> +static const struct of_device_id fixed_layout_of_match_table[] = {
> + { .compatible = "fixed-layout", },
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, fixed_layout_of_match_table);
> +
> +static struct nvmem_layout fixed_layout = {
> + .name = "NVMEM fixed layout",
> + .of_match_table = fixed_layout_of_match_table,
> + .add_cells = nvmem_add_cells_from_fixed_layout,
> +};
> +module_nvmem_layout_driver(fixed_layout);
> +
> static int __init nvmem_init(void)
> {
> return bus_register(&nvmem_bus_type);
next prev parent reply other threads:[~2023-12-05 8:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-30 16:29 Catalin Popescu
2023-12-05 8:48 ` POPESCU Catalin [this message]
2023-12-05 9:05 ` Miquel Raynal
2024-01-03 8:40 ` Miquel Raynal
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=16c4c272-1a19-4fb8-8a2d-b2cf61ba37f2@leica-geosystems.com \
--to=catalin.popescu@leica-geosystems.com \
--cc=bsp-development.geo@leica-geosystems.com \
--cc=linux-kernel@vger.kernel.org \
--cc=michael@walle.cc \
--cc=miquel.raynal@bootlin.com \
--cc=rafal@milecki.pl \
--cc=robh@kernel.org \
--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
all inboxes | Powered by JetHome®