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

Commit e4dda9ff authored by Zaheerulla Meer's avatar Zaheerulla Meer
Browse files

soc: qcom: smd: Revert Idb8ef3b3ad434fdd099271f760988fde4bd0b143



Revert the Change-Id Idb8ef3b3ad434fdd099271f760988fde4bd0b143 as it
was merged even though it had a Code review -1 on it.

Change-Id: I54d5b16bdba38127f612593dcb0ebde09f9d49fe
Signed-off-by: default avatarZaheerulla Meer <zmeer@codeaurora.org>
parent 8591d0f0
Loading
Loading
Loading
Loading
+5 −18
Original line number Diff line number Diff line
@@ -1183,18 +1183,12 @@ static unsigned ch_read_buffer(struct smd_channel *ch, void **ptr)
{
	unsigned head = ch->half_ch->get_head(ch->recv);
	unsigned tail = ch->half_ch->get_tail(ch->recv);
	unsigned fifo_size = ch->fifo_size;

	BUG_ON(fifo_size >= SZ_1M);
	BUG_ON(head >= fifo_size);
	BUG_ON(tail >= fifo_size);
	BUG_ON(OVERFLOW_ADD_UNSIGNED(uintptr_t, (uintptr_t)ch->recv_data,
								tail));
	*ptr = (void *) (ch->recv_data + tail);

	if (tail <= head)
		return head - tail;
	else
		return fifo_size - tail;
		return ch->fifo_size - tail;
}

static int read_intr_blocked(struct smd_channel *ch)
@@ -1294,23 +1288,16 @@ static unsigned ch_write_buffer(struct smd_channel *ch, void **ptr)
{
	unsigned head = ch->half_ch->get_head(ch->send);
	unsigned tail = ch->half_ch->get_tail(ch->send);
	unsigned fifo_size = ch->fifo_size;

	BUG_ON(fifo_size >= SZ_1M);
	BUG_ON(head >= fifo_size);
	BUG_ON(tail >= fifo_size);
	BUG_ON(OVERFLOW_ADD_UNSIGNED(uintptr_t, (uintptr_t)ch->send_data,
								tail));

	*ptr = (void *) (ch->send_data + head);

	if (head < tail) {
		return tail - head - SMD_FIFO_FULL_RESERVE;
	} else {
		if (tail < SMD_FIFO_FULL_RESERVE)
			return fifo_size + tail - head
			return ch->fifo_size + tail - head
					- SMD_FIFO_FULL_RESERVE;
		else
			return fifo_size - head;
			return ch->fifo_size - head;
	}
}

+11 −0
Original line number Diff line number Diff line
@@ -31,6 +31,17 @@

#include "smem_private.h"

/**
 * OVERFLOW_ADD_UNSIGNED() - check for unsigned overflow
 *
 * @type: type to check for overflow
 * @a: left value to use
 * @b: right value to use
 * @returns: true if a + b will result in overflow; false otherwise
 */
#define OVERFLOW_ADD_UNSIGNED(type, a, b) \
	(((type)~0 - (a)) < (b) ? true : false)

#define MODEM_SBL_VERSION_INDEX 7
#define SMEM_VERSION_INFO_SIZE (32 * 4)
#define SMEM_VERSION 0x000B
+0 −11
Original line number Diff line number Diff line
@@ -40,17 +40,6 @@ enum {

#define SMEM_NUM_SMD_STREAM_CHANNELS        64

/**
 * OVERFLOW_ADD_UNSIGNED() - check for unsigned overflow
 *
 * @type: type to check for overflow
 * @a: left value to use
 * @b: right value to use
 * @returns: true if a + b will result in overflow; false otherwise
 */
#define OVERFLOW_ADD_UNSIGNED(type, a, b) \
	(((type)~0 - (a)) < (b) ? true : false)

enum {
	/* fixed items */
	SMEM_PROC_COMM = 0,