linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hwtracing: coresight: Use of_reserved_mem_region_to_resource() for "memory-region"
@ 2025-07-03 18:35 Rob Herring (Arm)
  2025-07-09 10:41 ` Suzuki K Poulose
  0 siblings, 1 reply; 2+ messages in thread
From: Rob Herring (Arm) @ 2025-07-03 18:35 UTC (permalink / raw)
  To: Suzuki K Poulose, Mike Leach, James Clark, Alexander Shishkin
  Cc: coresight, linux-arm-kernel, linux-kernel

Use the newly added of_reserved_mem_region_to_resource() function to
handle "memory-region" properties.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
---
 .../hwtracing/coresight/coresight-tmc-core.c  | 22 +++++--------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-tmc-core.c b/drivers/hwtracing/coresight/coresight-tmc-core.c
index 88afb16bb6be..be964656be93 100644
--- a/drivers/hwtracing/coresight/coresight-tmc-core.c
+++ b/drivers/hwtracing/coresight/coresight-tmc-core.c
@@ -24,6 +24,7 @@
 #include <linux/pm_runtime.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
+#include <linux/of_reserved_mem.h>
 #include <linux/coresight.h>
 #include <linux/amba/bus.h>
 #include <linux/platform_device.h>
@@ -634,25 +635,14 @@ static int of_tmc_get_reserved_resource_by_name(struct device *dev,
 						const char *name,
 						struct resource *res)
 {
-	int index, rc = -ENODEV;
-	struct device_node *node;
+	int rc = -ENODEV;
 
-	if (!is_of_node(dev->fwnode))
-		return -ENODEV;
-
-	index = of_property_match_string(dev->of_node, "memory-region-names",
-					 name);
-	if (index < 0)
-		return rc;
-
-	node = of_parse_phandle(dev->of_node, "memory-region", index);
-	if (!node)
+	rc = of_reserved_mem_region_to_resource_byname(dev->of_node, name, res);
+	if (rc < 0)
 		return rc;
 
-	if (!of_address_to_resource(node, 0, res) &&
-	    res->start != 0 && resource_size(res) != 0)
-		rc = 0;
-	of_node_put(node);
+	if (res->start == 0 || resource_size(res) == 0)
+		rc = -ENODEV;
 
 	return rc;
 }
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] hwtracing: coresight: Use of_reserved_mem_region_to_resource() for "memory-region"
  2025-07-03 18:35 [PATCH] hwtracing: coresight: Use of_reserved_mem_region_to_resource() for "memory-region" Rob Herring (Arm)
@ 2025-07-09 10:41 ` Suzuki K Poulose
  0 siblings, 0 replies; 2+ messages in thread
From: Suzuki K Poulose @ 2025-07-09 10:41 UTC (permalink / raw)
  To: Mike Leach, James Clark, Alexander Shishkin, Rob Herring (Arm)
  Cc: Suzuki K Poulose, coresight, linux-arm-kernel, linux-kernel


On Thu, 03 Jul 2025 13:35:33 -0500, Rob Herring (Arm) wrote:
> Use the newly added of_reserved_mem_region_to_resource() function to
> handle "memory-region" properties.
> 
> 

Applied, thanks!

[1/1] hwtracing: coresight: Use of_reserved_mem_region_to_resource() for "memory-region"
      https://git.kernel.org/coresight/c/f0148bd7

Best regards,
-- 
Suzuki K Poulose <suzuki.poulose@arm.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-09 13:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-03 18:35 [PATCH] hwtracing: coresight: Use of_reserved_mem_region_to_resource() for "memory-region" Rob Herring (Arm)
2025-07-09 10:41 ` Suzuki K Poulose

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 NNTP newsgroup(s).