Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp297114iob; Wed, 18 May 2022 02:23:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyd0yZDKnLUVLbCYj64xUUBUVwkIZrHon8uMnGx4qEvj26SXmF521dm5ybBIl2BuGKZSZmT X-Received: by 2002:a65:558e:0:b0:3f3:936a:7c1d with SMTP id j14-20020a65558e000000b003f3936a7c1dmr6938462pgs.600.1652865799462; Wed, 18 May 2022 02:23:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652865799; cv=none; d=google.com; s=arc-20160816; b=KCZsRW0MMUULxxBIgYJ1CnTGVIV7W3RAUK0noUMTnTXhQK3AnEu9/E4Y+GdxbV0+dB mNvr9mB+hA3nSeLNiujf6OJmmNaSeapJRPtj9R6vtOjqi+XR8rn2K5mriUx8ZPN18M+8 jwFezm1LByYotvVxhoGs3xrow1Ha+T3tSyj4zSLR/pw0UAMFa6yyCGtnnMJAaj24SPFW gh9PQiT3Uhb7Zch5EaLXEDZaXMAeBT3AGO+NthSGsYSor4abqTquTmc34Opq7LccSBWr 7/cACCbevxZNv4+L/3KxBXyb1hpSjwbVcJBnMDGWEQsP2E+fkIpq8DnhjfOcjAGkqGNr Z4Iw== 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=m4rZha2wqUUEHRY/GD9KGBlOT4rZeuSROaydFxDDQxI=; b=Lszw+wME0Aq8D0lKVSGphYcKsRGph/oq2W2VcsA1xVSPdt0Opy2v57FCcsVfVvx2U3 SGdMk6VjmLus88tpEXugcb07DW4PRKStp+vO4iVQvsVL85/k/7AbbxF1CbTiKL0q0qdy 8t+34W3kA3KFel05gT7Hcx5/7FHhjFWJHO+1IZGeUb9CwdbD+wb9KppNSfkfgAmJz3HS uhH2/GiYAoJJr7GGL7lmxGXneWlnbxvpQPL5BIB0rCmt+KfB+JUbP11Dly8kijAvojIx hVxWYZTXTy3dpijbi+LRBn04BlAoWHLvmdQQTbtyCCVC0uCAXJXGvEsXl0L0DdObNGVn 8h6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hjspsp5e; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id q15-20020a170902dacf00b00158d1f2d451si2681300plx.45.2022.05.18.02.23.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 02:23:19 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hjspsp5e; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 231B426AD1; Wed, 18 May 2022 02:19:04 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234007AbiERJSu (ORCPT + 99 others); Wed, 18 May 2022 05:18:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233975AbiERJSk (ORCPT ); Wed, 18 May 2022 05:18:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACB301EAF2 for ; Wed, 18 May 2022 02:18:38 -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 ams.source.kernel.org (Postfix) with ESMTPS id 66A94B81ED3 for ; Wed, 18 May 2022 09:18:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5FE4C385A5; Wed, 18 May 2022 09:18:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652865516; bh=L6zkHW06fOBMQjiYiu7OCLitsyF4v1uG+91rOEJs/Mg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hjspsp5e6ukLQwNI1J4c/+gb4HkGQ1sD/RAHBBjHXEoyfXy7FTV1EZ0eVplVhzIzX M/HDaPXzxxogF4t3/jLeEcuEzlRXAGgHu4eHLOkLeAAS+lBaKTZfQFGqaXT+u5U1tV GMW4562QDIGPCIqik/v2M9KIaI3fpLr9/yMNLDpQBtcJk5n9uS3fZWgzLnNFjRr0Sk lM+eoLIozVWOi5ju8sLLpLizuevXozsT0CPq65iNh5j2OdzOw15lA4PRh7+obuG1TW f5aMt9aqYHRc/CYyA1sTGwJtfsrsPYhxOa2CovEd7ub+tc6NYwJ9AjrGTmt8e1iHbb D475h8UJgnA1w== From: Tzung-Bi Shih To: bleung@chromium.org, groeck@chromium.org Cc: chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, tzungbi@kernel.org, dianders@chromium.org Subject: [PATCH 3/4] platform/chrome: cros_ec_proto: update cros_ec_check_result() comment Date: Wed, 18 May 2022 17:18:13 +0800 Message-Id: <20220518091814.2028579-4-tzungbi@kernel.org> X-Mailer: git-send-email 2.36.0.550.gb090851708-goog In-Reply-To: <20220518091814.2028579-1-tzungbi@kernel.org> References: <20220518091814.2028579-1-tzungbi@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 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 At first glance, cros_ec_check_result() is quite like cros_ec_map_error(). They check for `ec_msg->result` and return corresponding errors. However, as calling from `pkt_xfer` and `cmd_xfer`, cros_ec_check_result() should not report furthermore errors. -EAGAIN is the only exception. See [1][2][3] for some known userland programs' code. The return code from ioctl only denotes the EC communication status. Userland programs would further analyze the `result` in struct cros_ec_command* for follow-up actions (e.g. [4]). To clarify, update the function comment. [1]: https://crrev.com/54400e93a75ef440a83d6eaac2cec066daf99cf0/util/comm-dev.c#154 [2]: https://crrev.com/fe32670a89bf59e1aff84bba9dd3295657b85e9b/cros_ec_dev.c#296 [3]: https://crrev.com/4e19eb1d89de0422ff1bbd3f7260b131c761098c/drivers/google/cros_ec_dev.c#120 [4]: https://crrev.com/54400e93a75ef440a83d6eaac2cec066daf99cf0/util/comm-dev.c#164 Signed-off-by: Tzung-Bi Shih --- Changes from previous version: (https://patchwork.kernel.org/project/chrome-platform/patch/20220517082817.1591526-1-tzungbi@kernel.org/) - Update the link of [3]. drivers/platform/chrome/cros_ec_proto.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c index 01ab58b3269b..13ced9d2dd71 100644 --- a/drivers/platform/chrome/cros_ec_proto.c +++ b/drivers/platform/chrome/cros_ec_proto.c @@ -204,9 +204,12 @@ EXPORT_SYMBOL(cros_ec_prepare_tx); * @msg: Message to check. * * This is used by ChromeOS EC drivers to check the ec_msg->result for - * errors and to warn about them. + * EC_RES_IN_PROGRESS and to warn about them. * - * Return: 0 on success or negative error code. + * The function should not check for furthermore error codes. Otherwise, + * it would break the ABI. + * + * Return: -EAGAIN if ec_msg->result == EC_RES_IN_PROGRESS. Otherwise, 0. */ int cros_ec_check_result(struct cros_ec_device *ec_dev, struct cros_ec_command *msg) -- 2.36.0.550.gb090851708-goog