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

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

Merge "diag: Set in_busy only after initialization of read buffers" into msm-4.9

parents 13ce0881 77f227d5
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -983,8 +983,6 @@ void diagfwd_channel_read(struct diagfwd_info *fwd_info)
	}

	if (fwd_info->buf_1 && !atomic_read(&fwd_info->buf_1->in_busy)) {
		temp_buf = fwd_info->buf_1;
		atomic_set(&temp_buf->in_busy, 1);
		if (driver->feature[fwd_info->peripheral].encode_hdlc &&
		    (fwd_info->type == TYPE_DATA ||
		     fwd_info->type == TYPE_CMD)) {
@@ -994,9 +992,11 @@ void diagfwd_channel_read(struct diagfwd_info *fwd_info)
			read_buf = fwd_info->buf_1->data;
			read_len = fwd_info->buf_1->len;
		}
	} else if (fwd_info->buf_2 && !atomic_read(&fwd_info->buf_2->in_busy)) {
		temp_buf = fwd_info->buf_2;
		if (read_buf) {
			temp_buf = fwd_info->buf_1;
			atomic_set(&temp_buf->in_busy, 1);
		}
	} else if (fwd_info->buf_2 && !atomic_read(&fwd_info->buf_2->in_busy)) {
		if (driver->feature[fwd_info->peripheral].encode_hdlc &&
		    (fwd_info->type == TYPE_DATA ||
		     fwd_info->type == TYPE_CMD)) {
@@ -1006,6 +1006,10 @@ void diagfwd_channel_read(struct diagfwd_info *fwd_info)
			read_buf = fwd_info->buf_2->data;
			read_len = fwd_info->buf_2->len;
		}
		if (read_buf) {
			temp_buf = fwd_info->buf_2;
			atomic_set(&temp_buf->in_busy, 1);
		}
	} else {
		pr_debug("diag: In %s, both buffers are empty for p: %d, t: %d\n",
			 __func__, fwd_info->peripheral, fwd_info->type);