Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

hwtracing: coresight: Use of_reserved_mem_region_to_resource() for "memory-region"

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>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20250703183534.2075569-1-robh@kernel.org

authored by

Rob Herring (Arm) and committed by
Suzuki K Poulose
9ba55021 12d9a9dd

+6 -16
+6 -16
drivers/hwtracing/coresight/coresight-tmc-core.c
··· 24 24 #include <linux/pm_runtime.h> 25 25 #include <linux/of.h> 26 26 #include <linux/of_address.h> 27 + #include <linux/of_reserved_mem.h> 27 28 #include <linux/coresight.h> 28 29 #include <linux/amba/bus.h> 29 30 #include <linux/platform_device.h> ··· 635 634 const char *name, 636 635 struct resource *res) 637 636 { 638 - int index, rc = -ENODEV; 639 - struct device_node *node; 637 + int rc = -ENODEV; 640 638 641 - if (!is_of_node(dev->fwnode)) 642 - return -ENODEV; 643 - 644 - index = of_property_match_string(dev->of_node, "memory-region-names", 645 - name); 646 - if (index < 0) 639 + rc = of_reserved_mem_region_to_resource_byname(dev->of_node, name, res); 640 + if (rc < 0) 647 641 return rc; 648 642 649 - node = of_parse_phandle(dev->of_node, "memory-region", index); 650 - if (!node) 651 - return rc; 652 - 653 - if (!of_address_to_resource(node, 0, res) && 654 - res->start != 0 && resource_size(res) != 0) 655 - rc = 0; 656 - of_node_put(node); 643 + if (res->start == 0 || resource_size(res) == 0) 644 + rc = -ENODEV; 657 645 658 646 return rc; 659 647 }