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

Commit 7e6c20f1 authored by Edgar Flores's avatar Edgar Flores Committed by Mohammed Nayeem Ur Rahman
Browse files

msm: adsprpc: store process specific info in GETINFO ioctl call



Currently, process specific info like name and PID is being stored
in the internal data structures at the time of device open. But
since the DSP HAL service will now be opening the device node on
behalf of third-party applications, store process specific info in
GETINFO ioctl call which will be the first IOCTL call directly
from the client application.

Change-Id: If05d48123e4ec52c0271a7cb7f3ca790662d9abe
Acked-by: default avatarThyagarajan Venkatanarayanan <venkatan@qti.qualcomm.com>
Signed-off-by: default avatarEdgar Flores <edgarf@codeaurora.org>
Signed-off-by: default avatarHimateja Reddy <hmreddy@codeaurora.org>
parent 4945d76d
Loading
Loading
Loading
Loading
+26 −18
Original line number Diff line number Diff line
@@ -3942,11 +3942,8 @@ static int fastrpc_channel_open(struct fastrpc_file *fl)
static int fastrpc_device_open(struct inode *inode, struct file *filp)
{
	int err = 0;
	struct dentry *debugfs_file;
	struct fastrpc_file *fl = NULL;
	struct fastrpc_apps *me = &gfa;
	char strpid[PID_SIZE];
	int buf_size = 0;

	/*
	 * Indicates the device node opened
@@ -3965,18 +3962,6 @@ static int fastrpc_device_open(struct inode *inode, struct file *filp)
	if (err)
		return err;

	snprintf(strpid, PID_SIZE, "%d", current->pid);
	buf_size = strlen(current->comm) + strlen("_") + strlen(strpid) + 1;
	VERIFY(err, NULL != (fl->debug_buf = kzalloc(buf_size, GFP_KERNEL)));
	if (err) {
		kfree(fl);
		return err;
	}
	snprintf(fl->debug_buf, UL_SIZE, "%.10s%s%d",
			current->comm, "_", current->pid);
	debugfs_file = debugfs_create_file(fl->debug_buf, 0644, debugfs_root,
						fl, &debugfs_fops);

	fl->wake_source = wakeup_source_register(fl->debug_buf);
	if (IS_ERR_OR_NULL(fl->wake_source)) {
		pr_err("adsprpc: Error: %s: %s: wakeup_source_register failed with err %ld\n",
@@ -3990,14 +3975,11 @@ static int fastrpc_device_open(struct inode *inode, struct file *filp)
	INIT_HLIST_HEAD(&fl->remote_bufs);
	INIT_HLIST_NODE(&fl->hn);
	fl->sessionid = 0;
	fl->tgid = current->tgid;
	fl->apps = me;
	fl->mode = FASTRPC_MODE_SERIAL;
	fl->cid = -1;
	fl->dev_minor = dev_minor;
	fl->init_mem = NULL;
	if (debugfs_file != NULL)
		fl->debugfs_file = debugfs_file;
	memset(&fl->perf, 0, sizeof(fl->perf));
	fl->qos_request = 0;
	fl->dsp_proc_init = 0;
@@ -4011,12 +3993,38 @@ static int fastrpc_device_open(struct inode *inode, struct file *filp)
	return 0;
}

static int fastrpc_set_process_info(struct fastrpc_file *fl)
{
	int err = 0, buf_size = 0;
	char strpid[PID_SIZE];

	fl->tgid = current->tgid;
	snprintf(strpid, PID_SIZE, "%d", current->pid);
	buf_size = strlen(current->comm) + strlen("_") + strlen(strpid) + 1;
	fl->debug_buf = kzalloc(buf_size, GFP_KERNEL);
	if (!fl->debug_buf) {
		err = -ENOMEM;
		return err;
	}
	snprintf(fl->debug_buf, UL_SIZE, "%.10s%s%d",
			current->comm, "_", current->pid);
	fl->debugfs_file = debugfs_create_file(fl->debug_buf, 0644,
					debugfs_root, fl, &debugfs_fops);
	if (!fl->debugfs_file)
		pr_warn("Error: %s: %s: failed to create debugfs file %s\n",
				current->comm, __func__, fl->debug_buf);
	return err;
}

static int fastrpc_get_info(struct fastrpc_file *fl, uint32_t *info)
{
	int err = 0;
	uint32_t cid;

	VERIFY(err, fl != NULL);
	if (err)
		goto bail;
	err = fastrpc_set_process_info(fl);
	if (err)
		goto bail;
	if (fl->cid == -1) {