Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2838887pxk; Tue, 15 Sep 2020 03:50:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkk6sJzYLDPA4FIuUf4vdCyJVC9X1v8BffWh+xXcvXCdFz7NOPY29qhFgm7Db09vRbK35x X-Received: by 2002:aa7:d353:: with SMTP id m19mr20995981edr.275.1600167016786; Tue, 15 Sep 2020 03:50:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600167016; cv=none; d=google.com; s=arc-20160816; b=K5cTolqCCRP56PLBio1ACIHoO3sZatnx74iDJgTjJZ0v/RUL64ZexfBks2ttY4bGuZ in9fslf7pTaoQDR8Scz2G5GHuP5oKC7zefGsUsa82HmGIyMdMKECROgPJHwQAkyJiLiP nRfzelYjUbLVuBXBmpN/HTlegu6mE0eh40xLT3BQFX8TreznbRvv79JeqdcsZGyWA2Nu iOS7PBFihfrvjI8wGjnwz2idO4zLBbQPyZsZec1AlYAqUYYOlvXRmDTcmA2EwYYO+CFM eCxqwmAqgtQWmr7Wxsqswn08HUyF6ZhMZtC2HBaiFIg54Iwn3v5Q87tuY/gzQoZeXyNQ 6j2w== 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=2Jmzvt9lu8hZREOsIFVtSCuLMl7jwroAT0dgfeCejFc=; b=r/inVwPv6Ub2mVR1oE2ghRy7Jm7a//SygnD5DHypDDGIWLzZU9DqCth3lf0zydq+WQ DhopRoiJmu4u85ZEYR/+M3Td9aQd//Pz9+UEb4mtNNmLGoZ9j8VTYFiKAcVjc7raKH7U JBzQeHdUZdMWqXAvQDp3i+51eWjFpR5hKiJ9Kd4bmsLTE+iUnJGPGc9CdxuX+83zEpE7 bvrW+B7zwRu9obOK+iAajFk/GRc3Mt407tmjMFfOyEIISopMdClCeWrUQAS2d4ywyFtU 2KLvqAGq5QMFKcFWoU4QmZJHuY32Br8s773/ZO6IbQ53yE8qj/lkbMyeHxWgzgh5vms1 k4nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=QgjTJzol; 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 r21si8092913ejo.309.2020.09.15.03.49.55; Tue, 15 Sep 2020 03:50:16 -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=QgjTJzol; 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 S1726412AbgIOKtH (ORCPT + 99 others); Tue, 15 Sep 2020 06:49:07 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:53733 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726317AbgIOKnv (ORCPT ); Tue, 15 Sep 2020 06:43:51 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1600166630; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=2Jmzvt9lu8hZREOsIFVtSCuLMl7jwroAT0dgfeCejFc=; b=QgjTJzolccc+Adpm7EqtS1ITLxnuZKioilAUwuK6Dymv4KBU0x231FP5yijWGCphnS82oa8P NMhBNnJkpiwLJ1zCsF2UeDd9p2x3itJpc4Ah2Y7dYmcc0sNnc/hFM8dRK6+kByt4zeTV25iW axhrp/oU2Nnfsd92z29nY6vD2IM= X-Mailgun-Sending-Ip: 69.72.43.7 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-n03.prod.us-east-1.postgun.com with SMTP id 5f609ad0238e1efa37db1bbf (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 15 Sep 2020 10:43:28 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id DE283C433FE; Tue, 15 Sep 2020 10:43:27 +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=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no 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 24C51C43385; Tue, 15 Sep 2020 10:43:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 24C51C43385 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=fail 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 v11 19/24] coresight: cti: don't disable ect device if it's not enabled Date: Tue, 15 Sep 2020 18:41:11 +0800 Message-Id: <20200915104116.16789-20-tingwei@codeaurora.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20200915104116.16789-1-tingwei@codeaurora.org> References: <20200915104116.16789-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 Reviewed-by: Mathieu Poirier --- 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 b8b0a20e93c9..711beb92166a 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