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

This commit is contained in:
qctecmdr 2020-04-07 18:49:50 -07:00 • committed by Gerrit - the friendly Code Review server
commit cd94f627a4

View file

@ -4201,11 +4201,8 @@ static inline void fastrpc_register_wakeup_source(struct device *dev,
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
@ -4224,18 +4221,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);
fastrpc_register_wakeup_source(me->non_secure_dev, "adsprpc-non_secure",
&fl->wake_source);
fastrpc_register_wakeup_source(me->secure_dev, "adsprpc-secure",
@ -4250,14 +4235,11 @@ static int fastrpc_device_open(struct inode *inode, struct file *filp)
init_waitqueue_head(&fl->async_wait_queue);
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;
@ -4299,6 +4281,29 @@ bail:
return err;
}
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;
@ -4308,6 +4313,9 @@ static int fastrpc_get_info(struct fastrpc_file *fl, uint32_t *info)
if (err)
goto bail;
fastrpc_get_process_gids(&fl->gidlist);
err = fastrpc_set_process_info(fl);
if (err)
goto bail;
if (fl->cid == -1) {
cid = *info;
VERIFY(err, cid < NUM_CHANNELS);