coresight: Remove atomic type from refcnt
authorJames Clark <james.clark@arm.com>
Mon, 29 Jan 2024 15:40:38 +0000 (15:40 +0000)
committerSuzuki K Poulose <suzuki.poulose@arm.com>
Mon, 12 Feb 2024 10:21:38 +0000 (10:21 +0000)
commit4545b38ef004a586295750ea49a505b6396a7c90
treeadc5f916fd11b75f8a17c4f8e137ca75660a95b5
parent1f5149c7751c50aba1a871143ffa6cb36af3fb49
coresight: Remove atomic type from refcnt

Refcnt is only ever accessed from either inside the coresight_mutex, or
the device's spinlock, making the atomic type and atomic_dec_return()
calls confusing and unnecessary. The only point of synchronisation
outside of these two types of locks is already done with a compare and
swap on 'mode', which a comment has been added for.

There was one instance of refcnt being used outside of a lock in TPIU,
but that can easily be fixed by making it the same as all the other
devices and adding a spinlock. Potentially in the future all the
refcounting and locking can be moved up into the core code, and all the
mostly duplicate code from the individual devices can be removed.

Signed-off-by: James Clark <james.clark@arm.com>
Link: https://lore.kernel.org/r/20240129154050.569566-8-james.clark@arm.com
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
drivers/hwtracing/coresight/coresight-etb10.c
drivers/hwtracing/coresight/coresight-sysfs.c
drivers/hwtracing/coresight/coresight-tmc-etf.c
drivers/hwtracing/coresight/coresight-tmc-etr.c
drivers/hwtracing/coresight/coresight-tpda.c
drivers/hwtracing/coresight/coresight-tpiu.c
drivers/hwtracing/coresight/ultrasoc-smb.c
include/linux/coresight.h