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

Commit 1b8a39d5 authored by Sreelakshmi Gownipalli's avatar Sreelakshmi Gownipalli Committed by Gerrit - the friendly Code Review server
Browse files

diag: Add support to receive dci traffic from multiple devices



Add diag support to receive the dci traffic from multiple
peripherals and devices to one single dci client.

Change-Id: I0d4b5b8c219373a04f901329d748574bde1b4ec0
Signed-off-by: default avatarSreelakshmi Gownipalli <sgownipa@codeaurora.org>
parent 394ec00f
Loading
Loading
Loading
Loading
+18 −8
Original line number Diff line number Diff line
@@ -509,9 +509,11 @@ static int diag_remove_client_entry(struct file *file)
	 * This call will remove any pending registrations of such client
	 */
	mutex_lock(&driver->dci_mutex);
	do {
		dci_entry = dci_lookup_client_entry_pid(current->tgid);
		if (dci_entry)
			diag_dci_deinit_client(dci_entry);
	} while (dci_entry);
	mutex_unlock(&driver->dci_mutex);

	diag_close_logging_process(current->tgid);
@@ -915,6 +917,9 @@ static int diag_copy_dci(char __user *buf, size_t count,
				mutex_unlock(&buf_entry->data_mutex);
				kfree(buf_entry);
				continue;
			} else {
				mutex_unlock(&buf_entry->data_mutex);
				continue;
			}

		}
@@ -923,7 +928,7 @@ static int diag_copy_dci(char __user *buf, size_t count,

	if (total_data_len > 0) {
		/* Copy the total data length */
		COPY_USER_SPACE_OR_ERR(buf+8, total_data_len, 4);
		COPY_USER_SPACE_OR_ERR(buf+(*pret), total_data_len, 4);
		if (ret == -EFAULT)
			goto exit;
		ret -= 4;
@@ -3695,19 +3700,24 @@ static ssize_t diagchar_read(struct file *file, char __user *buf, size_t count,
			ret += sizeof(int);
			copy_dci_data = 1;
			exit_stat = diag_copy_dci(buf, count, entry, &ret);
			if (exit_stat == 1) {
				put_task_struct(task_s);
				put_pid(pid_struct);
				mutex_lock(&driver->diagchar_mutex);
				driver->data_ready[index] ^= DCI_DATA_TYPE;
				atomic_dec(&driver->data_ready_notif[index]);
				mutex_unlock(&driver->diagchar_mutex);
			if (exit_stat == 1) {
				put_task_struct(task_s);
				put_pid(pid_struct);
				mutex_unlock(&driver->dci_mutex);
				goto end;
			}
			put_task_struct(task_s);
			put_pid(pid_struct);
			continue;
		}
		mutex_lock(&driver->diagchar_mutex);
		driver->data_ready[index] ^= DCI_DATA_TYPE;
		atomic_dec(&driver->data_ready_notif[index]);
		mutex_unlock(&driver->diagchar_mutex);
		mutex_unlock(&driver->dci_mutex);
		goto end;
	}