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

Commit a4ccdb24 authored by Shubhraprakash Das's avatar Shubhraprakash Das Committed by Gerrit - the friendly Code Review server
Browse files

msm: kgsl: Do not get active count on coresight start/stop



When coresight is started it is called from adreno_start
which should have the power and clocks enabled. Getting an active
count in coresight start path will cause the device mutex to be
released midway in adreno_start which can cause race conditions.
Similarly, there is no need to get active count when coresight is
being stopped.

Change-Id: I6a637bfcf02788e63f32acbcbb29e22df198efd0
Signed-off-by: default avatarShubhraprakash Das <sadas@codeaurora.org>
parent 71d0627e
Loading
Loading
Loading
Loading
+20 −22
Original line number Diff line number Diff line
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2015, 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
@@ -171,8 +171,7 @@ static int _adreno_coresight_get_and_clear(struct adreno_device *adreno_dev)
	if (coresight == NULL)
		return -ENODEV;

	if (!kgsl_active_count_get(device)) {

	kgsl_pre_hwaccess(device);
	/*
	 * Save the current value of each coresight register
	 * and then clear each register
@@ -183,8 +182,6 @@ static int _adreno_coresight_get_and_clear(struct adreno_device *adreno_dev)
		kgsl_regwrite(device, coresight->registers[i].offset,
			0);
	}
		kgsl_active_count_put(device);
	}

	return 0;
}
@@ -199,14 +196,11 @@ static int _adreno_coresight_set(struct adreno_device *adreno_dev)
	if (coresight == NULL)
		return -ENODEV;

	if (!kgsl_active_count_get(device)) {
	BUG_ON(!kgsl_state_is_awake(device));
	for (i = 0; i < coresight->count; i++)
		kgsl_regwrite(device, coresight->registers[i].offset,
			coresight->registers[i].value);

		kgsl_active_count_put(device);
	}

	return 0;
}
/**
@@ -249,7 +243,11 @@ static int adreno_coresight_enable(struct coresight_device *csdev)
			coresight->registers[i].value =
				coresight->registers[i].initial;

		ret = kgsl_active_count_get(device);
		if (!ret) {
			ret = _adreno_coresight_set(adreno_dev);
			kgsl_active_count_put(device);
		}
	}

	mutex_unlock(&device->mutex);