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

Commit 29a7fcd4 authored by Satyajit Desai's avatar Satyajit Desai Committed by Gerrit - the friendly Code Review server
Browse files

coresight: Remove recursive mutex usage



Call to reset source sink node leads to us trying to take
recursive mutex which results in a deadlock. Move mutex call
to avoid this issue.

Change-Id: Ia1396b08a63fe9d9890c0ef8e6ca5ec4f553b714
Signed-off-by: default avatarSatyajit Desai <sadesai@codeaurora.org>
Signed-off-by: default avatarRama Aparna Mallavarapu <aparnam@codeaurora.org>
parent df85b0eb
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -697,26 +697,28 @@ int coresight_enable(struct coresight_device *csdev)
}
EXPORT_SYMBOL_GPL(coresight_enable);

void coresight_disable(struct coresight_device *csdev)
static void __coresight_disable(struct coresight_device *csdev)
{
	int  ret;

	mutex_lock(&coresight_mutex);

	ret = coresight_validate_source(csdev, __func__);
	if (ret)
		goto out;
		return;

	if (!csdev->enable || !coresight_disable_source(csdev))
		goto out;
		return;

	if (csdev->node == NULL)
		goto out;
		return;

	coresight_disable_path(csdev->node->path);
	coresight_release_path(csdev, csdev->node->path);
}

out:
void coresight_disable(struct coresight_device *csdev)
{
	mutex_lock(&coresight_mutex);
	__coresight_disable(csdev);
	mutex_unlock(&coresight_mutex);
}
EXPORT_SYMBOL_GPL(coresight_disable);
@@ -1010,7 +1012,7 @@ static ssize_t reset_source_sink_store(struct bus_type *bus,
		csdev = coresight_get_source(cspath->path);
		if (!csdev)
			continue;
		coresight_disable(csdev);
		__coresight_disable(csdev);
	}

	mutex_unlock(&coresight_mutex);