Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp994473pxa; Wed, 19 Aug 2020 22:52:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztiJWqmfcPIQ2JVhHu5ZreCl9282Zu9dIpqetmcw8CdP54XjeFB+nSRimGun2E4NiXDtB9 X-Received: by 2002:a17:906:98c1:: with SMTP id zd1mr1788837ejb.410.1597902730905; Wed, 19 Aug 2020 22:52:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597902730; cv=none; d=google.com; s=arc-20160816; b=RraQesL6bYBEJhnklHZ1Y2/2RgsySKv8FBB5DgZ6JADVZDvzuxL7MF6h1tAr1BqddW kSlPrzM9/CAkiAvLYNwwxY6c4k6BO8DM+8XoKsaDLc15YVAG57a88iiI2soLX31IYrnA hz2CUm5+kAhIiKaYHpWLHCCyeUeq3hPkx7aRV22I6btmTcv2VXJcolCg4hC13uq7Hja3 ipxoNAMXKsZab4jofQ5Fqxbyyz0a5q5KexNGeM6yOq4NEOWQUmzpFLgw+h0XufC80UdR h8bjUTU00olqbolyUIRNFlPKD9ypSamXhLD5BB9Nze0kdtqing7NPc5Ewxlheo7tp6GB t/Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature; bh=6f3nW8BB3LD77B8rxJL28CQ6zCWJVGq7xudazlaiolw=; b=RoUpdnmm3+c7p/vwrMDg/T7vSfN1oHfmmRhjrkGl4xLBDQ5OoxB4eHVK57kV29+Ox9 VAkUG8zn8szX73+YBWb/w4lIItyCpMEo63wHTBZ0zDxtGvC3uKfXdfI1ltqUvzTiWG+2 RhGLWlSVCBeESC9zat1l83AbfI+0+Aj9ou2UpcEXmNURjO8xrt/iinBgLwtjAAi0OCzt 6pcLyKp33XebE+/76Gyvn2QA/pDN0kDWvf/PRshoKtCchnwr3Afx45JDSD/+Zb31piJM CsqtKEplTF3fcAEMGm54PutBjOLdmSK6BPMZag8SYLsK+Soj+2on5wdm5jYQoVlY0cJO 1Nhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=rWevVd6X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v17si567636ejd.324.2020.08.19.22.51.47; Wed, 19 Aug 2020 22:52:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=rWevVd6X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727021AbgHTFvE (ORCPT + 99 others); Thu, 20 Aug 2020 01:51:04 -0400 Received: from mail29.static.mailgun.info ([104.130.122.29]:13055 "EHLO mail29.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726795AbgHTFvD (ORCPT ); Thu, 20 Aug 2020 01:51:03 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1597902663; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=6f3nW8BB3LD77B8rxJL28CQ6zCWJVGq7xudazlaiolw=; b=rWevVd6Xg+qwMV00tYqFAywVV4AQ2ewwE7njSNbgLVKdHghnAjYI9140X+4nXe/J68kM3JrZ 9pz4SjsXYWlik5BsIMgY0HGqg1VWi3WSFWyOBogDAjl8hsCyzxopquzPBXX/X9BfJyTXmyO2 dJ/5+W2TGgcKjrXJyG2buj1P2bQ= X-Mailgun-Sending-Ip: 104.130.122.29 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n06.prod.us-west-2.postgun.com with SMTP id 5f3e0f3e7e76db358ef855aa (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 20 Aug 2020 05:50:54 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id F1573C4344C; Thu, 20 Aug 2020 05:50:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from tingweiz-gv.qualcomm.com (unknown [180.166.53.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: tingwei) by smtp.codeaurora.org (Postfix) with ESMTPSA id 1B07BC433CA; Thu, 20 Aug 2020 05:50:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1B07BC433CA Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=tingwei@codeaurora.org From: Tingwei Zhang To: Mathieu Poirier , Suzuki K Poulose , Alexander Shishkin , Mike Leach Cc: Tingwei Zhang , Greg Kroah-Hartman , Leo Yan , Randy Dunlap , Russell King , Kim Phillips , Mian Yousaf Kaukab , tsoni@codeaurora.org, Sai Prakash Ranjan , Mao Jinlong , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v9 19/24] coresight: cti: don't disable ect device if it's not enabled Date: Thu, 20 Aug 2020 13:47:13 +0800 Message-Id: <20200820054718.20115-20-tingwei@codeaurora.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20200820054718.20115-1-tingwei@codeaurora.org> References: <20200820054718.20115-1-tingwei@codeaurora.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If associated ect device is not enabled at first place, disable routine should not be called. Add ect_enabled flag to check whether ect device is enabled. Fix the issue in below case. Ect device is not available when associated coresight device enabled and the association is established after coresight device is enabled. Signed-off-by: Mike Leach Signed-off-by: Tingwei Zhang --- drivers/hwtracing/coresight/coresight.c | 11 ++++++++--- include/linux/coresight.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 6c09be15d60c..d354fd57474e 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -244,13 +244,18 @@ coresight_control_assoc_ectdev(struct coresight_device *csdev, bool enable) if (!ect_csdev) return 0; + if ((!ect_ops(ect_csdev)->enable) || (!ect_ops(ect_csdev)->disable)) + return 0; if (enable) { - if (ect_ops(ect_csdev)->enable) - ect_ret = ect_ops(ect_csdev)->enable(ect_csdev); + ect_ret = ect_ops(ect_csdev)->enable(ect_csdev); + if (!ect_ret) + csdev->ect_enabled = true; } else { - if (ect_ops(ect_csdev)->disable) + if (csdev->ect_enabled) { ect_ret = ect_ops(ect_csdev)->disable(ect_csdev); + csdev->ect_enabled = false; + } } /* output warning if ECT enable is preventing trace operation */ diff --git a/include/linux/coresight.h b/include/linux/coresight.h index 3bb738f9a326..7d3c87e5b97c 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -208,6 +208,7 @@ struct coresight_device { /* sysfs links between components */ int nr_links; bool has_conns_grp; + bool ect_enabled; /* true only if associated ect device is enabled */ }; /* -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project