Re: [PATCH v3 10/26] coresight: Convert claim/disclaim operations to use access wrappers

Suzuki K Poulose
2020-11-04T10:54:08Z

On 11/3/20 6:36 PM, Mathieu Poirier wrote:
> On Wed, Oct 28, 2020 at 10:09:29PM +0000, Suzuki K Poulose wrote:
>> Convert the generic CLAIM tag management APIs to use the
>> device access layer abstraction.
>>
>> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
>> Cc: Mike Leach <mike.leach@linaro.org>
>> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
>> ---
>> drivers/hwtracing/coresight/coresight-catu.c | 6 +-
>> drivers/hwtracing/coresight/coresight-core.c | 66 +++++++++++--------
>> .../hwtracing/coresight/coresight-cti-core.c | 17 +++--
>> drivers/hwtracing/coresight/coresight-etb10.c | 4 +-
>> .../coresight/coresight-etm3x-core.c | 8 ++-
>> .../coresight/coresight-etm4x-core.c | 4 +-
>> .../hwtracing/coresight/coresight-funnel.c | 6 +-
>> .../coresight/coresight-replicator.c | 16 +++--
>> .../hwtracing/coresight/coresight-tmc-etf.c | 10 +--
>> .../hwtracing/coresight/coresight-tmc-etr.c | 4 +-
>> include/linux/coresight.h | 16 ++---
>> 11 files changed, 95 insertions(+), 62 deletions(-)
>>

>> }
>>
>> -static inline void coresight_set_claim_tags(void __iomem *base)
>> +static inline void coresight_set_claim_tags(struct coresight_device *csdev)
>> {
>> - writel_relaxed(CORESIGHT_CLAIM_SELF_HOSTED, base + CORESIGHT_CLAIMSET);
>> + csdev_access_relaxed_write32(&csdev->access, CORESIGHT_CLAIM_SELF_HOSTED,
>> + CORESIGHT_CLAIMSET);
>
> Indentation
>
>> isb();
>> }
>>
>> -static inline void coresight_clear_claim_tags(void __iomem *base)
>> +static inline void coresight_clear_claim_tags(struct coresight_device *csdev)
>> {
>> - writel_relaxed(CORESIGHT_CLAIM_SELF_HOSTED, base + CORESIGHT_CLAIMCLR);
>> + csdev_access_relaxed_write32(&csdev->access, CORESIGHT_CLAIM_SELF_HOSTED,
>> + CORESIGHT_CLAIMCLR);
>
> Indentation
>
>> isb();
>> }
>>

>> diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c
>> index fcf25740116c..e35d79e74e30 100644
>> --- a/drivers/hwtracing/coresight/coresight-replicator.c
>> +++ b/drivers/hwtracing/coresight/coresight-replicator.c
>> @@ -45,12 +45,18 @@ struct replicator_drvdata {
>>
>> static void dynamic_replicator_reset(struct replicator_drvdata *drvdata)
>> {
>> + struct coresight_device *csdev = drvdata->csdev;
>> CS_UNLOCK(drvdata->base);
>>
>> - if (!coresight_claim_device_unlocked(drvdata->base)) {
>> + if (WARN_ON(!csdev))
>> + return;
>
> I don't see a need for this check. Function replicator_reset() is called from
> probe() where the validity of drvdata->csdev is checked just before.
>

Correct. We only needed drvdata->base earlier, which was fine. But we
now need csdev for the reset. That check was added to make sure that
we don't break the guarantee. I could take that down.

Cheers
Suzuki