From patchwork Mon Jun 6 14:10:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 12870401 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 712E77E for ; Mon, 6 Jun 2022 14:12:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F333C3411D; Mon, 6 Jun 2022 14:12:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654524721; bh=iV6GhG3HSROh+z7BH4me2g0TrNYK+Ev992HDhTgueqg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F0nLvprPnjL77YA9W3XsD9rCVdvb8LIvFipi7fUlGmpCXAX41zTqibfaRoSae1YVf 2lAsTr47A/9jxVN05Oy2QwgIJS8BHhj49J/lROuHYqSJi2N+uYsYkEIxm01eHyCK6K nvKXNYt88MYaCOhOEdn3umif85kOUIfadHe3s7C8zDI5hTbt26u38/oN/NKGSC3XE2 lTyMa17Ytyl4HE5D+WkE32Gm1VIdbmehIESltMZPg5qUflpnhC5NSiWXMtqCwtX0Z6 yBCjba+31BQ1/NnU6PQSmi1et2d5S+QpG2HSfQ0/tswC+2GCzJbvswEDqpSHv4iZi7 WMVmE7Jocty4w== From: Tzung-Bi Shih To: bleung@chromium.org, groeck@chromium.org Cc: chrome-platform@lists.linux.dev, tzungbi@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 04/13] platform/chrome: cros_ec_proto: assign buffer size from protocol info Date: Mon, 6 Jun 2022 14:10:42 +0000 Message-Id: <20220606141051.285823-5-tzungbi@kernel.org> X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog In-Reply-To: <20220606141051.285823-1-tzungbi@kernel.org> References: <20220606141051.285823-1-tzungbi@kernel.org> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 `din_size` is calculated from `ec_dev->max_response`. `ec_dev->max_response` is further calculated from the protocol info. To make it clear, assign `din_size` and `dout_size` from protocol info directly. Signed-off-by: Tzung-Bi Shih Reviewed-by: Guenter Roeck --- drivers/platform/chrome/cros_ec_proto.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c index 65191af5139c..629dce3e6ab3 100644 --- a/drivers/platform/chrome/cros_ec_proto.c +++ b/drivers/platform/chrome/cros_ec_proto.c @@ -449,12 +449,8 @@ int cros_ec_query_all(struct cros_ec_device *ec_dev) "using proto v%u\n", ec_dev->proto_version); - ec_dev->din_size = ec_dev->max_response + - sizeof(struct ec_host_response) + - EC_MAX_RESPONSE_OVERHEAD; - ec_dev->dout_size = ec_dev->max_request + - sizeof(struct ec_host_request) + - EC_MAX_REQUEST_OVERHEAD; + ec_dev->din_size = proto_info->max_response_packet_size + EC_MAX_RESPONSE_OVERHEAD; + ec_dev->dout_size = proto_info->max_request_packet_size + EC_MAX_REQUEST_OVERHEAD; /* * Check for PD