• Guenter Roeck's avatar
    platform/chrome: cros_ec_proto: Convert EC error codes to Linux error codes · 0d080459
    Guenter Roeck authored
    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
    EC error code gets lost. Introduce cros_ec_map_error() to map EC error
    codes to Linux error codes, and use it in cros_ec_cmd_xfer_status() to
    report more meaningful errors to the caller. With this change, callers of
    cros_ec_cmd_xfer_status() can implement a more distinguished action without
    having to rely on the EC error code. At the same time, debugging is improved
    in situations where the Linux error code is reported to userspace and/or in
    the kernel log.
    
    Cc: Gwendal Grignou <gwendal@chromium.org>
    Cc: Yu-Hsuan Hsu <yuhsuan@chromium.org>
    Cc: Prashant Malani <pmalani@chromium.org>
    Cc: Brian Norris <briannorris@chromium.org>
    Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
    Signed-off-by: default avatarEnric Balletbo i Serra <enric.balletbo@collabora.com>
    0d080459
cros_ec_proto.c 24.2 KB