[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200915104116.16789-19-tingwei@codeaurora.org>
Date: Tue, 15 Sep 2020 18:41:10 +0800
From: Tingwei Zhang <tingwei@...eaurora.org>
To: Mathieu Poirier <mathieu.poirier@...aro.org>,
Suzuki K Poulose <suzuki.poulose@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Mike Leach <mike.leach@...aro.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Leo Yan <leo.yan@...aro.org>,
Randy Dunlap <rdunlap@...radead.org>,
Russell King <linux@...linux.org.uk>,
Kim Phillips <kim.phillips@....com>,
Mian Yousaf Kaukab <ykaukab@...e.de>, tsoni@...eaurora.org,
Sai Prakash Ranjan <saiprakash.ranjan@...eaurora.org>,
Mao Jinlong <jinlmao@...eaurora.org>,
coresight@...ts.linaro.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org,
Tingwei Zhang <tingwei@...eaurora.org>
Subject: [PATCH v11 18/24] coresight: cti: Fix bug clearing sysfs links on callback
From: Mike Leach <mike.leach@...aro.org>
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 <tingwei@...eaurora.org>
Signed-off-by: Mike Leach <mike.leach@...aro.org>
Signed-off-by: Tingwei Zhang <tingwei@...eaurora.org>
Acked-by: Suzuki K Poulose <suzuki.poulose@....com>
Reviewed-by: Mathieu Poirier <mathieu.poirier@...aro.org>
---
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 abc8b32e79b3..38e785d913b0 100644
--- a/drivers/hwtracing/coresight/coresight-cti.c
+++ b/drivers/hwtracing/coresight/coresight-cti.c
@@ -591,7 +591,7 @@ static 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 4f4485b17458..b8b0a20e93c9 100644
--- a/drivers/hwtracing/coresight/coresight.c
+++ b/drivers/hwtracing/coresight/coresight.c
@@ -1246,8 +1246,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);
@@ -1582,6 +1580,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);
coresight_remove_conns(csdev);
coresight_clear_default_sink(csdev);
coresight_release_platform_data(csdev, csdev->pdata);
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
Powered by blists - more mailing lists