platform/chrome: Re-introduce cros_ec_cmd_xfer and use it for ioctls
authorGuenter Roeck <linux@roeck-us.net>
Fri, 18 Mar 2022 16:54:22 +0000 (09:54 -0700)
committerTzung-Bi Shih <tzungbi@kernel.org>
Tue, 19 Apr 2022 03:27:20 +0000 (11:27 +0800)
commit57b888ca2541785de2fcb90575b378921919b6c0
tree62f89684a583d15507faef4ef5e6e17666ecbd3d
parent8d4668064cce8f8d52d4bd2b3b864feed33b1258
platform/chrome: Re-introduce cros_ec_cmd_xfer and use it for ioctls

Commit 413dda8f2c6f ("platform/chrome: cros_ec_chardev: Use
cros_ec_cmd_xfer_status helper") inadvertendly changed the userspace ABI.
Previously, cros_ec ioctls would only report errors if the EC communication
failed, and otherwise return success and the result of the EC
communication. An EC command execution failure was reported in the EC
response field. The above mentioned commit changed this behavior, and the
ioctl itself would fail. This breaks userspace commands trying to analyze
the EC command execution error since the actual EC command response is no
longer reported to userspace.

Fix the problem by re-introducing the cros_ec_cmd_xfer() helper, and use it
to handle ioctl messages.

Fixes: 413dda8f2c6f ("platform/chrome: cros_ec_chardev: Use cros_ec_cmd_xfer_status helper")
Cc: Daisuke Nojiri <dnojiri@chromium.org>
Cc: Rob Barnes <robbarnes@google.com>
Cc: Rajat Jain <rajatja@google.com>
Cc: Brian Norris <briannorris@chromium.org>
Cc: Parth Malkan <parthmalkan@google.com>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
drivers/platform/chrome/cros_ec_chardev.c
drivers/platform/chrome/cros_ec_proto.c
include/linux/platform_data/cros_ec_proto.h