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

Commit c4d2facb authored by Mao Jinlong's avatar Mao Jinlong Committed by Gerrit - the friendly Code Review server
Browse files

coresight: tgu: Fix issue which is unable to enable/disbale tgu



pm_runtime_get_sync can return positive. Correct the check of it.
And remove the extra spin_unlock in enable_tgu which will cause issue
when disable tgu.

Change-Id: Ic8b46d1da7cbfe06b3e58e34bd1e62cea31ac8bf
Signed-off-by: default avatarMao Jinlong <jinlmao@codeaurora.org>
parent 5c0b1a86
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017, 2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -123,8 +123,10 @@ static ssize_t enable_tgu(struct device *dev,

	/* Enable clock */
	ret = pm_runtime_get_sync(drvdata->dev);
	if (ret)
	if (ret < 0) {
		pm_runtime_put(drvdata->dev);
		return ret;
	}

	spin_lock(&drvdata->spinlock);
	/* Unlock the TGU LAR */
@@ -176,7 +178,6 @@ static ssize_t enable_tgu(struct device *dev,
		/* Disable TGU to program the triggers */
		tgu_writel(drvdata, 0, TGU_CONTROL);
		TGU_LOCK(drvdata);
		spin_unlock(&drvdata->spinlock);

		pm_runtime_put(drvdata->dev);
		dev_dbg(dev, "Coresight-TGU disabled\n");
@@ -202,9 +203,11 @@ static ssize_t reset_tgu(struct device *dev,
	if (!drvdata->enable) {
		/* Enable clock */
		ret = pm_runtime_get_sync(drvdata->dev);
		if (ret)
		if (ret < 0) {
			pm_runtime_put(drvdata->dev);
			return ret;
		}
	}

	spin_lock(&drvdata->spinlock);
	/* Unlock the TGU LAR */