From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.6 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBC60C433E2 for ; Tue, 1 Sep 2020 09:10:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9D21D2083B for ; Tue, 1 Sep 2020 09:10:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726266AbgIAJKM (ORCPT ); Tue, 1 Sep 2020 05:10:12 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:52458 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726064AbgIAJKL (ORCPT ); Tue, 1 Sep 2020 05:10:11 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 50D5F28C318 Subject: Re: [PATCH v5 0/7] platform/chrome: cros_ec_proto: Convert EC error codes to Linux error codes To: Guenter Roeck Cc: Jonathan Cameron , Benson Leung , Dmitry Torokhov , Thierry Reding , =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= , Lee Jones , Gwendal Grignou , Yu-Hsuan Hsu , Prashant Malani , linux-iio@vger.kernel.org, linux-input@vger.kernel.org, linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200822150857.205775-1-linux@roeck-us.net> From: Enric Balletbo i Serra Message-ID: <5fe68c6d-ae3d-e756-ca5d-873f3ca1cc45@collabora.com> Date: Tue, 1 Sep 2020 11:10:06 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20200822150857.205775-1-linux@roeck-us.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dear all, On 22/8/20 17:08, Guenter Roeck wrote: > The EC reports a variety of error codes. Most of those, with the exception > of EC_RES_INVALID_VERSION, are converted to -EPROTO. As result, the actual > error code gets lost. In cros_ec_cmd_xfer_status(), convert all EC errors > to Linux error codes to report a more meaningful error to the caller to aid > debugging. > > To prepare for this change, handle error codes other than -EPROTO for all > callers of cros_ec_cmd_xfer_status(). Specifically, no longer assume that > -EPROTO reflects an error from the EC and all other error codes reflect a > transfer error. > > v2: Add patches 1/4 to 3/4 to handle callers of cros_ec_cmd_xfer_status() > v3: Add patches 4/6 and 5/6 to handle additional callers of > cros_ec_cmd_xfer_status() > Use -ENOPROTOOPT for EC_RES_INVALID_VERSION > Implement function to convert error codes > v4: Add coments describing the functionality of cros_ec_num_pwms(). > Add patch 7/7 to clean up cros_ec_num_pwms() after the new error code > support has been implemented. > Rebased series to v5.8. > v5: If there is no error, cros_ec_cmd_xfer_status() needs to return the > number of received bytes, not 0. While fixing that (in patch 6/7), > rearranged the function to reduce its indentation. > Rebased series to v5.9-rc1 > > ---------------------------------------------------------------- > Guenter Roeck (7): > iio: cros_ec: Accept -EOPNOTSUPP as 'not supported' error code > cros_ec_lightbar: Accept more error codes from cros_ec_cmd_xfer_status > platform/chrome: cros_ec_sysfs: Report range of error codes from EC > pwm: cros-ec: Accept more error codes from cros_ec_cmd_xfer_status > platform/input: cros_ec: Replace -ENOTSUPP with -ENOPROTOOPT > platform/chrome: cros_ec_proto: Convert EC error codes to Linux error codes > pwm: cros-ec: Simplify EC error handling > > .../iio/common/cros_ec_sensors/cros_ec_sensors.c | 2 +- > drivers/input/keyboard/cros_ec_keyb.c | 2 +- > drivers/platform/chrome/cros_ec_lightbar.c | 10 ++-- > drivers/platform/chrome/cros_ec_proto.c | 57 +++++++++++++++++----- > drivers/platform/chrome/cros_ec_sysfs.c | 24 ++++----- > drivers/pwm/pwm-cros-ec.c | 37 +++++++------- > 6 files changed, 78 insertions(+), 54 deletions(-) > I applied all the patches and queued for 5.10 in the chrome-platform tree. If at some point we need to create an immutable branch I can provide it. Thanks, Enric