summaryrefslogtreecommitdiff
path: root/drivers/hwtracing/coresight/ultrasoc-smb.c
diff options
context:
space:
mode:
authorJames Clark <james.clark@arm.com>2023-04-25 17:35:37 +0300
committerSuzuki K Poulose <suzuki.poulose@arm.com>2023-06-05 17:46:46 +0300
commitae7f2b5a7b569f8ede4af9e215515e5a0b824edd (patch)
tree84aaf498f7037425f51b897192094d47a3b31b77 /drivers/hwtracing/coresight/ultrasoc-smb.c
parente3f4e68797a960869ccae556ad63163b3dc470a2 (diff)
downloadlinux-ae7f2b5a7b569f8ede4af9e215515e5a0b824edd.tar.xz
coresight: Make refcount a property of the connection
This removes the need to do an additional lookup for the total number of ports used and also removes the need to allocate an array of refcounts which is just another representation of a connection array. This was only used for link type devices, for regular devices a single refcount on the coresight device is used. There is a both an input and output refcount in case two link type devices are connected together so that they don't overwrite each other's counts. Reviewed-by: Mike Leach <mike.leach@linaro.org> Signed-off-by: James Clark <james.clark@arm.com> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Link: https://lore.kernel.org/r/20230425143542.2305069-11-james.clark@arm.com
Diffstat (limited to 'drivers/hwtracing/coresight/ultrasoc-smb.c')
-rw-r--r--drivers/hwtracing/coresight/ultrasoc-smb.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/hwtracing/coresight/ultrasoc-smb.c b/drivers/hwtracing/coresight/ultrasoc-smb.c
index a2ced0b3c3cd..e9a32a97fbee 100644
--- a/drivers/hwtracing/coresight/ultrasoc-smb.c
+++ b/drivers/hwtracing/coresight/ultrasoc-smb.c
@@ -106,7 +106,7 @@ static int smb_open(struct inode *inode, struct file *file)
goto out;
}
- if (atomic_read(drvdata->csdev->refcnt)) {
+ if (atomic_read(&drvdata->csdev->refcnt)) {
ret = -EBUSY;
goto out;
}
@@ -290,7 +290,7 @@ static int smb_enable(struct coresight_device *csdev, enum cs_mode mode,
if (ret)
goto out;
- atomic_inc(csdev->refcnt);
+ atomic_inc(&csdev->refcnt);
dev_dbg(&csdev->dev, "Ultrasoc SMB enabled\n");
out:
@@ -311,7 +311,7 @@ static int smb_disable(struct coresight_device *csdev)
goto out;
}
- if (atomic_dec_return(csdev->refcnt)) {
+ if (atomic_dec_return(&csdev->refcnt)) {
ret = -EBUSY;
goto out;
}
@@ -411,7 +411,7 @@ static unsigned long smb_update_buffer(struct coresight_device *csdev,
mutex_lock(&drvdata->mutex);
/* Don't do anything if another tracer is using this sink. */
- if (atomic_read(csdev->refcnt) != 1)
+ if (atomic_read(&csdev->refcnt) != 1)
goto out;
smb_disable_hw(drvdata);