Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp243573lqp; Tue, 11 Jun 2024 03:15:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWRnO5uStGSkqxD8fKvZVXyu8aFBoamWd7y7WJ9b8aEO1q9WLBOzCG0FD649wRt0AH8Krfw947zdSOmLN2xyIVURqBx5+ww72XOrKpGVA== X-Google-Smtp-Source: AGHT+IHkromwWRo3Rxl1/2FjrZxopAjX3P0arhM8bMKoQM25fuc3dTN9z5ABUrfWRaTumAaQYJGI X-Received: by 2002:a0d:d98b:0:b0:62f:1add:31c8 with SMTP id 00721157ae682-62f1add31fbmr12791367b3.17.1718100922598; Tue, 11 Jun 2024 03:15:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718100922; cv=pass; d=google.com; s=arc-20160816; b=e6KNcEV0XLX9cLyyYZMfWEF26HPM79cDn8AUSfG8BZ9k8Klhf/PYf7AAhC8CS6MxhV 9Uhg57WkZoTtsuYwRtmIP28QDxPAiCffiU+Pt9XkAy+Cb7dINI+/YEUDYGnAsdLQW1eh MMDwPVX0A2eqII++QjO+MEvpeGteVOM0nKb51SI9cdtG9bwpTbIOVLcJX9LRAFlOmjEj D/zoYaOEhqKZR3JXn3C8ElEnJEeHYfcJGpCHvzB3mJyT6+9oNgxzbjBNVGp35L/a8xoH U28TNAq8kNWPbY+qOW99+XocPU3ZcuVLJxZwojidlNo5m00Y+yZ7E8t6K/T6jXMuRao5 YLbA== 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=YeyVtXneig36EtKYzIuMBxFgXB1AnUpICr5s8/PrWRI=; fh=ZQpYTB7oQRllvSDZLwIk4JaJL9AbkcJQtSvGMVRc32M=; b=NJz0/53I4Mr0Jc9kN4MNf4zhm4JBykwJnLMYc+x6+U3/CATg4O/eai3ckipwBTKEzQ aaQ1tkmbdld2qJYXWd53WvDg7ZHcDXd6dnCB/IzII8/ESfPLLauhs4A962Yr7OqAZgs1 pFcyjRvVPZZ1UrZ6Ebk+lgaRYb/Sd58vZXl2HlbtX7emRhMnljQGIjMpC+Q+cwHExVCO JxNGRdHuMrzFnvgeRrmRiIiiTdjmfqwJ9vwQVq/CR8vSi4MXOQAOGNQnGeqb13R4YC4O G1oCEz6OKKUe6xH/rTRQ/MQr6mpzmt5sQAav+DXqoQIk7TtSnjwb7bsmKMYnsmy3FLFt kvgg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gC2oyTXJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-209624-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209624-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6b08e32517dsi8705266d6.121.2024.06.11.03.15.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 03:15:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209624-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gC2oyTXJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-209624-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209624-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 46D701C236E8 for ; Tue, 11 Jun 2024 10:15:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A865417B41F; Tue, 11 Jun 2024 10:14:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gC2oyTXJ" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 AFAD317A92F; Tue, 11 Jun 2024 10:14:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718100886; cv=none; b=nr+jM4/FhmmFO6KSYixKvbany9mz/fb1y/ga26xNX3RSoIpvGI8O9Zba8N1c/wIWqDH3y/JO7pWWf5cUVttCM5yZCgvKlBYucVn7g7hBmZvdgQXvATTdIV7+JuGi1UD6VIZOBC/NwPjzM8zflilbSvRuvh3zwW54eBLJR8zC0G8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718100886; c=relaxed/simple; bh=rFt4XS/CgSsXIcBXqKf+lWLQ7TFyTsJ3RIR+fC805gY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ztr/z7z4+EvKPga3AffgxOtJMnpRbVFL8n1NfWXCLSH/6t61KRYkrYZCnvm8oe45lxVg8Hm/57BUrLsJiZo50DGWtCZi4jdygnEn3pOhPsDB7oJTyY7Sil24xbCYDL438ev5Bu5WSFqYLKr94SrUPpfHTo2a6O4w6EYDkb+Lgag= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gC2oyTXJ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 124C2C32786; Tue, 11 Jun 2024 10:14:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718100885; bh=rFt4XS/CgSsXIcBXqKf+lWLQ7TFyTsJ3RIR+fC805gY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gC2oyTXJJ93PfMa4I6COS1Yg9NWgvNdR2czNkZbCtykuuMziuG35k2lRQXsZ03s08 KfIQQnswFEWvclKyGbEcLrzrEegkQC1BP5X/rsgCfh0aPrky0aCfZAPqBwj/vZBn+u 0sXR4TwnyFy+c7pxsj6q0kaK7bD9Dq2m4f+C1nuBIkQDyDMxbrzwu8PnjYjYerRTMB jKX+myIF1qEgVrm5tO98eN+1f8g71nRoCz6TlDHkD05ySyflbHtT7Hv7HB5vohdD5a rYDqp6qB2JpPzxO4rj3wX1OIJSUa3+1hthCCqNWGiGHzM7mezIewYzWoKSnmBPzC+u EJAhgg5ScR99g== Date: Tue, 11 Jun 2024 10:14:41 +0000 From: Tzung-Bi Shih To: Thomas =?iso-8859-1?Q?Wei=DFschuh?= 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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Tue, Jun 11, 2024 at 09:23:24AM +0200, Thomas Wei?schuh wrote: > 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. Ack.