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

2021-04-16 Thread taozha

On 2021-04-16 19:19, Alexander Shishkin wrote:

Tao Zhang  writes:

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", ))


Ok, I'm not a device tree expert, but I'm pretty sure the above is a
nop.

Regards,
--
Alex
You are right. The pointer check code here is wrong, I will correct it 
on the V2 version.


Tao


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

2021-04-16 Thread Alexander Shishkin
Tao Zhang  writes:

> 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", ))

Ok, I'm not a device tree expert, but I'm pretty sure the above is a
nop.

Regards,
--
Alex


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

2021-04-16 Thread Tao Zhang
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 
Signed-off-by: Tao Zhang 
---
 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", ))
+   return name;
+   }
 
mutex_lock(_mutex);
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



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

2021-04-16 Thread Tao Zhang
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 
Signed-off-by: Tao Zhang 
---
 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", ))
+   return name;
+   }
 
mutex_lock(_mutex);
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project