From patchwork Mon Sep 28 16:35:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 11804101 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EA16B6CB for ; Mon, 28 Sep 2020 16:42:41 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B3D28208FE for ; Mon, 28 Sep 2020 16:42:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KPReOner"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="w2aEywjx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B3D28208FE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Lo5NeWKAzxI/UsCWHxu0QtDCL7UKV/KWOg/QDXSttNw=; b=KPReOnerGDkPTanqzijIRJbGN phzOXQiaNK/XHxOU08qIjwuZ0oqVm+5304w9B5cIaKzsAoLdJF5Tj+seFmMfG7vCJZgtXpTiNPORz lbEpIP+alirSwxPHKmhLWKwRSMT40+CEcPHY7toHKKqkIzHfbalm9FXy4tJAipjJ3k+TFeBN4rkpa CdmMl6hwHJr6sVaTJUCGfXh1iPMnT48hzPJFXvSNuajQuf5V3+n5GGlZKM7z0m3Sqj8DBteLsHVEt siYErB7litGPmO4GMo77AF91S6wMu9i3TqJy8N80hnEWknyDbkrnSXWxlEAL19YaRlVMWbuAVELOu A9J06zcIg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMwCB-0002Qe-8E; Mon, 28 Sep 2020 16:40:11 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMw7j-0000dE-U9 for linux-arm-kernel@lists.infradead.org; Mon, 28 Sep 2020 16:35:42 +0000 Received: by mail-pf1-x441.google.com with SMTP id d6so1508097pfn.9 for ; Mon, 28 Sep 2020 09:35:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LbFpq0wd5+hxz3XH6XRLouzUqxCeQhgca4mXu1de8J8=; b=w2aEywjxp9dMgipUoJ9iL8g/12berH/b8sx9NjaH5ufVmIakaWTqAR7la8pcEAG/BZ CNtY3YTMyLhvZGoeaREXAi9j9EmxQMPZyYfpsq5GyZMZ7T2k1F8J4qK2dQiWMarPPb/r SF3Apbu35eZ5srGjlVDKE1C+aZfayp8FE3AVwdkH3uo5apOsO5EMZ9UBHAKDmx812GF6 8Mw69mvUuu9iqPWg0NZHha54Mu8vtOjaANYclXJdjK0tlnWe5deeXTbGHMekNSvKqtRN RPV7ssadgFHgNP1d8omQtHD4ao6+imEOcu/wxsUiUAVnb4+UMsLJxS88/s/YAho72c5w skIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LbFpq0wd5+hxz3XH6XRLouzUqxCeQhgca4mXu1de8J8=; b=tSP1ma2WqJNRa7jEBd1eZOj2H8b2pPYCzpKTm7bx9EKseJv+gmlIyTOS1idS3JxEIK T0TrBPjuKAhVDvlhdFsHjl/Hi5fwl+ZYl9NAs56Wlnh2sNChq/AC8iytLsA9CxS4SbXR hK3GXGJGIfWxCZ9HaD5ArRM4bXmXX5ius/ZkltDYKWl+MOWD5EdQI5G1cc08F1SOP/eW YnJqi8LFohPkhwhcZAiqnjWKk9tWdfzxxeOpXV+EVC7LwDDsvOnADBKLvWvxcffem0s6 qAwaihlk6SuWIRBmcTxWOehOaN/7dRHaG/kpexX1KEvmbPJjcigbbMSrLBkC/fxlfeuB Gy0Q== X-Gm-Message-State: AOAM5335XZLmAMM21A8mmRO8YhjIq1HEMgN51OaeXEYXn34zRnV+jTYR zYIn9OO2b3r7o/AJX4x1BG7Z69xCoIAs4A== X-Google-Smtp-Source: ABdhPJyZB5vjT7d/JfEtTBZ44fpfjE6idaPbl/mLkqGjBv2OCTPwzokn0FcFyvA3SLKHoBoTJf/VMA== X-Received: by 2002:a62:6147:0:b029:142:2501:34e8 with SMTP id v68-20020a6261470000b0290142250134e8mr209057pfb.65.1601310934053; Mon, 28 Sep 2020 09:35:34 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id f19sm2345640pfd.45.2020.09.28.09.35.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 09:35:33 -0700 (PDT) From: Mathieu Poirier To: gregkh@linuxfoundation.org Subject: [PATCH 18/25] coresight: cti: Fix bug clearing sysfs links on callback Date: Mon, 28 Sep 2020 10:35:06 -0600 Message-Id: <20200928163513.70169-19-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200928163513.70169-1-mathieu.poirier@linaro.org> References: <20200928163513.70169-1-mathieu.poirier@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200928_123536_044503_E6D1CDF8 X-CRM114-Status: GOOD ( 18.32 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:441 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Mike Leach 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 Signed-off-by: Mike Leach Signed-off-by: Tingwei Zhang Acked-by: Suzuki K Poulose Signed-off-by: Mathieu Poirier --- 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);