[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20260126-arm_coresight_refactor_dev_register-v2-4-b5a3c0441c15@arm.com>
Date: Mon, 26 Jan 2026 13:52:04 +0000
From: Leo Yan <leo.yan@....com>
To: Suzuki K Poulose <suzuki.poulose@....com>,
Mike Leach <mike.leach@...aro.org>, James Clark <james.clark@...aro.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Mathieu Poirier <mathieu.poirier@...aro.org>,
Mao Jinlong <quic_jinlmao@...cinc.com>
Cc: coresight@...ts.linaro.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, Leo Yan <leo.yan@....com>
Subject: [PATCH v2 4/8] 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.
Signed-off-by: Leo Yan <leo.yan@....com>
---
drivers/hwtracing/coresight/coresight-core.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c
index b992ef5de8ddbd535e937c616bd7ab663f097f76..b4b87b3e0a608a1df19d81ba796d4db7d01290f5 100644
--- a/drivers/hwtracing/coresight/coresight-core.c
+++ b/drivers/hwtracing/coresight/coresight-core.c
@@ -1149,7 +1149,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;
@@ -1159,10 +1158,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) {
@@ -1173,6 +1168,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;
@@ -1303,9 +1305,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
@@ -1421,7 +1420,6 @@ struct coresight_device *coresight_register(struct coresight_desc *desc)
}
err_out:
- /* Cleanup the connection information */
coresight_release_platform_data(NULL, desc->dev, desc->pdata);
return ERR_PTR(ret);
}
--
2.34.1
Powered by blists - more mailing lists