Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp636867iob; Wed, 18 May 2022 09:34:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwclmDrGeN4eF2Ny8xGKEmw79PnxfV9dvwm9sk1Y1LfxDbrAF2ZKK1ROKsLJ0xUlj8p/8kG X-Received: by 2002:a63:f70d:0:b0:3f6:a9d:281 with SMTP id x13-20020a63f70d000000b003f60a9d0281mr244134pgh.287.1652891685218; Wed, 18 May 2022 09:34:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652891685; cv=none; d=google.com; s=arc-20160816; b=gTtPSOUstSs0lpQw7rqRF9qm0o0Y8BI+ypFxhT5qz6NKwzaXQlWuL+Xy2DPrB+FrUJ EQyeEReECgyQTucH/MtDqipzIxIGu5lyKFmRJMYG7Lhsex4Ab5WQv5N1k7y7YKm4GO89 axFlG2iXDlFTi3lz9nngjW34eT7EowyKMaX1sojCCg/nrQQiG3/KmUIbd019gfCPgIOv gOJj1fcVTHix5/0CnqL5euNjdHhnsfJt/soIyVfi0H2zFx70J1NrpDwwX7qhPbRlR9nk /PHyC1YUjh5MKmN413t1daDIjfXi5LFVjvGXjyDwTUlOewE8B20r8gdHNzS8Orz4eAhw 89Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=2T+/PPPf7+3b/P3u/Ojh1mw+Ir4CRwarSeghbRqZSCk=; b=QQomQd/GLumCZmzEmOJ0TDoAgvgfifx2MtRrfvyRNfY3L6Qaf/UdxO2KqYTD64Ltcn A9ly3xySxu4KfSrgX7eF6wcAkTEcJ6V8j3k5gDa2JqXXAsw4Odx7NASlQkq6u3oHgvva RT/K4UtknzC6dpWuQwHoc2Ft/dOGxNQ/wRWgKtWaXj7JbGGDeb9/+wYM1/ElaOD4e0s+ N3LM6yN7x47USXJTvcc6fUkKQmyPlVoA+l1W+Zw4egsbQG+TOZdqDsyfhdCH8yVfQ0Xy s1Bnn2dED7Sj353S7vyhfycZeyloZ0HMNVhXkV7yYPwpUYftRWNdLV8wsMVR5n9lxbfs 4Axg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=QuThysBN; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id h7-20020a170902f54700b00153b2d16560si3444285plf.360.2022.05.18.09.34.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 09:34:45 -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=@google.com header.s=20210112 header.b=QuThysBN; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 11C729728A; Wed, 18 May 2022 09:30:38 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240208AbiERQ3V (ORCPT + 99 others); Wed, 18 May 2022 12:29:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240242AbiERQ2n (ORCPT ); Wed, 18 May 2022 12:28:43 -0400 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 416021F6392 for ; Wed, 18 May 2022 09:28:38 -0700 (PDT) Received: by mail-ej1-x634.google.com with SMTP id f9so4956424ejc.0 for ; Wed, 18 May 2022 09:28:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2T+/PPPf7+3b/P3u/Ojh1mw+Ir4CRwarSeghbRqZSCk=; b=QuThysBNWbtYdQLwKisRzSxHxXH2bzmhew7tpYNn0YQij0/qm5bugUhw1P0L0CuRQW c5VhBk8AjuJ0fbt2Rb4VLeJiSzpr7dHyYjrGSKUvAmIX8AGcGAmATXyYqmxGKvERkTNp +DgB9wEfUYQWynFiTPs9Bw6eureGsDCgSW+inCCV2CjbhYph0jM645LG3EL6UakYEPu6 i2J9N47cWHmb5rAy8b2URfuXo3EnkMBK/V3N/fMlpLoziPPV6h8MjLfjzRaK4qbbTUeW F3dz/Ys5Fl00cjXwavdGR+nhonhP8upRA85Ze7/GEtSs5iS0O+1a5jF6GeXQKOaRbwUv HQeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2T+/PPPf7+3b/P3u/Ojh1mw+Ir4CRwarSeghbRqZSCk=; b=Zx7ifzygV0ueGKbJY5SdBhJmD5gb/II1qFyu0fq3vaV7NVRPH7GRDNlFUVvcGHCyhc JZaexsE9tOgU/QLRrSu8fw6oeXnumbWb4KU3wrOIaZTL7qjnwqwnPlqW/rXbsUSHafok Njn8J//DrPxiELBiiSMSh/HibwhzkX1lsGsmCn3NiwS8Eb/XuNHznboi6RTOTmEbRGS5 4L+9FM5yOtGopBSzPh22zmJKItFDFgZ7e1JPTf+0aUDNzpUwRPk26g852uzxttBcY7hh BUulN4gK1zGx5ZC39rQ3shBo+pey+Hz3Rs1g4mOcPWMVMprpEh853KhOAsPjFk137Ghs ERtw== X-Gm-Message-State: AOAM530vcizxAcXEvqBP1EJ9V+Nv7K8oDnRw5LF8g1BjOUNbC9ce5vy1 bb/spNiKAqA4qu8Y9+xI6o7Efzczk1+bzGfXg6rePg== X-Received: by 2002:a17:907:9711:b0:6f4:6989:6afb with SMTP id jg17-20020a170907971100b006f469896afbmr397884ejc.618.1652891316548; Wed, 18 May 2022 09:28:36 -0700 (PDT) MIME-Version: 1.0 References: <20220518091814.2028579-1-tzungbi@kernel.org> <20220518091814.2028579-4-tzungbi@kernel.org> In-Reply-To: <20220518091814.2028579-4-tzungbi@kernel.org> From: Guenter Roeck Date: Wed, 18 May 2022 09:28:25 -0700 Message-ID: Subject: Re: [PATCH 3/4] platform/chrome: cros_ec_proto: update cros_ec_check_result() comment To: Tzung-Bi Shih Cc: Benson Leung , Guenter Roeck , chrome-platform@lists.linux.dev, linux-kernel , Doug Anderson Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no 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 On Wed, May 18, 2022 at 2:18 AM Tzung-Bi Shih wrote: > > 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]. The patch should be marked as v2 if there is a previous version. Other than that, Reviewed-by: Guenter Roeck > > 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 >