From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, mathieu.poirier@linaro.org,
coresight@lists.linaro.org, suzuki.poulose@arm.com,
robert.walker@arm.com, al.grant@arm.com
Subject: [PATCH v2 14/14] coreisght: tmc: Claim device before use
Date: Thu, 6 Sep 2018 10:08:35 +0100 [thread overview]
Message-ID: <1536224915-31766-15-git-send-email-suzuki.poulose@arm.com> (raw)
In-Reply-To: <1536224915-31766-1-git-send-email-suzuki.poulose@arm.com>
Use CLAIM tags to make sure the device is available for use.
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
drivers/hwtracing/coresight/coresight-tmc-etf.c | 22 +++++++++++++++++++---
drivers/hwtracing/coresight/coresight-tmc-etr.c | 4 ++++
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c
index 24908e0..082f0b1 100644
--- a/drivers/hwtracing/coresight/coresight-tmc-etf.c
+++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c
@@ -36,6 +36,11 @@ static void __tmc_etb_enable_hw(struct tmc_drvdata *drvdata)
static int tmc_etb_enable_hw(struct tmc_drvdata *drvdata)
{
+ int rc = coresight_claim_device(drvdata->base);
+
+ if (rc)
+ return rc;
+
__tmc_etb_enable_hw(drvdata);
return 0;
}
@@ -66,7 +71,7 @@ static void tmc_etb_dump_hw(struct tmc_drvdata *drvdata)
return;
}
-static void tmc_etb_disable_hw(struct tmc_drvdata *drvdata)
+static void __tmc_etb_disable_hw(struct tmc_drvdata *drvdata)
{
CS_UNLOCK(drvdata->base);
@@ -82,6 +87,12 @@ static void tmc_etb_disable_hw(struct tmc_drvdata *drvdata)
CS_LOCK(drvdata->base);
}
+static void tmc_etb_disable_hw(struct tmc_drvdata *drvdata)
+{
+ coresight_disclaim_device(drvdata);
+ __tmc_etb_disable_hw(drvdata);
+}
+
static void __tmc_etf_enable_hw(struct tmc_drvdata *drvdata)
{
CS_UNLOCK(drvdata->base);
@@ -100,6 +111,11 @@ static void __tmc_etf_enable_hw(struct tmc_drvdata *drvdata)
static int tmc_etf_enable_hw(struct tmc_drvdata *drvdata)
{
+ int rc = coresight_claim_device(drvdata->base);
+
+ if (rc)
+ return rc;
+
__tmc_etf_enable_hw(drvdata);
return 0;
}
@@ -110,7 +126,7 @@ static void tmc_etf_disable_hw(struct tmc_drvdata *drvdata)
tmc_flush_and_stop(drvdata);
tmc_disable_hw(drvdata);
-
+ coresight_disclaim_device_unlocked(drvdata->base);
CS_LOCK(drvdata->base);
}
@@ -556,7 +572,7 @@ int tmc_read_prepare_etb(struct tmc_drvdata *drvdata)
/* Disable the TMC if need be */
if (drvdata->mode == CS_MODE_SYSFS)
- tmc_etb_disable_hw(drvdata);
+ __tmc_etb_disable_hw(drvdata);
drvdata->reading = true;
out:
diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c
index daad521..f684283 100644
--- a/drivers/hwtracing/coresight/coresight-tmc-etr.c
+++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c
@@ -991,6 +991,9 @@ static int tmc_etr_enable_hw(struct tmc_drvdata *drvdata,
* this on.
*/
rc = tmc_etr_enable_catu(drvdata, etr_buf);
+ if (rc)
+ return rc;
+ rc = coresight_claim_device(drvdata->base);
if (!rc) {
drvdata->etr_buf = etr_buf;
__tmc_etr_enable_hw(drvdata);
@@ -1077,6 +1080,7 @@ static void tmc_etr_disable_hw(struct tmc_drvdata *drvdata)
__tmc_etr_disable_hw(drvdata);
/* Disable CATU device if this ETR is connected to one */
tmc_etr_disable_catu(drvdata);
+ coresight_disclaim_device(drvdata->base);
/* Reset the ETR buf used by hardware */
drvdata->etr_buf = NULL;
}
--
2.7.4
next prev parent reply other threads:[~2018-09-06 9:09 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-06 9:08 [PATCH v2 00/14] coresight: Implement device claim protocol Suzuki K Poulose
2018-09-06 9:08 ` [PATCH v2 01/14] coresight: Handle failures in enabling a trace path Suzuki K Poulose
2018-09-06 9:08 ` [PATCH v2 02/14] coresight: tmc-etr: Refactor for handling errors Suzuki K Poulose
2018-09-06 9:08 ` [PATCH v2 03/14] coresight: tmc-etr: Handle errors enabling CATU Suzuki K Poulose
2018-09-06 9:08 ` [PATCH v2 04/14] coresight: tmc-etb/etf: Prepare to handle errors enabling Suzuki K Poulose
2018-09-06 9:08 ` [PATCH v2 05/14] coresight: etm4x: Add support for handling errors Suzuki K Poulose
2018-09-06 9:08 ` [PATCH v2 06/14] coresight: etm3: " Suzuki K Poulose
2018-09-06 9:08 ` [PATCH v2 07/14] coresight: etb10: Handle errors enabling the device Suzuki K Poulose
2018-09-06 9:08 ` [PATCH v2 08/14] coresight: dynamic-replicator: Handle multiple connections Suzuki K Poulose
2018-09-06 9:08 ` [PATCH v2 09/14] coresight: Add support for CLAIM tag protocol Suzuki K Poulose
2018-09-06 9:08 ` [PATCH v2 10/14] coresight: etmx: Claim devices before use Suzuki K Poulose
2018-09-06 9:08 ` [PATCH v2 11/14] coresight: funnel: " Suzuki K Poulose
2018-09-06 9:08 ` [PATCH v2 12/14] coresight: catu: Claim device " Suzuki K Poulose
2018-09-06 9:08 ` [PATCH v2 13/14] coresight: dynamic-replicator: Claim device for use Suzuki K Poulose
2018-09-06 9:08 ` Suzuki K Poulose [this message]
2018-09-12 19:42 ` [PATCH v2 00/14] coresight: Implement device claim protocol Mathieu Poirier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1536224915-31766-15-git-send-email-suzuki.poulose@arm.com \
--to=suzuki.poulose@arm.com \
--cc=al.grant@arm.com \
--cc=coresight@lists.linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=robert.walker@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).