Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp964431ybt; Tue, 7 Jul 2020 04:43:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNKO+UZUVF90aAHs2NkiIvOOXBq9w4gdSFcI6ZtRlnVtiB3qIPYBFz/oUNq+bu28JgxIGP X-Received: by 2002:a50:cf09:: with SMTP id c9mr19678222edk.90.1594122239156; Tue, 07 Jul 2020 04:43:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594122239; cv=none; d=google.com; s=arc-20160816; b=RyGU04ef2PN2+3ppral8lSgDQ5nQHEB1bsJRisV88R8SK2tUIVQSuPHAGeqXrHKyZ2 dypRbckmSrP5FUlS4swGzEJGCXUzvToEnVlwtgLsxi2dYutASJx309px5NfX6T5v2Wb7 l7V6udjAhal0aKI1EHIHsPDPFVrgQbRibS8orfZTrXF6+i5gdrGymfl4+f6QPsblbWYZ LWMwEz//ixqKyJKX1vRq7Rr0GFcIVHhCsnFAxeZLYN3WUrWSipperbewe9Wp3/ly2N+y h2dWc5hyn9BYEnkL6WJBB/2bZ5aDJxbLoNVmLYYbwMYIzIx2tuQKeQdHBoOQAXitE3+u t6ug== 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=ohadtc0L1YoGCqvh2RHLLL9N195SXhq2FPyHHtyTf6I=; b=CzEi3JZKmS00uPSyawRU475DNAp3TNfuy9YBHbmNCDZqHjWmTnTmdt0GTEtYzIlO+v xr5+aRI32fjHRA/Bm4+urjZAdoO0U0aom7f3KNRAPZ6ngotHRNEDgB+CKabcVN9LGpHq wr+ovUIMl4/tHuDg0SkF9XmjzfuhXWEW9NTlY+SIyVtPJ2QI0sXG2FdHCnCvu8TNp2K/ HEjMIvK54m+9vdSczHjmN8h4VhJ+Xjv6Jb4FpdLPI27LoHkjnkcdjgx1uYLDTca0xXpp KExEIelfy/wxipOBXDB0sKP5fGz2UCOZMFsgKSWTHpZ84qIkeqH9oluNh8wsgewL4nB+ xEFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=MXAMCwQC; 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 v12si14634037eja.379.2020.07.07.04.43.35; Tue, 07 Jul 2020 04:43:59 -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=MXAMCwQC; 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 S1727107AbgGGLnP (ORCPT + 99 others); Tue, 7 Jul 2020 07:43:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726805AbgGGLnP (ORCPT ); Tue, 7 Jul 2020 07:43:15 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 099F3C061755 for ; Tue, 7 Jul 2020 04:43:15 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id k5so8849043pjg.3 for ; Tue, 07 Jul 2020 04:43:15 -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=ohadtc0L1YoGCqvh2RHLLL9N195SXhq2FPyHHtyTf6I=; b=MXAMCwQC8IL27+0vSF5sDoTYe9kbihNM+TeZqy0WH9RI3hH+SYQ9jVN0g6OCodM1sw 5r20dsooDL0hkjMZe2WtW5bpA4xoShUQPLoTZU+tSHKHwa/1fTkLYm7vWA+lmd7OL+3d oFhJHDS3pUCuV07P3UmfJDcaq6ZZlh2rXJfsF1bFXfH4e1lpGbKFtadcaFa532quvoLj McwFQeBEfJ3Iugph62liszwuWDG9lDg6vIDqn0d035p5EoijBbKHkEeUlBqAe0IIy5HM 2KOR34BeAXfhVOrcydaGIWDMNNu5Rck5SBvqcytLvw70T/Mn2PAVh9o56amAGiX4f5IV gofg== 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=ohadtc0L1YoGCqvh2RHLLL9N195SXhq2FPyHHtyTf6I=; b=hQHZogxYCiGsSDFv+2SuyJ2KDQSvydfHIbKenqkaV9eACDCuifZKhWuMCccvUXxrkG PaAdAcXnekXeRVgPVtTrf0xlTVibjKRqV8eH3LkPa4wlsUC2vhrVf222PBhXsb+sJQ/Z 9qouabU0SzaqRVQl8CpCO+TRnBrb+sVULB9zA4JytQ9NdnbhGXjMc5fMGiY5BUfkYxJO rFlAMbf130fqW1P6ug3t4IVfIVNIMq90rEODTcYyW7khZ3I03KoKRLRUwg3pKeZkzll5 tVtThEEcTU64u3luxNwGPnu36QX/GirpqQBr3UBXUxNnBdUCzzcmfKW8XN8EgAiqEMGd Lrbg== X-Gm-Message-State: AOAM5315MYBzuvFRW0Z3j5m5eamau3pBAjWs4o3QeEU9zSihoPjPPNGa I1YF8OR16JnKGDi+aarrrC4= X-Received: by 2002:a17:902:40a:: with SMTP id 10mr23417001ple.260.1594122194607; Tue, 07 Jul 2020 04:43:14 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id o2sm57891pfh.160.2020.07.07.04.43.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Jul 2020 04:43:13 -0700 (PDT) Subject: Re: [PATCH] platform/chrome: cros_ec_proto: Convert EC error codes to Linux error codes To: Enric Balletbo i Serra Cc: Benson Leung , linux-kernel@vger.kernel.org, Yu-Hsuan Hsu , Prashant Malani References: <20200704142607.171400-1-linux@roeck-us.net> <7fd5528a-017e-d706-8092-8e1d6b187243@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 VHGMNJ3MwXlrEFPXaYJgibcg6brM6wGfX/LBvc/haWw4yO24lT5eitm4UBdIy9pKkKmHHh7s jfZJkB5fWKVdoCv/omy6UyH6ykLOPFugl+hVL2Prf8xrXuZe1CMS7ID9Lc8FaL1ROIN/W8Vk BIsJMaWOhks//7d92Uf3EArDlDShwR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SuCn7UG+qVWZeKEsFKFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= Message-ID: <8f9314a2-bd40-4ce0-ca9d-25722c642107@roeck-us.net> Date: Tue, 7 Jul 2020 04:43:12 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <7fd5528a-017e-d706-8092-8e1d6b187243@collabora.com> 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 On 7/7/20 3:10 AM, Enric Balletbo i Serra wrote: > Hi Prashant and Guenter, > > Thank you to spend your time on look at this. > > On 4/7/20 16:26, 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. Convert all EC errors to Linux error codes to report >> a more meaningful error to the caller to aid debugging. >> >> Cc: Yu-Hsuan Hsu >> Cc: Prashant Malani >> Signed-off-by: Guenter Roeck >> --- > > For me the patch looks good as is. Said that, I'd like to discuss a bit more > (but not too much) about it :-). My "concerns" are: > > - It is not clear to me if some EC errors match directly to a linux kernel error > codes, the importance of them, and which action should be taken in that case or > if just reporting is enough. > > - The EC result can be obtained, either, enabling more debug traces or using the > linux kernel tracing tools. So, IMO mapping _all_ the errors has very little value. > > Right now, the policy I followed is return -EPROTO for all EC errors and > introduce/match a new error when someone (another kernel driver or userspace > needs to know about it, i.e [1], where some EC drivers do different actions if > -ENOTSUPP is returned). We introduced that error because we had a use case for it. > > The future, I'd like to maintain this policy if it makes sense to you. And > introduce a new error when we have a use case for it. I.e if at some point a > kernel driver needs to know when the EC is busy (-EBUSY) because the driver > waits and retries again, I'll be fine to introduce this new error/match code. > Otherwise, I feel that has no really value. > > Said that, if you still feel, that this will help you for debugging purposes, I > am completely fine to pick the patch. > > Thoughts? > Yes, I did feel it was useful, error codes are never perfect, it is rarely possible to enable tracing in situations in which the error that was observed, and I think it would have been and would be useful (having it would have saved hours of analysis and debugging time), but not for the cost of spending hours of argument about it. Please drop. Guenter