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.