Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 837c89ea authored by Saranya Chidura's avatar Saranya Chidura Committed by Gerrit - the friendly Code Review server
Browse files

coresight: Fix the mem_type and mem_size of ETR



The ETR sysfs nodes mem_type and mem_size can be altered
when etr is in enabled state. But that does not the change
the operation of ETR, as its already initialised with
settings at the point of enablement.This fix check the ETR
state, when user tries to change them on runtime.

Signed-off-by: default avatarSaranya Chidura <schidura@codeaurora.org>
Change-Id: Iba8c695dfa00d6183e88aab8316f16749d8da875
parent 34e1614a
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -393,6 +393,12 @@ static ssize_t mem_size_store(struct device *dev,
		return -EINVAL;
	}

	if (drvdata->enable) {
		mutex_unlock(&drvdata->mem_lock);
		pr_err("ETR is in use, disable it to change the mem_size\n");
		return -EINVAL;
	}

	drvdata->mem_size = val;
	mutex_unlock(&drvdata->mem_lock);
	return size;
@@ -523,6 +529,11 @@ static ssize_t mem_type_store(struct device *dev,
		return -EINVAL;

	mutex_lock(&drvdata->mem_lock);
	if (drvdata->enable) {
		mutex_unlock(&drvdata->mem_lock);
		pr_err("ETR is in use, disable it to switch the mode\n");
		return -EINVAL;
	}
	if (!strcmp(str, str_tmc_etr_mem_type[TMC_ETR_MEM_TYPE_CONTIG]))
		drvdata->mem_type = TMC_ETR_MEM_TYPE_CONTIG;
	else if (!strcmp(str, str_tmc_etr_mem_type[TMC_ETR_MEM_TYPE_SG]))