2023-10-20 10:56:33

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH 4/6] Revert "nvmem: add new config option"

From: Rafał Miłecki <[email protected]>

This reverts commit 517f14d9cf3533d5ab4fded195ab6f80a92e378f.

It seems that "no_of_node" config option was added to help mtd's case.

DT nodes of MTD partitions (that are also NVMEM devices) may contain
subnodes that SHOULD NOT be treated as NVMEM fixed cells. To prevent
NVMEM core code from parsing them "no_of_node" was set to true and that
made for_each_child_of_node() in NVMEM a no-op.

With the introduction of "add_legacy_fixed_of_cells" config option
things got more explicit. MTD subsystem simply tells NVMEM when to look
for fixed cells and there is no need to hack "of_node" pointer anymore.

Signed-off-by: Rafał Miłecki <[email protected]>
Reviewed-by: Miquel Raynal <[email protected]>
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
drivers/mtd/mtdcore.c | 1 -
drivers/nvmem/core.c | 2 +-
include/linux/nvmem-provider.h | 2 --
3 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index fbf60d1364f0..74dd1b74008d 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -560,7 +560,6 @@ static int mtd_nvmem_add(struct mtd_info *mtd)
config.read_only = true;
config.root_only = true;
config.ignore_wp = true;
- config.no_of_node = !of_device_is_compatible(node, "nvmem-cells");
config.priv = mtd;

mtd->nvmem = nvmem_register(&config);
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 2710943f53c4..bf42b7e826db 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -935,7 +935,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
nvmem->nkeepout = config->nkeepout;
if (config->of_node)
nvmem->dev.of_node = config->of_node;
- else if (!config->no_of_node)
+ else
nvmem->dev.of_node = config->dev->of_node;

switch (config->id) {
diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h
index 1b81adebdb8b..e3930835235b 100644
--- a/include/linux/nvmem-provider.h
+++ b/include/linux/nvmem-provider.h
@@ -89,7 +89,6 @@ struct nvmem_cell_info {
* @read_only: Device is read-only.
* @root_only: Device is accessibly to root only.
* @of_node: If given, this will be used instead of the parent's of_node.
- * @no_of_node: Device should not use the parent's of_node even if it's !NULL.
* @reg_read: Callback to read data.
* @reg_write: Callback to write data.
* @size: Device size.
@@ -122,7 +121,6 @@ struct nvmem_config {
bool ignore_wp;
struct nvmem_layout *layout;
struct device_node *of_node;
- bool no_of_node;
nvmem_reg_read_t reg_read;
nvmem_reg_write_t reg_write;
int size;
--
2.25.1


2023-10-21 17:18:26

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 4/6] Revert "nvmem: add new config option"

On Fri, Oct 20, 2023 at 11:55:43AM +0100, [email protected] wrote:
> From: Rafał Miłecki <[email protected]>
>
> This reverts commit 517f14d9cf3533d5ab4fded195ab6f80a92e378f.
>
> It seems that "no_of_node" config option was added to help mtd's case.
>
> DT nodes of MTD partitions (that are also NVMEM devices) may contain
> subnodes that SHOULD NOT be treated as NVMEM fixed cells. To prevent
> NVMEM core code from parsing them "no_of_node" was set to true and that
> made for_each_child_of_node() in NVMEM a no-op.
>
> With the introduction of "add_legacy_fixed_of_cells" config option
> things got more explicit. MTD subsystem simply tells NVMEM when to look
> for fixed cells and there is no need to hack "of_node" pointer anymore.
>
> Signed-off-by: Rafał Miłecki <[email protected]>
> Reviewed-by: Miquel Raynal <[email protected]>
> Signed-off-by: Srinivas Kandagatla <[email protected]>

Why isn't this also marked for stable trees?

thanks,

greg k-h

2023-10-21 20:52:27

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 4/6] Revert "nvmem: add new config option"

On Sat, Oct 21, 2023 at 10:31:55PM +0200, Rafał Miłecki wrote:
> On 2023-10-21 19:18, Greg KH wrote:
> > On Fri, Oct 20, 2023 at 11:55:43AM +0100, [email protected]
> > wrote:
> > > From: Rafał Miłecki <[email protected]>
> > >
> > > This reverts commit 517f14d9cf3533d5ab4fded195ab6f80a92e378f.
> > >
> > > It seems that "no_of_node" config option was added to help mtd's case.
> > >
> > > DT nodes of MTD partitions (that are also NVMEM devices) may contain
> > > subnodes that SHOULD NOT be treated as NVMEM fixed cells. To prevent
> > > NVMEM core code from parsing them "no_of_node" was set to true and
> > > that
> > > made for_each_child_of_node() in NVMEM a no-op.
> > >
> > > With the introduction of "add_legacy_fixed_of_cells" config option
> > > things got more explicit. MTD subsystem simply tells NVMEM when to
> > > look
> > > for fixed cells and there is no need to hack "of_node" pointer
> > > anymore.
> > >
> > > Signed-off-by: Rafał Miłecki <[email protected]>
> > > Reviewed-by: Miquel Raynal <[email protected]>
> > > Signed-off-by: Srinivas Kandagatla <[email protected]>
> >
> > Why isn't this also marked for stable trees?
>
> I think it's explained in commit message but maybe it's not clear
> enough?

It's not, I just read it again and can't figure it out, sorry.

> This revert (PATCH 4/6) is possible only with the previous PATCH 2/6
> applied first. In other words "no_of_node" config option can be dropped
> only after adding "add_legacy_fixed_of_cells" config option.

Ah, ok, that's not obvious :)

> Since adding "add_legacy_fixed_of_cells" is not a bug/regression fix I
> didn't mark it for stable and so I couldn't mark revert for stable.

That's fine, but can you please resend this with a better changelog that
makes it obvious why now we can revert the old patch, otherwise the
autobot will come along and attempt to backport it to stable as well.

thanks,

greg k-h

2023-10-21 23:01:18

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 4/6] Revert "nvmem: add new config option"

On 2023-10-21 19:18, Greg KH wrote:
> On Fri, Oct 20, 2023 at 11:55:43AM +0100,
> [email protected] wrote:
>> From: Rafał Miłecki <[email protected]>
>>
>> This reverts commit 517f14d9cf3533d5ab4fded195ab6f80a92e378f.
>>
>> It seems that "no_of_node" config option was added to help mtd's case.
>>
>> DT nodes of MTD partitions (that are also NVMEM devices) may contain
>> subnodes that SHOULD NOT be treated as NVMEM fixed cells. To prevent
>> NVMEM core code from parsing them "no_of_node" was set to true and
>> that
>> made for_each_child_of_node() in NVMEM a no-op.
>>
>> With the introduction of "add_legacy_fixed_of_cells" config option
>> things got more explicit. MTD subsystem simply tells NVMEM when to
>> look
>> for fixed cells and there is no need to hack "of_node" pointer
>> anymore.
>>
>> Signed-off-by: Rafał Miłecki <[email protected]>
>> Reviewed-by: Miquel Raynal <[email protected]>
>> Signed-off-by: Srinivas Kandagatla <[email protected]>
>
> Why isn't this also marked for stable trees?

I think it's explained in commit message but maybe it's not clear
enough?

This revert (PATCH 4/6) is possible only with the previous PATCH 2/6
applied first. In other words "no_of_node" config option can be dropped
only after adding "add_legacy_fixed_of_cells" config option.

Since adding "add_legacy_fixed_of_cells" is not a bug/regression fix I
didn't mark it for stable and so I couldn't mark revert for stable.

--
Rafał Miłecki

2023-10-21 23:24:27

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 4/6] Revert "nvmem: add new config option"

On 2023-10-21 22:51, Greg KH wrote:
> On Sat, Oct 21, 2023 at 10:31:55PM +0200, Rafał Miłecki wrote:
>> On 2023-10-21 19:18, Greg KH wrote:
>> > On Fri, Oct 20, 2023 at 11:55:43AM +0100, [email protected]
>> > wrote:
>> > > From: Rafał Miłecki <[email protected]>
>> > >
>> > > This reverts commit 517f14d9cf3533d5ab4fded195ab6f80a92e378f.
>> > >
>> > > It seems that "no_of_node" config option was added to help mtd's case.
>> > >
>> > > DT nodes of MTD partitions (that are also NVMEM devices) may contain
>> > > subnodes that SHOULD NOT be treated as NVMEM fixed cells. To prevent
>> > > NVMEM core code from parsing them "no_of_node" was set to true and
>> > > that
>> > > made for_each_child_of_node() in NVMEM a no-op.
>> > >
>> > > With the introduction of "add_legacy_fixed_of_cells" config option
>> > > things got more explicit. MTD subsystem simply tells NVMEM when to
>> > > look
>> > > for fixed cells and there is no need to hack "of_node" pointer
>> > > anymore.
>> > >
>> > > Signed-off-by: Rafał Miłecki <[email protected]>
>> > > Reviewed-by: Miquel Raynal <[email protected]>
>> > > Signed-off-by: Srinivas Kandagatla <[email protected]>
>> >
>> > Why isn't this also marked for stable trees?
>>
>> I think it's explained in commit message but maybe it's not clear
>> enough?
>
> It's not, I just read it again and can't figure it out, sorry.
>
>> This revert (PATCH 4/6) is possible only with the previous PATCH 2/6
>> applied first. In other words "no_of_node" config option can be
>> dropped
>> only after adding "add_legacy_fixed_of_cells" config option.
>
> Ah, ok, that's not obvious :)
>
>> Since adding "add_legacy_fixed_of_cells" is not a bug/regression fix I
>> didn't mark it for stable and so I couldn't mark revert for stable.
>
> That's fine, but can you please resend this with a better changelog
> that
> makes it obvious why now we can revert the old patch, otherwise the
> autobot will come along and attempt to backport it to stable as well.

Oops, my bad then. I'll resend tomorrow. Thanks for quick answer!

--
Rafał Miłecki