Re: [RFC PATCH 06/14] coresight: Convert claim and lock operations to use access wrappers

From: Suzuki K Poulose
Date: Fri Jul 31 2020 - 05:41:32 EST


On 07/30/2020 08:54 PM, Mathieu Poirier wrote:
On Wed, Jul 22, 2020 at 06:20:32PM +0100, Suzuki K Poulose wrote:
Convert the CoreSight CLAIM set/clear, LOCK/UNLOCK operations to
use the coresight device access abstraction.

Mostly a mechanical change.

Cc: Mathieu Poirier <mathieu.poirier@xxxxxxxxxx>
Cc: Mike Leach <mike.leach@xxxxxxxxxx>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@xxxxxxx>
---
drivers/hwtracing/coresight/coresight-catu.c | 14 ++--
.../hwtracing/coresight/coresight-cpu-debug.c | 26 ++++++--
.../hwtracing/coresight/coresight-cti-sysfs.c | 4 +-
drivers/hwtracing/coresight/coresight-cti.c | 30 +++++----
drivers/hwtracing/coresight/coresight-etb10.c | 20 +++---
.../coresight/coresight-etm3x-sysfs.c | 8 +--
drivers/hwtracing/coresight/coresight-etm3x.c | 44 ++++++++-----
drivers/hwtracing/coresight/coresight-etm4x.c | 44 ++++++++-----
.../hwtracing/coresight/coresight-funnel.c | 18 ++---
drivers/hwtracing/coresight/coresight-priv.h | 9 +--
.../coresight/coresight-replicator.c | 27 +++++---
drivers/hwtracing/coresight/coresight-stm.c | 46 ++++++++-----
.../hwtracing/coresight/coresight-tmc-etf.c | 36 ++++++----
.../hwtracing/coresight/coresight-tmc-etr.c | 19 +++---
drivers/hwtracing/coresight/coresight-tpiu.c | 9 +--
drivers/hwtracing/coresight/coresight.c | 66 +++++++++++--------
include/linux/coresight.h | 16 ++---
17 files changed, 266 insertions(+), 170 deletions(-)


...

diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c
index 67fc3e3b77d8..d61ffbfe0a5c 100644
--- a/drivers/hwtracing/coresight/coresight-funnel.c
+++ b/drivers/hwtracing/coresight/coresight-funnel.c
@@ -52,13 +52,14 @@ static int dynamic_funnel_enable_hw(struct funnel_drvdata *drvdata, int port)
{
u32 functl;
int rc = 0;
+ struct coresight_device *csdev = drvdata->csdev;
- CS_UNLOCK(drvdata->base);
+ CS_UNLOCK(&csdev->access);
functl = readl_relaxed(drvdata->base + FUNNEL_FUNCTL);
/* Claim the device only when we enable the first slave */
if (!(functl & FUNNEL_ENSx_MASK)) {
- rc = coresight_claim_device_unlocked(drvdata->base);
+ rc = coresight_claim_device_unlocked(csdev);
if (rc)
goto done;
}
@@ -69,7 +70,7 @@ static int dynamic_funnel_enable_hw(struct funnel_drvdata *drvdata, int port)
writel_relaxed(functl, drvdata->base + FUNNEL_FUNCTL);
writel_relaxed(drvdata->priority, drvdata->base + FUNNEL_PRICTL);
done:
- CS_LOCK(drvdata->base);
+ CS_LOCK(&csdev->access);
return rc;
}
@@ -101,8 +102,9 @@ static void dynamic_funnel_disable_hw(struct funnel_drvdata *drvdata,
int inport)
{
u32 functl;
+ struct coresight_device *csdev = drvdata->csdev;

Sometimes a csdev variable is declared, sometimes not as in get_funnel_ctrl_hw()
below and this makes it hard to review all these changes. Please select a
heuristic and keep with it. I prefer this version but not dead set on it.

Agreed, will change.



Also please split in two, on for CS_LOCK/UNLOCK() and another one for the claim
tag functions.

There is a minor dependency here. CS_LOCK/UNLOCK is issued from the coresight_{dis}claim_device() versions. One option is to choose the
following order:

1) convert claim/disclaim to accept csdev.
And use csdev->access->base for CS_LOCK/UNLOCK.

2) Convert all CS_LOCK/UNLOCK to work on csdev->access.

I thought having this at one go might look better. But I agree, it is
better to split this one. I will give it a go.

Cheers
Suzuki