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

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

Merge "wcnss: Read multiple SMD Packet from SMD Channel"

parents 977118a5 6e7c0cd6
Loading
Loading
Loading
Loading
+29 −14
Original line number Diff line number Diff line
/* Copyright (c) 2011-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -2144,9 +2144,8 @@ unlock_exit:
	return;
}

static void wcnssctrl_rx_handler(struct work_struct *worker)
static void wcnss_process_smd_msg(int len)
{
	int len = 0;
	int rc = 0;
	unsigned char buf[sizeof(struct wcnss_version)];
	unsigned char build[WCNSS_MAX_BUILD_VER_LEN+1];
@@ -2156,17 +2155,6 @@ static void wcnssctrl_rx_handler(struct work_struct *worker)
	int hw_type;
	unsigned char fw_status = 0;

	len = smd_read_avail(penv->smd_ch);
	if (len > WCNSS_MAX_FRAME_SIZE) {
		pr_err("wcnss: frame larger than the allowed size\n");
		smd_read(penv->smd_ch, NULL, len);
		return;
	}
	if (len < sizeof(struct smd_msg_hdr)) {
		pr_debug("wcnss: incomplete header available len = %d\n", len);
		return;
	}

	rc = smd_read(penv->smd_ch, buf, sizeof(struct smd_msg_hdr));
	if (rc < sizeof(struct smd_msg_hdr)) {
		pr_err("wcnss: incomplete header read from smd\n");
@@ -2276,6 +2264,33 @@ static void wcnssctrl_rx_handler(struct work_struct *worker)
	return;
}

static void wcnssctrl_rx_handler(struct work_struct *worker)
{
	int len;

	while (1) {
		len = smd_read_avail(penv->smd_ch);
		if (len == 0) {
			pr_debug("wcnss: No more data to be read\n");
			return;
		}

		if (len > WCNSS_MAX_FRAME_SIZE) {
			pr_err("wcnss: frame larger than the allowed size\n");
			smd_read(penv->smd_ch, NULL, len);
			return;
		}

		if (len < sizeof(struct smd_msg_hdr)) {
			pr_err("wcnss: incomplete header available len = %d\n",
			       len);
			return;
		}

		wcnss_process_smd_msg(len);
	}
}

static void wcnss_send_version_req(struct work_struct *worker)
{
	struct smd_msg_hdr smd_msg;