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

Commit 43e5660a authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "soc: qcom: Replace SPCOM channel owner pid with tgid"

parents dae63ac6 94c9932e
Loading
Loading
Loading
Loading
+15 −3
Original line number Original line Diff line number Diff line
@@ -129,7 +129,7 @@
#define SPCOM_MAX_READ_SIZE	(PAGE_SIZE)
#define SPCOM_MAX_READ_SIZE	(PAGE_SIZE)


/* Current Process ID */
/* Current Process ID */
#define current_pid() ((u32)(current->pid))
#define current_pid() ((u32)(current->tgid))


/*
/*
 * After both sides get CONNECTED,
 * After both sides get CONNECTED,
@@ -1471,6 +1471,11 @@ static int spcom_device_open(struct inode *inode, struct file *filp)
		return 0;
		return 0;
	}
	}


	if (pid == 0) {
		spcom_pr_err("unknown PID\n");
		return -EINVAL;
	}

	ch = spcom_find_channel_by_name(name);
	ch = spcom_find_channel_by_name(name);
	if (!ch) {
	if (!ch) {
		spcom_pr_err("ch[%s] doesn't exist, load app first\n", name);
		spcom_pr_err("ch[%s] doesn't exist, load app first\n", name);
@@ -1556,6 +1561,7 @@ static int spcom_device_release(struct inode *inode, struct file *filp)
	const char *name = file_to_filename(filp);
	const char *name = file_to_filename(filp);
	int ret = 0;
	int ret = 0;
	int i = 0;
	int i = 0;
	u32 pid = current_pid();


	if (strcmp(name, "unknown") == 0) {
	if (strcmp(name, "unknown") == 0) {
		spcom_pr_err("name is unknown\n");
		spcom_pr_err("name is unknown\n");
@@ -1571,6 +1577,11 @@ static int spcom_device_release(struct inode *inode, struct file *filp)
		return 0;
		return 0;
	}
	}


	if (pid == 0) {
		spcom_pr_err("unknown PID\n");
		return -EINVAL;
	}

	ch = filp->private_data;
	ch = filp->private_data;
	if (!ch) {
	if (!ch) {
		spcom_pr_dbg("ch is NULL, file name %s\n",
		spcom_pr_dbg("ch is NULL, file name %s\n",
@@ -1587,7 +1598,8 @@ static int spcom_device_release(struct inode *inode, struct file *filp)
	}
	}


	for (i = 0; i < SPCOM_MAX_CHANNEL_CLIENTS; i++) {
	for (i = 0; i < SPCOM_MAX_CHANNEL_CLIENTS; i++) {
		if (ch->pid[i] == current_pid()) {
		if (ch->pid[i] == pid) {
			spcom_pr_dbg("PID [%x] is releasing ch [%s]\n", current->tgid, name);
			ch->pid[i] = 0;
			ch->pid[i] = 0;
			break;
			break;
		}
		}
@@ -1598,7 +1610,7 @@ static int spcom_device_release(struct inode *inode, struct file *filp)
		 * Shared client is trying to close channel,
		 * Shared client is trying to close channel,
		 * release the sync_lock if applicable
		 * release the sync_lock if applicable
		 */
		 */
		if (ch->active_pid == current_pid()) {
		if (ch->active_pid == pid) {
			spcom_pr_dbg("active_pid [%x] is releasing ch [%s] sync lock\n",
			spcom_pr_dbg("active_pid [%x] is releasing ch [%s] sync lock\n",
				 ch->active_pid, name);
				 ch->active_pid, name);
			/* No longer the current active user of the channel */
			/* No longer the current active user of the channel */