diff mbox series

Revert "nvmem: add new config option"

Message ID 20230718084804.20139-1-zajec5@gmail.com
State New
Headers show
Series Revert "nvmem: add new config option" | expand

Commit Message

Rafał Miłecki July 18, 2023, 8:48 a.m. UTC
From: Rafał Miłecki <rafal@milecki.pl>

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 <rafal@milecki.pl>
---
Important: this is based on top of the
[PATCH V4] nvmem: add explicit config option to read old syntax fixed OF cells
---
 drivers/mtd/mtdcore.c          | 1 -
 drivers/nvmem/core.c           | 2 +-
 include/linux/nvmem-provider.h | 2 --
 3 files changed, 1 insertion(+), 4 deletions(-)

Comments

Rafał Miłecki July 18, 2023, 4:59 p.m. UTC | #1
On 2023-07-18 18:00, kernel test robot wrote:
>    drivers/mtd/mtdcore.c: In function 'mtd_nvmem_add':
>>> drivers/mtd/mtdcore.c:542:29: warning: unused variable 'node' 
>>> [-Wunused-variable]
>      542 |         struct device_node *node = mtd_get_of_node(mtd);
>          |                             ^~~~

My patch I mentioned:
[PATCH V4] nvmem: add explicit config option to read old syntax fixed OF 
cells

adds following line:
config.add_legacy_fixed_of_cells = of_device_is_compatible(node, 
"nvmem-cells");

So this is a false kernel bot warning (but I understand kernel bot
couldn't understand it needs my other patch).
Rafał Miłecki Aug. 26, 2023, 8:15 p.m. UTC | #2
Hi Srini,

On 18.07.2023 10:48, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> 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 <rafal@milecki.pl>
> ---
> Important: this is based on top of the
> [PATCH V4] nvmem: add explicit config option to read old syntax fixed OF cells

I see you skipped those two patches for 6.6.

Can you queue them for 6.7, please?


> ---
>   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 9db8d7853639..3d781ffb8c32 100644
> --- a/drivers/mtd/mtdcore.c
> +++ b/drivers/mtd/mtdcore.c
> @@ -554,7 +554,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 58d8919e6682..a0c9153cda28 100644
> --- a/drivers/nvmem/core.c
> +++ b/drivers/nvmem/core.c
> @@ -1027,7 +1027,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;
Rafał Miłecki Oct. 4, 2023, 8:45 a.m. UTC | #3
Srini,

On 26.08.2023 22:15, Rafał Miłecki wrote:
> On 18.07.2023 10:48, Rafał Miłecki wrote:
>> From: Rafał Miłecki <rafal@milecki.pl>
>>
>> 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 <rafal@milecki.pl>
>> ---
>> Important: this is based on top of the
>> [PATCH V4] nvmem: add explicit config option to read old syntax fixed OF cells
> 
> I see you skipped those two patches for 6.6.
> 
> Can you queue them for 6.7, please?

Did you have a chance to look at this one?

>> ---
>>   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 9db8d7853639..3d781ffb8c32 100644
>> --- a/drivers/mtd/mtdcore.c
>> +++ b/drivers/mtd/mtdcore.c
>> @@ -554,7 +554,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 58d8919e6682..a0c9153cda28 100644
>> --- a/drivers/nvmem/core.c
>> +++ b/drivers/nvmem/core.c
>> @@ -1027,7 +1027,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;
>
Srinivas Kandagatla Oct. 7, 2023, 10:17 a.m. UTC | #4
On Tue, 18 Jul 2023 10:48:04 +0200, Rafał Miłecki wrote:
> 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.
> 
> [...]

Applied, thanks!

[1/1] Revert "nvmem: add new config option"
      commit: bb519262f1a9b4c37046be5a3851ab1681d7158a

Best regards,
diff mbox series

Patch

diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 9db8d7853639..3d781ffb8c32 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -554,7 +554,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 58d8919e6682..a0c9153cda28 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -1027,7 +1027,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;