Thread (63 messages) 63 messages, 6 authors, 2020-08-07

Re: [PATCH v7 19/25] coresight: cti: Fix bug clearing sysfs links on callback

From: Suzuki K Poulose <suzuki.poulose@arm.com>
Date: 2020-08-06 16:18:09

On 08/05/2020 03:54 AM, Tingwei Zhang wrote:

Missing, From:.... if this is authored by Mike Leach.
quoted hunk ↗ jump to hunk
During module unload, a coresight driver module will call back into
the CTI driver to remove any links between the two devices.

The current code has 2 issues:-
1) in the CTI driver the matching code is matching to the wrong device
so misses all the links.
2) The callback is called too late in the unload process resulting in a
crash.

This fixes both the issues.

Fixes: 177af8285b59 (coresight: cti: Enable CTI associated with devices)
Reported-by: Tingwei Zhang <redacted>
Signed-off-by: Mike Leach <redacted>
Signed-off-by: Tingwei Zhang <redacted>
---
  drivers/hwtracing/coresight/coresight-cti.c | 2 +-
  drivers/hwtracing/coresight/coresight.c     | 4 ++--
  2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-cti.c b/drivers/hwtracing/coresight/coresight-cti.c
index 1c34db7d1b1b..6bb06c5715db 100644
--- a/drivers/hwtracing/coresight/coresight-cti.c
+++ b/drivers/hwtracing/coresight/coresight-cti.c
@@ -608,7 +608,7 @@ void cti_remove_assoc_from_csdev(struct coresight_device *csdev)
  		ctidrv = csdev_to_cti_drvdata(csdev->ect_dev);
  		ctidev = &ctidrv->ctidev;
  		list_for_each_entry(tc, &ctidev->trig_cons, node) {
-			if (tc->con_dev == csdev->ect_dev) {
+			if (tc->con_dev == csdev) {
  				cti_remove_sysfs_link(ctidrv, tc);
  				tc->con_dev = NULL;
  				break;
diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c
index 25578579559b..8b55383cfcf1 100644
--- a/drivers/hwtracing/coresight/coresight.c
+++ b/drivers/hwtracing/coresight/coresight.c
@@ -1238,8 +1238,6 @@ static void coresight_device_release(struct device *dev)
  {
  	struct coresight_device *csdev = to_coresight_device(dev);
  
-	if (cti_assoc_ops && cti_assoc_ops->remove)
-		cti_assoc_ops->remove(csdev);
  	fwnode_handle_put(csdev->dev.fwnode);
  	kfree(csdev->refcnt);
  	kfree(csdev);
@@ -1574,6 +1572,8 @@ void coresight_unregister(struct coresight_device *csdev)
  {
  	etm_perf_del_symlink_sink(csdev);
  	/* Remove references of that device in the topology */
+	if (cti_assoc_ops && cti_assoc_ops->remove)
+		cti_assoc_ops->remove(csdev);
Acked-by: Suzuki K Poulose <suzuki.poulose@arm.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help