summaryrefslogtreecommitdiff
path: root/drivers/hwtracing/coresight/ultrasoc-smb.c
diff options
context:
space:
mode:
authorJames Clark <james.clark@arm.com>2024-01-29 18:40:43 +0300
committerSuzuki K Poulose <suzuki.poulose@arm.com>2024-02-12 13:21:38 +0300
commitbcaabb95f0c9883fb8e1112bd13eaba9cfd62c15 (patch)
tree1c4f20c44753bd4254fd382dfd88eb739b474afc /drivers/hwtracing/coresight/ultrasoc-smb.c
parentc95c2733e5feb1f6848923f166849b2d1c7bf682 (diff)
downloadlinux-bcaabb95f0c9883fb8e1112bd13eaba9cfd62c15.tar.xz
coresight: Add helper for setting csdev->mode
Now that mode is in struct coresight_device, sets can be wrapped. This also allows us to add a sanity check that there have been no concurrent modifications of mode. Currently all usages of local_set() were inside the device's spin locks so this new warning shouldn't be triggered. coresight_take_mode() could maybe have been used in place of adding the warning, but there may be use cases which set the mode to the same mode which are valid but would fail in coresight_take_mode() because it requires the device to only be in the disabled state. Signed-off-by: James Clark <james.clark@arm.com> Link: https://lore.kernel.org/r/20240129154050.569566-13-james.clark@arm.com Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Diffstat (limited to 'drivers/hwtracing/coresight/ultrasoc-smb.c')
-rw-r--r--drivers/hwtracing/coresight/ultrasoc-smb.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/hwtracing/coresight/ultrasoc-smb.c b/drivers/hwtracing/coresight/ultrasoc-smb.c
index 903cfffe0bcd..f9ebf20c91e6 100644
--- a/drivers/hwtracing/coresight/ultrasoc-smb.c
+++ b/drivers/hwtracing/coresight/ultrasoc-smb.c
@@ -211,7 +211,7 @@ static void smb_enable_sysfs(struct coresight_device *csdev)
return;
smb_enable_hw(drvdata);
- local_set(&csdev->mode, CS_MODE_SYSFS);
+ coresight_set_mode(csdev, CS_MODE_SYSFS);
}
static int smb_enable_perf(struct coresight_device *csdev, void *data)
@@ -234,7 +234,7 @@ static int smb_enable_perf(struct coresight_device *csdev, void *data)
if (drvdata->pid == -1) {
smb_enable_hw(drvdata);
drvdata->pid = pid;
- local_set(&csdev->mode, CS_MODE_PERF);
+ coresight_set_mode(csdev, CS_MODE_PERF);
}
return 0;
@@ -297,7 +297,7 @@ static int smb_disable(struct coresight_device *csdev)
/* Dissociate from the target process. */
drvdata->pid = -1;
- local_set(&csdev->mode, CS_MODE_DISABLED);
+ coresight_set_mode(csdev, CS_MODE_DISABLED);
dev_dbg(&csdev->dev, "Ultrasoc SMB disabled\n");
return 0;