* [PATCH] powerpc: fsl_soc: Use of_range_to_resource() for "ranges" parsing
@ 2023-06-09 18:32 Rob Herring
2023-07-03 5:26 ` Michael Ellerman
0 siblings, 1 reply; 2+ messages in thread
From: Rob Herring @ 2023-06-09 18:32 UTC (permalink / raw)
To: Michael Ellerman, Nicholas Piggin, Christophe Leroy
Cc: linuxppc-dev, linux-kernel
"ranges" is a standard property with common parsing functions. Users
shouldn't be implementing their own parsing of it. Refactor the FSL RapidIO
"ranges" parsing to use of_range_to_resource() instead.
Signed-off-by: Rob Herring <robh@kernel.org>
---
arch/powerpc/sysdev/fsl_soc.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 6ebbbca41065..68709743450e 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -51,18 +51,10 @@ phys_addr_t get_immrbase(void)
soc = of_find_node_by_type(NULL, "soc");
if (soc) {
- int size;
- u32 naddr;
- const __be32 *prop = of_get_property(soc, "#address-cells", &size);
-
- if (prop && size == 4)
- naddr = be32_to_cpup(prop);
- else
- naddr = 2;
-
- prop = of_get_property(soc, "ranges", &size);
- if (prop)
- immrbase = of_translate_address(soc, prop + naddr);
+ struct resource res;
+
+ if (!of_range_to_resource(soc, 0, &res))
+ immrbase = res.start;
of_node_put(soc);
}
--
2.39.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] powerpc: fsl_soc: Use of_range_to_resource() for "ranges" parsing
2023-06-09 18:32 [PATCH] powerpc: fsl_soc: Use of_range_to_resource() for "ranges" parsing Rob Herring
@ 2023-07-03 5:26 ` Michael Ellerman
0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2023-07-03 5:26 UTC (permalink / raw)
To: Nicholas Piggin, Christophe Leroy, Rob Herring; +Cc: linuxppc-dev, linux-kernel
On Fri, 09 Jun 2023 12:32:38 -0600, Rob Herring wrote:
> "ranges" is a standard property with common parsing functions. Users
> shouldn't be implementing their own parsing of it. Refactor the FSL RapidIO
> "ranges" parsing to use of_range_to_resource() instead.
>
>
Applied to powerpc/next.
[1/1] powerpc: fsl_soc: Use of_range_to_resource() for "ranges" parsing
https://git.kernel.org/powerpc/c/be0f9ca024b3ae17fac6b15c04519840f3418269
cheers
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-07-03 5:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-09 18:32 [PATCH] powerpc: fsl_soc: Use of_range_to_resource() for "ranges" parsing Rob Herring
2023-07-03 5:26 ` Michael Ellerman
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 read-only IMAP folder(s) and NNTP newsgroup(s).