From patchwork Mon Jul 20 20:22:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 11674539 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1232113B6 for ; Mon, 20 Jul 2020 20:22:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EDC95207DF for ; Mon, 20 Jul 2020 20:22:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ILuskQVn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731188AbgGTUWt (ORCPT ); Mon, 20 Jul 2020 16:22:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729893AbgGTUWt (ORCPT ); Mon, 20 Jul 2020 16:22:49 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31207C061794; Mon, 20 Jul 2020 13:22:49 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id t15so485626pjq.5; Mon, 20 Jul 2020 13:22:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=8bjrXDZyMWjpGVDsBPulb9TLRFHHT3dN0jgYqBommVo=; b=ILuskQVn1e7trX9LpFdOjAGK6bgm6Vm9eNmxtzYcDDG7Ep5djtuBMe25PuV914Kr+x 45pZbuM7RwazbpqpD0xWn7+jyPDkWhV3BAYep/dT/oRk8QqK6notTRXYyycy0EIXyzse LjiAG8gGVEZWCElL9IZPU7FSametRmGsnqmokjNT1Lg+sjz9xWvOI6X3GgZpbat7fOsc 0G/Wh66t6SiZiVV7IE+KOhGxWStr93MdQAXxv1MC6RUQfQ71cqUv9wTb15aK2IWj0Lfv 2SAPmWtRC0zETsQ/J37Hx9QWJx+iinp4STUsAnaPSs9ke6XQDqyCBNYtFXU7O0nBh9RK G3yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=8bjrXDZyMWjpGVDsBPulb9TLRFHHT3dN0jgYqBommVo=; b=t32PbTRPiAK/72pZ4FhbSmtvejmT+R0b5b6bwqWkgAwANIxV+UGftXcuw4FzZLfwvy x6CVmNGY0xm2K2VuUPr31JIaTi24T/qgEMMzexxDZnuQ+LcAlClmEOXUS/ISjN0v2X1k w6PkADOgUELiCU3OfLitL8AqhCBqWrbiGDvLnUzbFgsTix9L2rVMSEfPJfVMU8XBkfJD 44rZ8ZXWrj7OJlt9f6qypUtIf+XDyrdq92UTFNvxeAaNXJd6Kwn4oEnrvQczkpmQxdEP Abrsz1qQvZWvGP6TD5PWN1sfVtRs3c6xpnz1YQumpWNizvPkCjgTN307z48WgBxvtQML s2BA== X-Gm-Message-State: AOAM531em8NH94A96yX6jDC1np16wytcU/waWOTgQOgtj/SHySnSI1QP 2WwllDFqfDVKqY6+ayGhibb3b2UN X-Google-Smtp-Source: ABdhPJyp4TAkT9bdZInushMMYP9C2SJ+kcSbtcSv2kg1Mtp5b/BDzaXllFs1InU9WEoBmZMfEKrPxw== X-Received: by 2002:a17:902:b943:: with SMTP id h3mr19850760pls.38.1595276568625; Mon, 20 Jul 2020 13:22:48 -0700 (PDT) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id 129sm17218136pfv.161.2020.07.20.13.22.47 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Jul 2020 13:22:47 -0700 (PDT) From: Guenter Roeck To: Enric Balletbo i Serra Cc: Benson Leung , Jonathan Cameron , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Yu-Hsuan Hsu , Prashant Malani , Guenter Roeck Subject: [PATCH v2 0/4] platform/chrome: cros_ec_proto: Convert EC error codes to Linux error codes Date: Mon, 20 Jul 2020 13:22:39 -0700 Message-Id: <20200720202243.180230-1-linux@roeck-us.net> X-Mailer: git-send-email 2.17.1 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org 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() ---------------------------------------------------------------- Guenter Roeck (4): 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 platform/chrome: cros_ec_proto: Convert EC error codes to Linux error codes .../iio/common/cros_ec_sensors/cros_ec_sensors.c | 2 +- drivers/platform/chrome/cros_ec_lightbar.c | 10 +++--- drivers/platform/chrome/cros_ec_proto.c | 37 +++++++++++++++++----- drivers/platform/chrome/cros_ec_sysfs.c | 24 ++++++-------- 4 files changed, 43 insertions(+), 30 deletions(-) Reviewed-by: Brian Norris