Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932626AbdCIPfM (ORCPT ); Thu, 9 Mar 2017 10:35:12 -0500 Received: from foss.arm.com ([217.140.101.70]:44752 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754747AbdCIPfJ (ORCPT ); Thu, 9 Mar 2017 10:35:09 -0500 From: Suzuki K Poulose To: mathieu.poirier@linaro.org Cc: linux-arm-kernel@lists.infradead.org, Chunyan Zhang , linux-kernel@vger.kernel.org, Suzuki K Poulose Subject: [PATCH 1/2] coresight: Disable the path only when the source is disabled Date: Thu, 9 Mar 2017 15:27:11 +0000 Message-Id: <1489073232-5093-2-git-send-email-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1489073232-5093-1-git-send-email-suzuki.poulose@arm.com> References: <1489073232-5093-1-git-send-email-suzuki.poulose@arm.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1750 Lines: 52 With a coresight tracing session, the components along the path from the source to sink are disabled after the source is disabled. However, if the source was not actually disabled due to active users, we should not disable the components in the path. Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 0c37356..34cd1ed 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -253,7 +253,8 @@ static int coresight_enable_source(struct coresight_device *csdev, u32 mode) return 0; } -static void coresight_disable_source(struct coresight_device *csdev) +/* coresight_disable_source: Returns true if the device has been disabled */ +static bool coresight_disable_source(struct coresight_device *csdev) { if (atomic_dec_return(csdev->refcnt) == 0) { if (source_ops(csdev)->disable) { @@ -261,6 +262,7 @@ static void coresight_disable_source(struct coresight_device *csdev) csdev->enable = false; } } + return !csdev->enable; } void coresight_disable_path(struct list_head *path) @@ -629,7 +631,7 @@ void coresight_disable(struct coresight_device *csdev) if (ret) goto out; - if (!csdev->enable) + if (!csdev->enable || !coresight_disable_source(csdev)) goto out; switch (csdev->subtype.source_subtype) { @@ -647,7 +649,6 @@ void coresight_disable(struct coresight_device *csdev) break; } - coresight_disable_source(csdev); coresight_disable_path(path); coresight_release_path(path); -- 2.7.4