[PATCH v1 1/2] coresight: Add support for device names

From: Tao Zhang
Date: Fri Apr 16 2021 - 04:08:41 EST


Add support to read device names from device tree entries. Before
the previous process of allocating coresight device name, try to
read the coresight device name from device tree entries. If it is
read, the device name will be returned directly. If it is not read,
the original allocation name process will be followed.

Signed-off-by: Tingwei Zhang <tingwei@xxxxxxxxxxxxxx>
Signed-off-by: Tao Zhang <taozha@xxxxxxxxxxxxxx>
---
drivers/hwtracing/coresight/coresight-core.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c
index 4ba801d..b79c726 100644
--- a/drivers/hwtracing/coresight/coresight-core.c
+++ b/drivers/hwtracing/coresight/coresight-core.c
@@ -1640,6 +1640,12 @@ char *coresight_alloc_device_name(struct coresight_dev_list *dict,
int idx;
char *name = NULL;
struct fwnode_handle **list;
+ struct device_node *node = dev->of_node;
+
+ if (!node) {
+ if (!of_property_read_string(node, "coresight-name", &name))
+ return name;
+ }

mutex_lock(&coresight_mutex);

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project