mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-29 23:53:32 +00:00
coreisght: tmc: Claim device before use
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> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
b85847eeea
commit
4d3ebd3658
2 changed files with 23 additions and 3 deletions
|
@ -36,6 +36,11 @@ static void __tmc_etb_enable_hw(struct tmc_drvdata *drvdata)
|
||||||
|
|
||||||
static int 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);
|
__tmc_etb_enable_hw(drvdata);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -63,7 +68,7 @@ static void tmc_etb_dump_hw(struct tmc_drvdata *drvdata)
|
||||||
return;
|
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);
|
CS_UNLOCK(drvdata->base);
|
||||||
|
|
||||||
|
@ -79,6 +84,12 @@ static void tmc_etb_disable_hw(struct tmc_drvdata *drvdata)
|
||||||
CS_LOCK(drvdata->base);
|
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)
|
static void __tmc_etf_enable_hw(struct tmc_drvdata *drvdata)
|
||||||
{
|
{
|
||||||
CS_UNLOCK(drvdata->base);
|
CS_UNLOCK(drvdata->base);
|
||||||
|
@ -97,6 +108,11 @@ static void __tmc_etf_enable_hw(struct tmc_drvdata *drvdata)
|
||||||
|
|
||||||
static int 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);
|
__tmc_etf_enable_hw(drvdata);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -107,7 +123,7 @@ static void tmc_etf_disable_hw(struct tmc_drvdata *drvdata)
|
||||||
|
|
||||||
tmc_flush_and_stop(drvdata);
|
tmc_flush_and_stop(drvdata);
|
||||||
tmc_disable_hw(drvdata);
|
tmc_disable_hw(drvdata);
|
||||||
|
coresight_disclaim_device_unlocked(drvdata->base);
|
||||||
CS_LOCK(drvdata->base);
|
CS_LOCK(drvdata->base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -553,7 +569,7 @@ int tmc_read_prepare_etb(struct tmc_drvdata *drvdata)
|
||||||
|
|
||||||
/* Disable the TMC if need be */
|
/* Disable the TMC if need be */
|
||||||
if (drvdata->mode == CS_MODE_SYSFS)
|
if (drvdata->mode == CS_MODE_SYSFS)
|
||||||
tmc_etb_disable_hw(drvdata);
|
__tmc_etb_disable_hw(drvdata);
|
||||||
|
|
||||||
drvdata->reading = true;
|
drvdata->reading = true;
|
||||||
out:
|
out:
|
||||||
|
|
|
@ -991,6 +991,9 @@ static int tmc_etr_enable_hw(struct tmc_drvdata *drvdata,
|
||||||
* this on.
|
* this on.
|
||||||
*/
|
*/
|
||||||
rc = tmc_etr_enable_catu(drvdata, etr_buf);
|
rc = tmc_etr_enable_catu(drvdata, etr_buf);
|
||||||
|
if (rc)
|
||||||
|
return rc;
|
||||||
|
rc = coresight_claim_device(drvdata->base);
|
||||||
if (!rc) {
|
if (!rc) {
|
||||||
drvdata->etr_buf = etr_buf;
|
drvdata->etr_buf = etr_buf;
|
||||||
__tmc_etr_enable_hw(drvdata);
|
__tmc_etr_enable_hw(drvdata);
|
||||||
|
@ -1077,6 +1080,7 @@ static void tmc_etr_disable_hw(struct tmc_drvdata *drvdata)
|
||||||
__tmc_etr_disable_hw(drvdata);
|
__tmc_etr_disable_hw(drvdata);
|
||||||
/* Disable CATU device if this ETR is connected to one */
|
/* Disable CATU device if this ETR is connected to one */
|
||||||
tmc_etr_disable_catu(drvdata);
|
tmc_etr_disable_catu(drvdata);
|
||||||
|
coresight_disclaim_device(drvdata->base);
|
||||||
/* Reset the ETR buf used by hardware */
|
/* Reset the ETR buf used by hardware */
|
||||||
drvdata->etr_buf = NULL;
|
drvdata->etr_buf = NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue