Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2359286pxk; Mon, 14 Sep 2020 11:09:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyziNzA8C0rWCYG8lwAKeQGCF+0tWAlIZvbVVxgUXqvncenM1e53AEVBNsqCV5ViOH4bEfg X-Received: by 2002:a05:6402:1851:: with SMTP id v17mr18180484edy.46.1600106967599; Mon, 14 Sep 2020 11:09:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600106967; cv=none; d=google.com; s=arc-20160816; b=voS0PASCBUowartqfyC1Tzqde2AcQxMIthF9u4qJrNOJGysxx9Bn1pp5IEd11jKAzG GHpRcmNLBK9KO6OEi0EfNYNhgP7u1ODaxnK0yb47Yb6+nc4cmy0M8mWfk3TU1gLE+jTb Ze+vQltZ4Qms2AsBsLUzCDZ4/a/RNL0w53oOV0+P0chtTF+RRX3fpGLqtVJJafiIwtfi zaKIu23EVqW/FQ+datw1sxrSUKaPvnK6UVPhyUg8RboxCKK5Ti5CKNudKFnXims1QmiP YWOI8wFMwtVY0WTAphm4S9VzNRJ2RJoFtPfQrXGxuq2aLyBA1xllCkhkhJREQS8KG5Dt mmTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=kHCI7393v5p3kexWunTjdq/iYFgJKMZ0uvZccmvK5y8=; b=HHsn3U2VEIaY87iOCytG0FnowV7KovgNwlfFAYk93NUhZoUDU9UaZUUX7NHW/mhwtW 3T7Msmf1HH7TwjCPDvhquZqldBKAdWeEd7r5Z6wApl+RJ0GqP3lhp379CTXQXDon29iv X9hYtBRbFvqbDUN+GHEirTJM4QqOx+3NXjVGYyCItsuBGvk/Ba3e9meAgGf8oVubeHto w7q9DevEVvoH3t6cW7SMxjOJyYlm28gmhShOfCysXBa8rQtLBSdErHSDRpjOAShKoNUB qinFMqi1i01sgcFdtY7Zr+SnKwml2YKqTBEIU2II9oeaXS6qtuweoxOxyE3xZIiV/75O svpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wq1KqHf7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d9si7643105edv.452.2020.09.14.11.09.04; Mon, 14 Sep 2020 11:09:27 -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=pass header.i=@linaro.org header.s=google header.b=Wq1KqHf7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726106AbgINSIT (ORCPT + 99 others); Mon, 14 Sep 2020 14:08:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726052AbgINSHg (ORCPT ); Mon, 14 Sep 2020 14:07:36 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C228C06174A for ; Mon, 14 Sep 2020 11:07:36 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id l191so438538pgd.5 for ; Mon, 14 Sep 2020 11:07:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=kHCI7393v5p3kexWunTjdq/iYFgJKMZ0uvZccmvK5y8=; b=Wq1KqHf7XbQNK9J/wBkbvAfCmPENj64N2mQRwZxLftk5ZvLJHMrD5KIRurHlZakzam g5Dhpjg6yuiPSn783tfxST3oemxDNWGHY8QjYw5lqQ8UVYyppUj6vCC3VFQo8k3mc2aL JNP9W6DX666rVAfjikQ75Qg0yTTl25zoTMezx6mW1Ty1LYP5p/CtnlsoodcEeO7Z0aLP Xzpe+wlxBe4BXfPPocf0g8pvNdad57vqt9HrwddSWHzEhKg827LCHxAS76YL/3euUKdO +aj8pgobrGQbGokyuLRFQL12u0pD0XY+4QX4qt3TL1j+hA51Q4m9cCW56TGEB9+iJ4Km cL3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=kHCI7393v5p3kexWunTjdq/iYFgJKMZ0uvZccmvK5y8=; b=UPRkvsnWNLPelk9+tTeIqKY3pV50zCBoZireFlyZiOn+XmW1LDnsQMTyAa2oNs+r4Z 3/3NYPei6PYJ6a8ULTjg+d8d6YTDivqLtr+nRI+brMWXL4F0C2QiqmEfKEH+jwW/1uvg FfQZtAo0+Ld331bzfSOMFsNvNpCXv6Ar84Yuyr4Z5h5cKaej+lfdBdCs2tm6xvWbyLPr 2v9je1C9MvJOVNpH2wGRLOQqzAamIyagDdO55wRqjRDGFdO6E+sC8zm83JudGlmkk1nm 0N6otiUPhRRaCzLiArjKBPfUF6GPhh20twcvcEM6nWdmTxC9Azyizg3vuqZjHoiLx327 k8AQ== X-Gm-Message-State: AOAM532d5CT9y9zArdbviVua0oNvDHRa6Q6EjXLCbohJFjGvQuMj/GXf vY0tMIlCotXid75x1Myl61RrsQ== X-Received: by 2002:a63:a55e:: with SMTP id r30mr12232178pgu.61.1600106855715; Mon, 14 Sep 2020 11:07:35 -0700 (PDT) Received: from xps15 (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id y23sm10906205pfp.65.2020.09.14.11.07.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Sep 2020 11:07:35 -0700 (PDT) Date: Mon, 14 Sep 2020 12:07:32 -0600 From: Mathieu Poirier To: Tingwei Zhang Cc: Suzuki K Poulose , Alexander Shishkin , Mike Leach , 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: Re: [PATCH v10 19/24] coresight: cti: don't disable ect device if it's not enabled Message-ID: <20200914180732.GB3238264@xps15> References: <20200821034445.967-1-tingwei@codeaurora.org> <20200821034445.967-20-tingwei@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200821034445.967-20-tingwei@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 21, 2020 at 11:44:40AM +0800, Tingwei Zhang wrote: > 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 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 >