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

Commit 95924c87 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: msm: qdsp6v2: make audio debugfs read and release exclusive"

parents 1b03fe90 66cd4ad5
Loading
Loading
Loading
Loading
+36 −22
Original line number Diff line number Diff line
@@ -26,11 +26,14 @@
#include <linux/debugfs.h>
#include <linux/msm_audio_ion.h>
#include <linux/compat.h>
#include <linux/mutex.h>
#include "audio_utils_aio.h"
#ifdef CONFIG_USE_DEV_CTRL_VOLUME
#include <linux/qdsp6v2/audio_dev_ctl.h>
#endif /*CONFIG_USE_DEV_CTRL_VOLUME*/
static DEFINE_MUTEX(lock);
#ifdef CONFIG_DEBUG_FS

int audio_aio_debug_open(struct inode *inode, struct file *file)
{
	file->private_data = inode->i_private;
@@ -43,10 +46,14 @@ ssize_t audio_aio_debug_read(struct file *file, char __user *buf,
	const int debug_bufmax = 4096;
	static char buffer[4096];
	int n = 0;
	struct q6audio_aio *audio = file->private_data;
	struct q6audio_aio *audio;

	mutex_lock(&lock);
	if (file->private_data != NULL) {
		audio = file->private_data;
		mutex_lock(&audio->lock);
	n = scnprintf(buffer, debug_bufmax, "opened %d\n", audio->opened);
		n = scnprintf(buffer, debug_bufmax, "opened %d\n",
				audio->opened);
		n += scnprintf(buffer + n, debug_bufmax - n,
				"enabled %d\n", audio->enabled);
		n += scnprintf(buffer + n, debug_bufmax - n,
@@ -63,9 +70,13 @@ ssize_t audio_aio_debug_read(struct file *file, char __user *buf,
		n += scnprintf(buffer + n, debug_bufmax - n,
				"rflush %d\n", audio->rflush);
		n += scnprintf(buffer + n, debug_bufmax - n,
			"inqueue empty %d\n", list_empty(&audio->in_queue));
				"inqueue empty %d\n",
				list_empty(&audio->in_queue));
		n += scnprintf(buffer + n, debug_bufmax - n,
			"outqueue empty %d\n", list_empty(&audio->out_queue));
				"outqueue empty %d\n",
				list_empty(&audio->out_queue));
	}
	mutex_unlock(&lock);
	buffer[n] = 0;
	return simple_read_from_buffer(buf, count, ppos, buffer, n);
}
@@ -580,6 +591,7 @@ int audio_aio_release(struct inode *inode, struct file *file)
	struct q6audio_aio *audio = file->private_data;

	pr_debug("%s[%pK]\n", __func__, audio);
	mutex_lock(&lock);
	mutex_lock(&audio->lock);
	mutex_lock(&audio->read_lock);
	mutex_lock(&audio->write_lock);
@@ -622,6 +634,8 @@ int audio_aio_release(struct inode *inode, struct file *file)
#endif
	kfree(audio->codec_cfg);
	kfree(audio);
	file->private_data = NULL;
	mutex_unlock(&lock);
	return 0;
}