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

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

Merge "diag: Reset read buffers on interrupts"

parents 3d03ff0f 7b7210a4
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -723,8 +723,10 @@ static int diag_smd_read(void *ctxt, unsigned char *buf, int buf_len)
				       (atomic_read(&smd_info->opened) == 0) ||
				       (smd_cur_packet_size(smd_info->hdl)) ||
				       (!atomic_read(&smd_info->diag_state)));
	if (err)
	if (err) {
		diagfwd_channel_read_done(smd_info->fwd_ctxt, buf, 0);
		return -ERESTARTSYS;
	}

	/*
	 * In this case don't reset the buffers as there is no need to further
@@ -761,7 +763,7 @@ static int diag_smd_read(void *ctxt, unsigned char *buf, int buf_len)
		while (total_recd_partial < pkt_len) {
			read_len = smd_read_avail(smd_info->hdl);
			if (!read_len) {
				wait_event(smd_info->read_wait_q,
				wait_event_interruptible(smd_info->read_wait_q,
					   ((atomic_read(&smd_info->opened)) &&
					    smd_read_avail(smd_info->hdl)));

+3 −1
Original line number Diff line number Diff line
@@ -917,8 +917,10 @@ static int diag_socket_read(void *ctxt, unsigned char *buf, int buf_len)
	err = wait_event_interruptible(info->read_wait_q,
				      (info->data_ready > 0) || (!info->hdl) ||
				      (atomic_read(&info->diag_state) == 0));
	if (err)
	if (err) {
		diagfwd_channel_read_done(info->fwd_ctxt, buf, 0);
		return -ERESTARTSYS;
	}

	/*
	 * There is no need to continue reading over peripheral in this case.