Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp181634lqp; Tue, 11 Jun 2024 00:41:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWGhjwNFDinFLkFuSu0K4wk/6IIEm0bf3pyCaQzfR6nJFUXvINrUSWxbglR/975zSVfnc2C2VhOK9/wZtey7LB+xbXGctkNOJY48iddwQ== X-Google-Smtp-Source: AGHT+IF/gzLCH1v+zRM6yP4aZgulrEWII+2MXl66NU3pqR5kozbStITXmfj/hQlPpmxpse8wtAes X-Received: by 2002:a05:6a00:1146:b0:702:2749:608e with SMTP id d2e1a72fcca58-7040c3ae1f5mr16154293b3a.0.1718091718426; Tue, 11 Jun 2024 00:41:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718091718; cv=pass; d=google.com; s=arc-20160816; b=Jx6vK/clVN0m2lmsnQuiqyRdZd5SjlOq4bYIu5Z7jXWig7XPuVG0dr40cJ/eXDo7p6 g24Vn5/nchUfqS9mxA4SiSilAUO8bFdPm0NV/9f0BXGL7rq/E5Vl2Fx5Nbs6lnIHTq9M ui83mhvfZ39iKaqe5a2R5iqY1MOwd+17l8FxF5NYd9oMZzL+GoMQH6ltDggR5EtD0yXR uEtK8pe1wiVJprgooOOAJZJ3wci2rQuBAfpRkZDunt5WokVSi/5nW70FGsRLWThrRbxc PSE6pQw1FSpZiarZV4aWOINQ6gLY60khNz4dBcaNurvoxh2Vtw4asMA/M4dEo/lYzOOq GkUg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=K8Mu/jbgajYjDTxzWJBFKF7iFe/7h5bInQTB//aXvpg=; fh=DZiDmaaR+XTnXtx+h7VlTgf+iUzxwXuv5LLhc4URNWM=; b=o4FMMNfTYeNjr8MS2Qp6AxtHGXwg6BNCY/NMJK6SiyPYAdBKUMHtB4qr1pWxKDvwJf IH2CzGJht5j4g1zVn7K3RvbKPc5MstD8TnZLrZd6DmpiJxyU7yg/DbJlQ4MXuIZdgXVe ROwC3miueGX50gVdRwxz16RchCpEz5o906Nci385pXXV2oAQoDWOd1FoLuu4bAZNH/i9 RXudPQks+BrIsd0Dy6vEweTm4j3C+XUmpdHRv951sV3uz4lTV4/4f2hddEwRijqMkz0f NSwYZKS18kZFrDIoPINZZwCBjyD2xj//iQd7ftsiPX5YziiUaA5UcEf4a9OKgnNtzmay ozZQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=aL2PHbKn; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net dmarc=pass fromdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-209370-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209370-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=weissschuh.net Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-7059c0bf724si2590565b3a.202.2024.06.11.00.41.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 00:41:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209370-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=aL2PHbKn; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net dmarc=pass fromdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-209370-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209370-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=weissschuh.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7E0B92878E0 for ; Tue, 11 Jun 2024 07:23:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D4D9C172763; Tue, 11 Jun 2024 07:23:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="aL2PHbKn" Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D4DD213D8BA; Tue, 11 Jun 2024 07:23:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718090609; cv=none; b=afglEajJH0dE2dhl3HNHp7D2hzUcP0phqQDpKclXLPFF/N5phZ43uuqNINFDZwqOSdlpGQdd7DaOk+J2j10aM1yGl3IFnDidgm1SNSE1dOxO+c8MuX/Ka4PKewfNsLaHL9d8bAKgxrpn6+noHaK2ZgcSPBICSiWALja4AUBhAgU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718090609; c=relaxed/simple; bh=ntah1B6TNxTJU6A4v28dK0lBP6UT+q22EAg5yS8o46c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VgpqmfOh8nGsC09yFVlmPri0NtArT483I+RCGjAmT9tcA6o7Rb05AH1ThBZs3b+uzgGeCNqlyVF0btkzs72Ajxyf8zohKs88H18J9XFoKvypIlqzVOc01LzjPvAPhc+2ht9q7UrvGptmCYfBm5dTgBMaVCKg3wWbZPf3oMtyGNM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=aL2PHbKn; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1718090604; bh=ntah1B6TNxTJU6A4v28dK0lBP6UT+q22EAg5yS8o46c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aL2PHbKn4z5F9p3lXLb5SBL8jedc9Ya/aH1cJVSlzgPTlOIUecQHo19ILfhiWmYZN QU97PQpJSMhxhqhwersMTprkjtSyxR3wLLToZNBqopZUGdkJAuTarm3hwZOo2u+2gS HAG+ZpbE5NDiJAacQXnEWmQcWagCjuFidmePbXHg= Date: Tue, 11 Jun 2024 09:23:24 +0200 From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Tzung-Bi Shih Cc: Benson Leung , Guenter Roeck , Sebastian Reichel , "Rafael J. Wysocki" , Len Brown , Robert Moore , chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Mario Limonciello , Dustin Howett , Stephen Horvath , Rajas Paranjpe , linux-acpi@vger.kernel.org, acpica-devel@lists.linux.dev, Matt Hartley Subject: Re: [PATCH v3 3/5] platform/chrome: cros_ec_proto: Introduce cros_ec_cmd_versions() Message-ID: References: <20240610-cros_ec-charge-control-v3-0-135e37252094@weissschuh.net> <20240610-cros_ec-charge-control-v3-3-135e37252094@weissschuh.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On 2024-06-11 06:32:38+0000, Tzung-Bi Shih wrote: > On Mon, Jun 10, 2024 at 05:51:08PM +0200, Thomas Weißschuh wrote: > > If the command is not supported at all the EC returns > > -EINVAL/EC_RES_INVALID_PARAMS. > > > > This error is translated into an empty version mask as that is easier to > > handle for callers and they don't need to know about the error details. > > I'm not sure whether the behavior is what we want or not as existing > EC_CMD_GET_CMD_VERSIONS usages don't have it. At least the caller of cros_ec_get_host_command_version_mask() expects it: ret = cros_ec_get_host_command_version_mask(..., &ver_mask); if (ret < 0 || ver_mask == 0) ... ver_mask == 0 will never happen as in that case -EINVAL would have been returned. Others, like cros_ec_cec_get_write_cmd_version(), expect the current semantic of ver_mask != 0 but log spurious errors in case of -EINVAL. cros_pchg_cmd_ver_check(), works with both semantics, but currently also logs a spurious error message. To me the new semantic looks more obvious and much easier to handle. For each command version a bit is set. no command versions -> no bits.