Merge "tmc-etr: Check if it is mode switch action during disable etr"

This commit is contained in:
qctecmdr 2020-04-23 04:14:53 -07:00 • committed by Gerrit - the friendly Code Review server
commit 4b59da9515

View file

@ -1925,7 +1925,8 @@ static int tmc_enable_etr_sink(struct coresight_device *csdev,
return -EINVAL;
}
static int _tmc_disable_etr_sink(struct coresight_device *csdev)
static int _tmc_disable_etr_sink(struct coresight_device *csdev,
bool mode_switch)
{
unsigned long flags;
struct tmc_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
@ -1937,7 +1938,7 @@ static int _tmc_disable_etr_sink(struct coresight_device *csdev)
return -EBUSY;
}
if (atomic_dec_return(csdev->refcnt)) {
if (atomic_dec_return(csdev->refcnt) && !mode_switch) {
spin_unlock_irqrestore(&drvdata->spinlock, flags);
return -EBUSY;
}
@ -1985,7 +1986,7 @@ static int tmc_disable_etr_sink(struct coresight_device *csdev)
int ret;
mutex_lock(&drvdata->mem_lock);
ret = _tmc_disable_etr_sink(csdev);
ret = _tmc_disable_etr_sink(csdev, false);
mutex_unlock(&drvdata->mem_lock);
return ret;
}
@ -2016,7 +2017,7 @@ int tmc_etr_switch_mode(struct tmc_drvdata *drvdata, const char *out_mode)
}
coresight_disable_all_source_link();
_tmc_disable_etr_sink(drvdata->csdev);
_tmc_disable_etr_sink(drvdata->csdev, true);
old_mode = drvdata->out_mode;
drvdata->out_mode = new_mode;
if (tmc_enable_etr_sink_sysfs(drvdata->csdev)) {