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

Commit b6c07b78 authored by Ravi Aravamudhan's avatar Ravi Aravamudhan Committed by Stephen Boyd
Browse files

diag: Fix incorrect handling of diag polling command



During SSR, diag driver clears its command registration table and
rescans the table for polling command. It sets a flag after taking
into consideration the table entries that are zeroed out leading
to an incorrect registration status. This patch ignores the table
entries that are zeroed out and compares against the correct
polling commands to set the flag.

Change-Id: Ida2b2ee4f3ec03ae17c800ef64d19c2bf2732a79
Signed-off-by: default avatarRavi Aravamudhan <aravamud@codeaurora.org>
parent 245f11eb
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -350,19 +350,21 @@ static ssize_t diag_dbgfs_read_table(struct file *file, char __user *ubuf,
		bytes_written = scnprintf(buf+bytes_in_buffer, bytes_remaining,
			"i: %3d, cmd_code: %4x, subsys_id: %4x, "
			"client: %2d, cmd_code_lo: %4x, "
			"cmd_code_hi: %4x, process_id: %5d\n",
			"cmd_code_hi: %4x, process_id: %5d %s\n",
			i,
			driver->table[i].cmd_code,
			driver->table[i].subsys_id,
			driver->table[i].client_id,
			driver->table[i].cmd_code_lo,
			driver->table[i].cmd_code_hi,
			driver->table[i].process_id);
			driver->table[i].process_id,
			(diag_find_polling_reg(i) ? "<- Polling cmd reg" : ""));

		bytes_in_buffer += bytes_written;

		/* Check if there is room to add another table entry */
		bytes_remaining = buf_size - bytes_in_buffer;

		if (bytes_remaining < bytes_written)
			break;
	}
+1 −0
Original line number Diff line number Diff line
@@ -412,5 +412,6 @@ extern int wrap_enabled;
extern uint16_t wrap_count;

void diag_get_timestamp(char *time_str);
int diag_find_polling_reg(int i);

#endif
+13 −10
Original line number Diff line number Diff line
@@ -327,17 +327,19 @@ int diag_find_polling_reg(int i)
	subsys_id = driver->table[i].subsys_id;
	cmd_code_lo = driver->table[i].cmd_code_lo;
	cmd_code_hi = driver->table[i].cmd_code_hi;
	if (driver->table[i].cmd_code == 0x0C)

	if (driver->table[i].cmd_code == 0xFF) {
		if (subsys_id == 0xFF && cmd_code_hi >= 0x0C &&
			 cmd_code_lo <= 0x0C)
			return 1;
	else if (driver->table[i].cmd_code == 0xFF) {
		if (subsys_id == 0x04 && cmd_code_hi == 0x0E &&
			 cmd_code_lo == 0x0E)
		if (subsys_id == 0x04 && cmd_code_hi >= 0x0E &&
			 cmd_code_lo <= 0x0E)
			return 1;
		else if (subsys_id == 0x08 && cmd_code_hi == 0x02 &&
			 cmd_code_lo == 0x02)
		else if (subsys_id == 0x08 && cmd_code_hi >= 0x02 &&
			 cmd_code_lo <= 0x02)
			return 1;
		else if (subsys_id == 0x32 && cmd_code_hi == 0x03  &&
			 cmd_code_lo == 0x03)
		else if (subsys_id == 0x32 && cmd_code_hi >= 0x03  &&
			 cmd_code_lo <= 0x03)
			return 1;
	}
	return 0;
@@ -356,7 +358,8 @@ void diag_clear_reg(int peripheral)
	}
	/* re-scan the registration table */
	for (i = 0; i < diag_max_reg; i++) {
		if (diag_find_polling_reg(i) == 1) {
		if (driver->table[i].process_id != 0 &&
				diag_find_polling_reg(i) == 1) {
			driver->polling_reg_flag = 1;
			break;
		}