mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jinlong Mao <quic_jinlmao@quicinc.com>
To: Suzuki K Poulose <suzuki.poulose@arm.com>,
	Mathieu Poirier <mathieu.poirier@linaro.org>,
	Mike Leach <mike.leach@linaro.org>, Leo Yan <leo.yan@linaro.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: <coresight@lists.linaro.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>,
	"Tingwei Zhang" <quic_tingweiz@quicinc.com>,
	Yuanfang Zhang <quic_yuanfang@quicinc.com>,
	Tao Zhang <quic_taozha@quicinc.com>,
	Hao Zhang <quic_hazha@quicinc.com>
Subject: Re: [PATCH] coresight: core: Add coresight name support
Date: Thu, 9 Feb 2023 10:16:57 +0800	[thread overview]
Message-ID: <180a66b1-6996-c705-5d8a-0a69ce0353d7@quicinc.com> (raw)
In-Reply-To: <3c105c79-f523-653e-5154-7ba641e51a96@arm.com>


On 2/8/2023 10:26 PM, Suzuki K Poulose wrote:
> On 08/02/2023 11:07, Mao Jinlong wrote:
>> Apart from STM and ETM sources, there will be more sources added to
>> coresight components. For example, there are over 10 TPDM sources.
>> Add coresight name support for custom names which will be
>> easy to identify the source.
>>
>
> As we have previously discussed, please don't make this a generic
> code change. If your device has a "specifici" name, use that for
> allocating in the driver and leave the core code alone.
>
> Suzuki
>
Hi Suzuki,

Not only for TPDMs. There could be dozens of CTI devices.
It is hard for user to know which CTI device it is with current names.

Thanks
Jinlong Mao
>
>> Signed-off-by: Mao Jinlong <quic_jinlmao@quicinc.com>
>> ---
>>   drivers/hwtracing/coresight/coresight-core.c | 34 +++++++++++---------
>>   1 file changed, 19 insertions(+), 15 deletions(-)
>>
>> diff --git a/drivers/hwtracing/coresight/coresight-core.c 
>> b/drivers/hwtracing/coresight/coresight-core.c
>> index d3bf82c0de1d..5e95d9c7f256 100644
>> --- a/drivers/hwtracing/coresight/coresight-core.c
>> +++ b/drivers/hwtracing/coresight/coresight-core.c
>> @@ -1733,28 +1733,32 @@ char *coresight_alloc_device_name(struct 
>> coresight_dev_list *dict,
>>   {
>>       int idx;
>>       char *name = NULL;
>> +    const char *coresight_name = NULL;
>>       struct fwnode_handle **list;
>> +    struct device_node *node = dev->of_node;
>>         mutex_lock(&coresight_mutex);
>>   -    idx = coresight_search_device_idx(dict, dev_fwnode(dev));
>> -    if (idx < 0) {
>> -        /* Make space for the new entry */
>> -        idx = dict->nr_idx;
>> -        list = krealloc_array(dict->fwnode_list,
>> -                      idx + 1, sizeof(*dict->fwnode_list),
>> -                      GFP_KERNEL);
>> -        if (ZERO_OR_NULL_PTR(list)) {
>> -            idx = -ENOMEM;
>> -            goto done;
>> +    if (!of_property_read_string(node, "coresight-name", 
>> &coresight_name))
>> +        name = devm_kasprintf(dev, GFP_KERNEL, "%s", coresight_name);
>> +    else {
>> +        idx = coresight_search_device_idx(dict, dev_fwnode(dev));
>> +        if (idx < 0) {
>> +            /* Make space for the new entry */
>> +            idx = dict->nr_idx;
>> +            list = krealloc_array(dict->fwnode_list,
>> +                          idx + 1, sizeof(*dict->fwnode_list),
>> +                          GFP_KERNEL);
>> +            if (ZERO_OR_NULL_PTR(list))
>> +                goto done;
>> +
>> +            list[idx] = dev_fwnode(dev);
>> +            dict->fwnode_list = list;
>> +            dict->nr_idx = idx + 1;
>>           }
>>   -        list[idx] = dev_fwnode(dev);
>> -        dict->fwnode_list = list;
>> -        dict->nr_idx = idx + 1;
>> +        name = devm_kasprintf(dev, GFP_KERNEL, "%s%d", dict->pfx, idx);
>>       }
>> -
>> -    name = devm_kasprintf(dev, GFP_KERNEL, "%s%d", dict->pfx, idx);
>>   done:
>>       mutex_unlock(&coresight_mutex);
>>       return name;
>

  reply	other threads:[~2023-02-09  2:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-08 11:07 Mao Jinlong
2023-02-08 14:26 ` Suzuki K Poulose
2023-02-09  2:16   ` Jinlong Mao [this message]
2023-03-01 15:11     ` Jinlong Mao
2023-03-13  9:16       ` Suzuki K Poulose
     [not found]         ` <6b976d2b-3c78-96e4-bf35-3ef88828a9dd@quicinc.com>
2023-03-17 14:25           ` Suzuki K Poulose
2023-04-24 13:42             ` Jinlong Mao
2023-04-24 22:26               ` Suzuki K Poulose

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=180a66b1-6996-c705-5d8a-0a69ce0353d7@quicinc.com \
    --to=quic_jinlmao@quicinc.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=coresight@lists.linaro.org \
    --cc=leo.yan@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=mike.leach@linaro.org \
    --cc=quic_hazha@quicinc.com \
    --cc=quic_taozha@quicinc.com \
    --cc=quic_tingweiz@quicinc.com \
    --cc=quic_yuanfang@quicinc.com \
    --cc=suzuki.poulose@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®