[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <da49f445-7365-4863-bb41-f7a55150c4dd@oss.qualcomm.com>
Date: Fri, 18 Jul 2025 17:36:33 +0800
From: Jie Gan <jie.gan@....qualcomm.com>
To: Mike Leach <mike.leach@...aro.org>
Cc: Suzuki K Poulose <suzuki.poulose@....com>,
James Clark <james.clark@...aro.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley
<conor+dt@...nel.org>,
Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konradybcio@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Tingwei Zhang <quic_tingweiz@...cinc.com>,
Yuanfang Zhang <quic_yuanfang@...cinc.com>,
Mao Jinlong <quic_jinlmao@...cinc.com>,
Jie Gan <quic_jiegan@...cinc.com>, coresight@...ts.linaro.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-arm-msm@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH v3 RESEND 02/10] coresight: core: add a new API to
retrieve the helper device
On 7/18/2025 4:37 PM, Mike Leach wrote:
> Hi,
>
> On Mon, 14 Jul 2025 at 07:31, Jie Gan <jie.gan@....qualcomm.com> wrote:
>>
>> Retrieving the helper device of the specific coresight device based on
>> its helper_subtype because a single coresight device may has multiple types
>> of the helper devices.
>>
>> Signed-off-by: Jie Gan <jie.gan@....qualcomm.com>
>> ---
>> drivers/hwtracing/coresight/coresight-core.c | 30 ++++++++++++++++++++
>> drivers/hwtracing/coresight/coresight-priv.h | 2 ++
>> 2 files changed, 32 insertions(+)
>>
>> diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c
>> index 5297a5ff7921..76e10c36a8a1 100644
>> --- a/drivers/hwtracing/coresight/coresight-core.c
>> +++ b/drivers/hwtracing/coresight/coresight-core.c
>> @@ -580,6 +580,36 @@ struct coresight_device *coresight_get_sink(struct coresight_path *path)
>> }
>> EXPORT_SYMBOL_GPL(coresight_get_sink);
>>
>> +/**
>> + * coresight_get_helper: find the helper device of the assigned csdev.
>> + *
>> + * @csdev: The csdev the helper device is conntected to.
>> + * @type: helper_subtype of the expected helper device.
>> + *
>> + * Retrieve the helper device for the specific csdev based on its
>> + * helper_subtype.
>> + *
>> + * Return: the helper's csdev upon success or NULL for fail.
>> + */
>> +struct coresight_device *coresight_get_helper(struct coresight_device *csdev,
>> + int type)
>> +{
>> + int i;
>> + struct coresight_device *helper;
>> +
>> + for (i = 0; i < csdev->pdata->nr_outconns; ++i) {
>> + helper = csdev->pdata->out_conns[i]->dest_dev;
>> + if (!helper || !coresight_is_helper(helper))
>> + continue;
>> +
>
> Manipulating the connections list almost certainly requires some
> locking. See other functions in this file
>
Thanks for pointing out. I will fix it in next version.
Thanks,
Jie
> Mike
>
>
>> + if (helper->subtype.helper_subtype == type)
>> + return helper;
>> + }
>> +
>> + return NULL;
>> +}
>> +EXPORT_SYMBOL_GPL(coresight_get_helper);
>> +
>> /**
>> * coresight_get_port_helper: get the in-port number of the helper device
>> * that is connected to the csdev.
>> diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h
>> index 07a5f03de81d..5b912eb60401 100644
>> --- a/drivers/hwtracing/coresight/coresight-priv.h
>> +++ b/drivers/hwtracing/coresight/coresight-priv.h
>> @@ -158,6 +158,8 @@ void coresight_path_assign_trace_id(struct coresight_path *path,
>> enum cs_mode mode);
>> int coresight_get_port_helper(struct coresight_device *csdev,
>> struct coresight_device *helper);
>> +struct coresight_device *coresight_get_helper(struct coresight_device *csdev,
>> + int type);
>>
>> #if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM3X)
>> int etm_readl_cp14(u32 off, unsigned int *val);
>> --
>> 2.34.1
>>
>
>
Powered by blists - more mailing lists