lkml.org 
[lkml]   [2020]   [Sep]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v10 18/24] coresight: cti: Fix bug clearing sysfs links on callback
On Fri, Aug 21, 2020 at 11:44:39AM +0800, Tingwei Zhang wrote:
> From: Mike Leach <mike.leach@linaro.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@codeaurora.org>
> Signed-off-by: Mike Leach <mike.leach@linaro.org>
> Signed-off-by: Tingwei Zhang <tingwei@codeaurora.org>
> Acked-by: Suzuki K Poulose <suzuki.poulose@arm.com>

Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.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 73304374a155..ec286d617b73 100644
> --- a/drivers/hwtracing/coresight/coresight-cti.c
> +++ b/drivers/hwtracing/coresight/coresight-cti.c
> @@ -608,7 +608,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 c2174fed263b..6c09be15d60c 100644
> --- a/drivers/hwtracing/coresight/coresight.c
> +++ b/drivers/hwtracing/coresight/coresight.c
> @@ -1254,8 +1254,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);
> @@ -1590,6 +1588,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
>

\
 
 \ /
  Last update: 2020-09-11 01:01    [W:0.234 / U:0.628 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site