[RESEND PATCH v2] riscv: cacheinfo: Use of_property_present() for non-boolean properties

Rob Herring (Arm) posted 1 patch 11 months, 3 weeks ago
arch/riscv/kernel/cacheinfo.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
[RESEND PATCH v2] riscv: cacheinfo: Use of_property_present() for non-boolean properties
Posted by Rob Herring (Arm) 11 months, 3 weeks ago
The use of of_property_read_bool() for non-boolean properties is
deprecated in favor of of_property_present() when testing for property
presence.

Reviewed-by: Clément Léger <cleger@rivosinc.com>
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
---
 arch/riscv/kernel/cacheinfo.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/riscv/kernel/cacheinfo.c b/arch/riscv/kernel/cacheinfo.c
index 2d40736fc37c..26b085dbdd07 100644
--- a/arch/riscv/kernel/cacheinfo.c
+++ b/arch/riscv/kernel/cacheinfo.c
@@ -108,11 +108,11 @@ int populate_cache_leaves(unsigned int cpu)
 	if (!np)
 		return -ENOENT;
 
-	if (of_property_read_bool(np, "cache-size"))
+	if (of_property_present(np, "cache-size"))
 		ci_leaf_init(this_leaf++, CACHE_TYPE_UNIFIED, level);
-	if (of_property_read_bool(np, "i-cache-size"))
+	if (of_property_present(np, "i-cache-size"))
 		ci_leaf_init(this_leaf++, CACHE_TYPE_INST, level);
-	if (of_property_read_bool(np, "d-cache-size"))
+	if (of_property_present(np, "d-cache-size"))
 		ci_leaf_init(this_leaf++, CACHE_TYPE_DATA, level);
 
 	prev = np;
@@ -125,11 +125,11 @@ int populate_cache_leaves(unsigned int cpu)
 			break;
 		if (level <= levels)
 			break;
-		if (of_property_read_bool(np, "cache-size"))
+		if (of_property_present(np, "cache-size"))
 			ci_leaf_init(this_leaf++, CACHE_TYPE_UNIFIED, level);
-		if (of_property_read_bool(np, "i-cache-size"))
+		if (of_property_present(np, "i-cache-size"))
 			ci_leaf_init(this_leaf++, CACHE_TYPE_INST, level);
-		if (of_property_read_bool(np, "d-cache-size"))
+		if (of_property_present(np, "d-cache-size"))
 			ci_leaf_init(this_leaf++, CACHE_TYPE_DATA, level);
 		levels = level;
 	}
-- 
2.45.2

Re: [RESEND PATCH v2] riscv: cacheinfo: Use of_property_present() for non-boolean properties
Posted by Geert Uytterhoeven 11 months, 1 week ago
Hi Rob,

Thanks for your patch!

On Tue, Dec 31, 2024 at 5:14 PM Rob Herring (Arm) <robh@kernel.org> wrote:
> The use of of_property_read_bool() for non-boolean properties is
> deprecated in favor of of_property_present() when testing for property
> presence.

Please add

    This gets rid of the following boot warnings:

        OF: /cpus/cpu@0: Read of boolean property 'i-cache-size' with a value.
        OF: /cpus/cpu@0: Read of boolean property 'd-cache-size' with a value.
        OF: /soc/cache-controller@13400000: Read of boolean property
'cache-size' with a value.

so the next person doesn't have to dive into the code to find this patch ;-)

> Reviewed-by: Clément Léger <cleger@rivosinc.com>
> Signed-off-by: Rob Herring (Arm) <robh@kernel.org>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Re: [RESEND PATCH v2] riscv: cacheinfo: Use of_property_present() for non-boolean properties
Posted by Rob Herring 11 months, 1 week ago
On Tue, Jan 14, 2025 at 4:52 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Rob,
>
> Thanks for your patch!
>
> On Tue, Dec 31, 2024 at 5:14 PM Rob Herring (Arm) <robh@kernel.org> wrote:
> > The use of of_property_read_bool() for non-boolean properties is
> > deprecated in favor of of_property_present() when testing for property
> > presence.
>
> Please add
>
>     This gets rid of the following boot warnings:
>
>         OF: /cpus/cpu@0: Read of boolean property 'i-cache-size' with a value.
>         OF: /cpus/cpu@0: Read of boolean property 'd-cache-size' with a value.
>         OF: /soc/cache-controller@13400000: Read of boolean property
> 'cache-size' with a value.
>
> so the next person doesn't have to dive into the code to find this patch ;-)

If this patch had been picked up in a timely manner, no one would have
ever seen that warning. I'll leave it to the riscv maintainers to add
that if they desire. That warning didn't exist when this patch was
written.

Rob