summaryrefslogtreecommitdiff
path: root/drivers/hwtracing/coresight/coresight-cti-sysfs.c
diff options
context:
space:
mode:
authorJames Clark <james.clark@arm.com>2023-01-10 14:07:36 +0300
committerSuzuki K Poulose <suzuki.poulose@arm.com>2023-01-16 13:11:01 +0300
commit479043b778337fe1245ef82609203e83354d3733 (patch)
tree3faf68bf7c6adcade0e49828f40060bc78efa3f9 /drivers/hwtracing/coresight/coresight-cti-sysfs.c
parenteff674a9b86a6ffdd10c3af3863545acf7f1ce4f (diff)
downloadlinux-479043b778337fe1245ef82609203e83354d3733.tar.xz
coresight: cti: Remove atomic type from enable_req_count
enable_req_count is only ever accessed inside the spinlock, so to avoid confusion that there are concurrent accesses and simplify the code, change it to an int. One access outside of the spinlock is in enable_show() which appears to allow partially written data to be displayed between enable_req_count, powered and enabled so move this one inside the spin lock too. Signed-off-by: James Clark <james.clark@arm.com> Reviewed-by: Mike Leach <mike.leach@linaro.org> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Link: https://lore.kernel.org/r/20230110110736.2709917-4-james.clark@arm.com
Diffstat (limited to 'drivers/hwtracing/coresight/coresight-cti-sysfs.c')
-rw-r--r--drivers/hwtracing/coresight/coresight-cti-sysfs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hwtracing/coresight/coresight-cti-sysfs.c b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
index 71e7a8266bb3..e528cff9d4e2 100644
--- a/drivers/hwtracing/coresight/coresight-cti-sysfs.c
+++ b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
@@ -84,8 +84,8 @@ static ssize_t enable_show(struct device *dev,
bool enabled, powered;
struct cti_drvdata *drvdata = dev_get_drvdata(dev->parent);
- enable_req = atomic_read(&drvdata->config.enable_req_count);
spin_lock(&drvdata->spinlock);
+ enable_req = drvdata->config.enable_req_count;
powered = drvdata->config.hw_powered;
enabled = drvdata->config.hw_enabled;
spin_unlock(&drvdata->spinlock);