Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp498077iof; Mon, 6 Jun 2022 07:26:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz70pzZ1LI8FzYQHQTvKPYCeyfy0SIvrUlUJR3zG7XnWDJjKN6BSyhhQcPrRoTbL6doJCet X-Received: by 2002:a17:90a:a614:b0:1df:8aec:cc71 with SMTP id c20-20020a17090aa61400b001df8aeccc71mr26637817pjq.82.1654525613757; Mon, 06 Jun 2022 07:26:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654525613; cv=none; d=google.com; s=arc-20160816; b=r4ftxiqagTMWAijTO9TeeHl/2z92/VDl51mODNS1u8TIFjJJyHXwIR29JZFm9c5GD2 OS0cfDwhevCzbPrUI7htT0poEhHP1zoiCJEf8k/tA7p60spX6g/0I0fFIICJ6PAIElWM v0armHXzelh33+9/+9ncuoqtm5IA/xBVdmNI+U3qHusNNzc10mQDGt7JBSGDROflXerv 4xgKWHmUGRYMEp6gRGNH10Xd5hRqefh3/3VgrNjAWpOYXZ0fs7s8YyFXklJkHXDMLQSc LW8OK5Z0Md2AXzPVSDfXX0fs8kCRvmGWQjuMp6TXs4PgqCKn82eoLOEv/FUz49VCJhns ZjAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cpXHhf7FyozzlSsGxBKAV+8VcZGtrGIa9/71zZMNST8=; b=qRnIDP+5mw9AEG8RwTKis57x39ju4oRAe1BQaENtUJJGeLqX9JCFCIF/h10Dt3elCF MhxQehL4kjsdLjUv5U4dub+nHP8T3AxHUNjWBwzvIfoFFMsgbOw2loOC9uxdJ9fZgXJK EgkX2zSVvqqnfMd75/uJ3jZOHITTJsn7U43pSX2c+7oeuz3y8MSFiweDLVPKmyJ9zSwP x4IhwS6n8vWbcLRoEUSVS5SvdFVb3n5xPSm+8cJj5vAzkG89OQ6FuO85J0RtOtaRvmml MCV84Y8ysfm8mFyyPcMDyZez8zEesOvlq/Fz/uqLfHCB5/92YUAPfuzxOLVOL+CPRGUS nWJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=F0nLvprP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id nu10-20020a17090b1b0a00b001e3415b6b1dsi25922609pjb.103.2022.06.06.07.26.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 07:26:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=F0nLvprP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E552EB481; Mon, 6 Jun 2022 07:12:35 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239593AbiFFOMP (ORCPT + 99 others); Mon, 6 Jun 2022 10:12:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239610AbiFFOMD (ORCPT ); Mon, 6 Jun 2022 10:12:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 319CC286CA for ; Mon, 6 Jun 2022 07:12:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C1D596137A 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> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org `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 --- 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 -- 2.36.1.255.ge46751e96f-goog