summaryrefslogtreecommitdiff
path: root/drivers/hwtracing
diff options
context:
space:
mode:
authorLeo Yan <leo.yan@arm.com>2026-02-09 12:44:36 +0000
committerSuzuki K Poulose <suzuki.poulose@arm.com>2026-02-25 11:14:44 +0000
commit32c225491ed8dc90c9ba4a8d07f064133d52a179 (patch)
tree830e58655b63c28ffba66e92d136a43e6b11c734 /drivers/hwtracing
parenta6c4da4b95a3cfe4f6031bef2d913331dc186142 (diff)
downloadlinux-next-32c225491ed8dc90c9ba4a8d07f064133d52a179.tar.gz
linux-next-32c225491ed8dc90c9ba4a8d07f064133d52a179.zip
coresight: Refactor output connection sysfs link cleanup
To use a central place for releasing connections, move the output connection sysfs link cleanup into coresight_remove_conns(). Also update the comments accordingly. Reviewed-by: James Clark <james.clark@linaro.org> Signed-off-by: Leo Yan <leo.yan@arm.com> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Link: https://lore.kernel.org/r/20260209-arm_coresight_refactor_dev_register-v4-4-62d6042f76f7@arm.com
Diffstat (limited to 'drivers/hwtracing')
-rw-r--r--drivers/hwtracing/coresight/coresight-core.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c
index c228c27e8517..2185a8f869ad 100644
--- a/drivers/hwtracing/coresight/coresight-core.c
+++ b/drivers/hwtracing/coresight/coresight-core.c
@@ -1152,7 +1152,6 @@ static int coresight_clear_filter_source(struct device *dev, void *data)
return 0;
}
-/* coresight_remove_conns - Remove other device's references to this device */
static void coresight_remove_conns(struct coresight_device *csdev)
{
int i, j;
@@ -1162,10 +1161,6 @@ static void coresight_remove_conns(struct coresight_device *csdev)
bus_for_each_dev(&coresight_bustype, NULL, csdev,
coresight_clear_filter_source);
- /*
- * Remove the input connection references from the destination device
- * for each output connection.
- */
for (i = 0; i < csdev->pdata->nr_outconns; i++) {
conn = csdev->pdata->out_conns[i];
if (conn->filter_src_fwnode) {
@@ -1176,6 +1171,13 @@ static void coresight_remove_conns(struct coresight_device *csdev)
if (!conn->dest_dev)
continue;
+ /* Remove sysfs links for the output connection */
+ coresight_remove_links(csdev, conn);
+
+ /*
+ * Remove the input connection references from the destination
+ * device for each output connection.
+ */
for (j = 0; j < conn->dest_dev->pdata->nr_inconns; ++j)
if (conn->dest_dev->pdata->in_conns[j] == conn) {
conn->dest_dev->pdata->in_conns[j] = NULL;
@@ -1306,9 +1308,6 @@ void coresight_release_platform_data(struct coresight_device *csdev,
struct coresight_connection **conns = pdata->out_conns;
for (i = 0; i < pdata->nr_outconns; i++) {
- /* If we have made the links, remove them now */
- if (csdev && conns[i]->dest_dev)
- coresight_remove_links(csdev, conns[i]);
/*
* Drop the refcount and clear the handle as this device
* is going away
@@ -1424,7 +1423,6 @@ out_unlock:
}
err_out:
- /* Cleanup the connection information */
coresight_release_platform_data(NULL, desc->dev, desc->pdata);
return ERR_PTR(ret);
}