Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1545415pxa; Thu, 6 Aug 2020 09:57:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzyglvzFzZEkq/59vmc0itArcvg8uAboKYo4GdreTx/HBIyv4TtS6byZ9YBfNXyZPT8CdHv X-Received: by 2002:a17:906:2801:: with SMTP id r1mr5117714ejc.17.1596733056373; Thu, 06 Aug 2020 09:57:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596733056; cv=none; d=google.com; s=arc-20160816; b=Q+9T77OjqiAjS73fiswrNKWraktg0/CdU1HVwpKuHbgRfXZCldhAbhv3lQmfEmecDZ yv2L0g5vau9JIZaUsTlA/brt8Jw8MUZD10OHWvlZmvx2f0QnFWNlslRcGTCuZdq1/GNE HZywX3o4psjVYDC4NTv9XwnzwkD2WkXwr7VbwtGFvUt5Dres6nPpHyi2eXPLZfzB2r+u ak9oY4ZdJXG9kK00xzJWP5POq5yApmWQheQpnykdOypI/aiND4CKgb8w0V5pn2UZ2dK8 VG5NaFWXblmLdqNom3UN9wGBk59uzmkCJPgozQaWiRscvsh+6VKh8tgFVH5y9JX7QtCH 63Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=e2z5ihEKycv93uWBiu5MSP57xzQDMSDWIawsJEucN+M=; b=QfxN46NG3UGJwiRylI7FcJm71jBLOzDMwsa5milnB4MZ9vanNoijMLGiLl8mmNM49M nvEJSsphu+V1RE8Kn4unp8dHEbWjxIU77tAH8NHPNJftPWmypldzaYPrmwlYKVMPqnmK i7eSEctXGW6Fq2XcdbJs+VohwK05Xgp1yHOGPJGWdOtVW1BXT4XSbAV681RCkN354Mil pl1Uh3pRoe5sa6cnBFxC4r6t8ZMCADJ+14jNZfq9p/HlJq+s8VEtSatBDmnugnpod7sr EjO48Ct7FxaBD0WFGnOhku+OyvmkaEH47co89gz+BjeFxymQjdlHcWk1YGz56fCifikz xPhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=E9eLeCdx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d1si3517466edz.288.2020.08.06.09.57.13; Thu, 06 Aug 2020 09:57:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=E9eLeCdx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729819AbgHFQzI (ORCPT + 99 others); Thu, 6 Aug 2020 12:55:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729556AbgHFQuN (ORCPT ); Thu, 6 Aug 2020 12:50:13 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82D9FC0086B1; Thu, 6 Aug 2020 08:33:15 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id g33so9518639pgb.4; Thu, 06 Aug 2020 08:33:15 -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:in-reply-to:references; bh=e2z5ihEKycv93uWBiu5MSP57xzQDMSDWIawsJEucN+M=; b=E9eLeCdxGuq5X89zbRq6hxl0SP+c1Di9JG9QW4eGxsspqaGWWSy1v7UBgnETqNvA/H J55vtc7st60z+Px4TmpjTSb3Xu2+5qsSUpDq6w5NmQ0+9cPTbmXU2STD1mVe5SHc6Aw1 Z5RfLJVavTilBJvxKdxX56opDiw7mR0a9mDLCuFVMjNCQqjy8RigNHj/tnTH5pD+kVSL RtE3eVMGoHd9KwBzJTJFDxeaoyNIZmKUossFb7evT8f7Jzi5cAt6gB7wR3jO/91HKEHP Rtrp1mRB3FmSOC9QZ2QfqYjznOtbLUfjepkOGeyZqODnxGIYZdq5bZijSprym0wrVX7n 9rmQ== 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 :in-reply-to:references; bh=e2z5ihEKycv93uWBiu5MSP57xzQDMSDWIawsJEucN+M=; b=MfWrn5A+/LvEJ26p+CP+HX+yEy/HBPMNUV4e+TBiikwMc/9c8bqR4+NpWCOQuDaaNg ulOsZO/LkGzzE4+ZoDfeG8Eyu/dFX+kTKvi6O6gtxv2dYJKpk07ePmIqA5seUf4gEO90 rRUqzWpS6PLdunowGkpQQDqzMtSY5hD7ZW+wqCh3+VJBdwD8cXQ3GPJRpMLNWIPEX543 zgNG8Ev2JP/jqXeGKuphnLTpDBzdBD4hPHJVKxF1jm+J5TuxdZKHCa4G/zXbKLTCX8SU bRJJW2ZBCJFWVyaBpZzc3jIH/uQ0Ncwkwkge71Dsa7P6mSv3n6KQxWQ1RR5FZ5Tbc6wr 1M4Q== X-Gm-Message-State: AOAM532I+x6h/8+JsfmJJbxHoelawE1DI5+tDLWb2ojqGx8nbgYOrr3g R4cg6x+8RmGpGFkCqPU73Vs= X-Received: by 2002:a62:d149:: with SMTP id t9mr8822019pfl.59.1596727994750; Thu, 06 Aug 2020 08:33:14 -0700 (PDT) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id s185sm8581193pgc.18.2020.08.06.08.33.13 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Aug 2020 08:33:14 -0700 (PDT) From: Guenter Roeck To: Enric Balletbo i Serra Cc: Jonathan Cameron , Benson Leung , Dmitry Torokhov , Thierry Reding , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Lee Jones , Gwendal Grignou , Brian Norris , 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, Guenter Roeck Subject: [PATCH v4 2/7] cros_ec_lightbar: Accept more error codes from cros_ec_cmd_xfer_status Date: Thu, 6 Aug 2020 08:33:03 -0700 Message-Id: <20200806153308.204605-3-linux@roeck-us.net> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200806153308.204605-1-linux@roeck-us.net> References: <20200806153308.204605-1-linux@roeck-us.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since commit c5cd2b47b203 ("platform/chrome: cros_ec_proto: Report command not supported") we can no longer assume that cros_ec_cmd_xfer_status() reports -EPROTO for all errors returned by the EC itself. A follow-up patch will change cros_ec_cmd_xfer_status() to report additional errors reported by the EC as distinguished Linux error codes. Handle this change by no longer assuming that -EPROTO is used to report all errors returned by the EC itself. Since errors reported by the EC are already reported in text form through sysfs attributes, extend this form of error reporting to all errors reported by cros_ec_cmd_xfer_status(). Cc: Gwendal Grignou Cc: Yu-Hsuan Hsu Cc: Prashant Malani Cc: Brian Norris Reviewed-by: Brian Norris Signed-off-by: Guenter Roeck --- v4: No change v3: No change v2: Added patch drivers/platform/chrome/cros_ec_lightbar.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_lightbar.c b/drivers/platform/chrome/cros_ec_lightbar.c index b59180bff5a3..8445cda57927 100644 --- a/drivers/platform/chrome/cros_ec_lightbar.c +++ b/drivers/platform/chrome/cros_ec_lightbar.c @@ -117,7 +117,7 @@ static int get_lightbar_version(struct cros_ec_dev *ec, param = (struct ec_params_lightbar *)msg->data; param->cmd = LIGHTBAR_CMD_VERSION; ret = cros_ec_cmd_xfer_status(ec->ec_dev, msg); - if (ret < 0) { + if (ret < 0 && ret != -EINVAL) { ret = 0; goto exit; } @@ -298,11 +298,9 @@ static ssize_t sequence_show(struct device *dev, goto exit; ret = cros_ec_cmd_xfer_status(ec->ec_dev, msg); - if (ret == -EPROTO) { - ret = scnprintf(buf, PAGE_SIZE, - "ERROR: EC returned %d\n", msg->result); - goto exit; - } else if (ret < 0) { + if (ret < 0) { + ret = scnprintf(buf, PAGE_SIZE, "XFER / EC ERROR %d / %d\n", + ret, msg->result); goto exit; } -- 2.17.1