Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp343938pxa; Fri, 21 Aug 2020 08:40:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhgETqsD1t4xYNrc6S6dwwgZv0DWl3DA7PJh3mFDUKPr6nXGwr+Cibb8/eckfLPpOfFYhG X-Received: by 2002:a17:906:f292:: with SMTP id gu18mr3246419ejb.503.1598024441702; Fri, 21 Aug 2020 08:40:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598024441; cv=none; d=google.com; s=arc-20160816; b=GAOSlqeiSicx2slRSXl7B+lyiJ8u+dH7PfRwM5IvN8/PXy783SE+COlijPBZq3m1uX e7Ehb8E2n1tmxuXRZZJ7mSGWfpGtoyug1i/j0uag7bZBRTtq7cgLR00Ef7a0tUI/r5qq 8euR5P3t2r36wTEmmF3jTjGY91t/kL2XCb3R1VF6xbXdP7JA1tWq3/xqZadrFVjvpkm/ iDFnKGt5XEDaoSndoe++rE/cPdFv8ZAy08lEaJFOZGMb4xfLOVH8Ji8P4I065sdRChy+ 1Ofaqipbn9FKE3oxgZ+Ch2AEsGVLTEc8XHtWI+m20AYogNdu6ZnmYga6540BxTTGJ/xP KXWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject:dkim-signature; bh=DG7naCvPgXGiCExgkvnWZgl1bCrL3Q2lEpDgpQnU+oc=; b=vp+0SnDfJs7nAToivHWwdOrJlpMFebc3Evs2cQVZ43EDBSLRHa2/S5YHZLFNaHZ3do 3J5hLfUfDv5Z+ZBgbw22aHNaVhI3okgwMRZeyxfnFORNeL/rYetX+Ue7QgwXtrUvlsuz mn6die0Mc2H5CnYQdzzR5GtNG7MXng+Ssl5aZfxFjbP9PnZ0C2GbVtCaNYkZTVhbZI6s iEFXQ2CxGVK58/9Xb7CpCwyRqP91JGbkafiWN4ywgalDsO0Up/PWZCqoty+EWAPDsNSQ S2vKKhz8qCmiTSlTjwS5UfBMfT9GmHwczHWgfECbvwTHQnqRjaOJDyDEUT2r6pEycCWT WEpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=vfWoBBcA; 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 l9si841126edn.205.2020.08.21.08.40.18; Fri, 21 Aug 2020 08:40:41 -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=vfWoBBcA; 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 S1728017AbgHUPjq (ORCPT + 99 others); Fri, 21 Aug 2020 11:39:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727882AbgHUPjo (ORCPT ); Fri, 21 Aug 2020 11:39:44 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C56FC061573; Fri, 21 Aug 2020 08:39:44 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id b11so1034449pld.7; Fri, 21 Aug 2020 08:39:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=DG7naCvPgXGiCExgkvnWZgl1bCrL3Q2lEpDgpQnU+oc=; b=vfWoBBcABnl1L+FQhlYO0Kcp/ayXOi3lNY5u+Pg9rExEtAo5n5L1bYY1aLa7UaJslG RBwzAE4HCKMefIUI5hsDH7hmPnxTnoiFwe2QqRADiTypj6ghx9jtZjQEcVezj7DrKrTx 97j2rj+ZC6QCCDwUO4H3J8BDOW0BUl27gEFEuOG3bT98SZiArfePGwoRCmlZju/xM/Mm nAvBUipvwscITtXhbLs1tDnhJ37s9t/wUKTy/N/aM9gIWTp1/cfnIp49juLMntrhywPs NrGblDB+HegbgCr3FpYV1KNWPMazGRVfVyI25x44LBKjajQDOKyed3H+13AoRm8qRRxG At6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=DG7naCvPgXGiCExgkvnWZgl1bCrL3Q2lEpDgpQnU+oc=; b=uAjlRFtitgAga322HS3rRQttKBBTCc3zN3i5BxN3i1TzQ+aQZ0nOAuT9VNF41/ESxj 5JMSRfYEhZJGa+qkYWt8gLlhMTw+N7m5zVcc0mTYd+9UWk+sBZP4lit6tnpVo6CxAUpv iZfZ3EmydeWTal359dpjkSLwwgsp7ZqIjvW0eGFBxXUwYhDxBZx/an5Ze0nd/uhTV6tN 05IM2Gs+f/GhQgWU9xrm5gtX67cv62WSqUIDnP4NjKhOqd5mh9M5UP9O3sMMq0q17cQO ltO+0UffMpPnep1HAmsq3jjIiYEgg/wVIeRLJV/SWdx2nteKtsJArfDxuIa+HeaGHo6B yh/A== X-Gm-Message-State: AOAM532QxFP851c/BBFwgGXipC2qT741f6KoySp/RwWtsz893wKzP2KY uVLskWyxWdkIBVjoWJYmeOZErXG0ROc= X-Received: by 2002:a17:90b:11c4:: with SMTP id gv4mr2899721pjb.198.1598024383854; Fri, 21 Aug 2020 08:39:43 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id e125sm2992507pfh.69.2020.08.21.08.39.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 21 Aug 2020 08:39:42 -0700 (PDT) Subject: Re: [PATCH v4 0/7] platform/chrome: cros_ec_proto: Convert EC error codes to Linux error codes To: Enric Balletbo i Serra Cc: Jonathan Cameron , Benson Leung , Dmitry Torokhov , Thierry Reding , =?UTF-8?Q?Uwe_Kleine-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 References: <20200806153308.204605-1-linux@roeck-us.net> <0dfbce79-0413-de27-a2cb-a687ab2fd9d8@collabora.com> From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2+M1dSSEt196rXaC kwu2KgIgmkRBb3cp2vIBBIIowU8W3qC1+w+RdMUrZxKGWJ3juwcgveJlzMpMZNyM1jobSXZ0 VHGMN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4s7k0Zy+6iRQ8G8ng QjsSqYJx8iAR8JRB7Gm2rQOMv8lSRdjva++GT0VLXtHULdlzg8VjDnFZ3lfz5PWEOeIMk7Rj trjv82EZtrhLuLjHRCaG50OOm0hwPSk1J64R8O3HjSLdertmw7eyAYOo4RuWJguYMg5DRnBk WkRwrSuCn7UG+qVWZeKEsFKFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= Message-ID: Date: Fri, 21 Aug 2020 08:39:40 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <0dfbce79-0413-de27-a2cb-a687ab2fd9d8@collabora.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/21/20 1:21 AM, Enric Balletbo i Serra wrote: > Hi Guenter et all, > > On 6/8/20 17:33, 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. >> >> ---------------------------------------------------------------- >> 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 | 52 +++++++++++++++++----- >> drivers/platform/chrome/cros_ec_sysfs.c | 24 ++++------ >> drivers/pwm/pwm-cros-ec.c | 37 +++++++-------- >> 6 files changed, 74 insertions(+), 53 deletions(-) >> > > The patches LGTM, and if the other maintainers are fine, I'd like to queue all > these through the chrome-platform tree. > > I noticed, thought, that KernelCI reported a regression on Kevin that I'll try > to debug at the beginning of next week. > > [ 3.821203] cros-ec-spi spi2.0: Wrong size 1/3: 0 != 4 > [ 3.827320] cros-ec-keyb ff200000.spi:ec@0:keyboard-controller: cannot > register non-matrix inputs: -71 > [ 3.838506] cros-ec-keyb: probe of ff200000.spi:ec@0:keyboard-controller > failed with error -71 > [ 3.853492] cros-ec-spi spi2.0: Chrome EC device registered > Easy to debug. cros_ec_cmd_xfer_status() now returns 0 for success and < 0 for errors. It needs to return the receive length if there is no error. I'll send v5 with a fix, and sorry for the trouble. Thanks, Guenter