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

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

Merge "diag: dci: Copy the complete response coming from peripheral"

parents 2bc8e507 c7600af4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -865,7 +865,7 @@ void extract_dci_pkt_rsp(unsigned char *buf, int len, int data_source,
	pkt_rsp_header.length = rsp_len + sizeof(int);
	pkt_rsp_header.delete_flag = delete_flag;
	pkt_rsp_header.uid = save_req_uid;
	memcpy(rsp_buf->data, &pkt_rsp_header,
	memcpy(rsp_buf->data + rsp_buf->data_len, &pkt_rsp_header,
		sizeof(struct diag_dci_pkt_rsp_header_t));
	rsp_buf->data_len += sizeof(struct diag_dci_pkt_rsp_header_t);
	memcpy(rsp_buf->data + rsp_buf->data_len, temp, rsp_len);
+14 −11
Original line number Diff line number Diff line
@@ -679,23 +679,15 @@ drop:
		/* Copy the total data length */
		COPY_USER_SPACE_OR_EXIT(buf+8, total_data_len, 4);
		ret -= 4;
		/*
		 * Flush any read that is currently pending on DCI data and
		 * command channnels. This will ensure that the next read is not
		 * missed.
		 */
		flush_workqueue(driver->diag_dci_wq);
		diag_ws_on_copy_complete(DIAG_WS_DCI);
	} else {
		pr_debug("diag: In %s, Trying to copy ZERO bytes, total_data_len: %d\n",
			__func__, total_data_len);
	}

	entry->in_service = 0;
	mutex_unlock(&entry->write_buf_mutex);

	exit_stat = 0;
exit:
	mutex_unlock(&entry->write_buf_mutex);
	*pret = ret;

	return exit_stat;
@@ -1369,6 +1361,7 @@ static ssize_t diagchar_read(struct file *file, char __user *buf, size_t count,
	int index = -1, i = 0, ret = 0;
	int num_data = 0, data_type;
	int remote_token;
	int copy_dci_data = 0;
	int exit_stat;
	int copy_data = 0;
	int write_len = 0;
@@ -1625,7 +1618,6 @@ drop:
	if (driver->data_ready[index] & DCI_DATA_TYPE) {
		/* Copy the type of data being passed */
		data_type = driver->data_ready[index] & DCI_DATA_TYPE;
		driver->data_ready[index] ^= DCI_DATA_TYPE;
		list_for_each_safe(start, temp, &driver->dci_client_list) {
			entry = list_entry(start, struct diag_dci_client_tbl,
									track);
@@ -1637,7 +1629,9 @@ drop:
								sizeof(int));
			COPY_USER_SPACE_OR_EXIT(buf + ret,
					entry->client_info.token, sizeof(int));
			copy_dci_data = 1;
			exit_stat = diag_copy_dci(buf, count, entry, &ret);
			driver->data_ready[index] ^= DCI_DATA_TYPE;
			if (exit_stat == 1)
				goto exit;
		}
@@ -1661,6 +1655,7 @@ drop:
		goto exit;
	}
exit:
	mutex_unlock(&driver->diagchar_mutex);
	if (copy_data) {
		/*
		 * Flush any work that is currently pending on the data
@@ -1671,7 +1666,15 @@ exit:
		wake_up(&driver->smd_wait_q);
		diag_ws_on_copy_complete(DIAG_WS_MD);
	}
	mutex_unlock(&driver->diagchar_mutex);
	/*
	 * Flush any read that is currently pending on DCI data and
	 * command channnels. This will ensure that the next read is not
	 * missed.
	 */
	if (copy_dci_data) {
		diag_ws_on_copy_complete(DIAG_WS_DCI);
		flush_workqueue(driver->diag_dci_wq);
	}
	return ret;
}