lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3c105c79-f523-653e-5154-7ba641e51a96@arm.com>
Date:   Wed, 8 Feb 2023 14:26:20 +0000
From:   Suzuki K Poulose <suzuki.poulose@....com>
To:     Mao Jinlong <quic_jinlmao@...cinc.com>,
        Mathieu Poirier <mathieu.poirier@...aro.org>,
        Mike Leach <mike.leach@...aro.org>,
        Leo Yan <leo.yan@...aro.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc:     coresight@...ts.linaro.org, linux-arm-kernel@...ts.infradead.org,
        linux-kernel@...r.kernel.org, linux-arm-msm@...r.kernel.org,
        Tingwei Zhang <quic_tingweiz@...cinc.com>,
        Yuanfang Zhang <quic_yuanfang@...cinc.com>,
        Tao Zhang <quic_taozha@...cinc.com>,
        Hao Zhang <quic_hazha@...cinc.com>
Subject: Re: [PATCH] coresight: core: Add coresight name support

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


> Signed-off-by: Mao Jinlong <quic_jinlmao@...cinc.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;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ