Skip to content

platform/chrome: cros_ec_proto: Convert EC error codes to Linux error codes

Guenter Roeck linux-iio linux-input linux-pwm lkml 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest7 patches 1 replyIn review
  2. v4 posting 2/27 patches 5 repliesSuperseded
  3. v4 posting 1/20 of 7 patches 0 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v36 patches9 repliesSuperseded
v24 patches8 repliesSuperseded
v11 patch7 repliesSuperseded

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7iio: cros_ec: Accept -EOPNOTSUPP as 'not supported' error codedrivers/iio/common/cros_ec_sensors/cros_ec_sensors.c+1 -10 replies
2/7cros_ec_lightbar: Accept more error codes from cros_ec_cmd_xfer_statusdrivers/platform/chrome/cros_ec_lightbar.c+4 -60 replies
3/7platform/chrome: cros_ec_sysfs: Report range of error codes from ECdrivers/platform/chrome/cros_ec_sysfs.c+9 -150 replies
4/7pwm: cros-ec: Accept more error codes from cros_ec_cmd_xfer_statusdrivers/pwm/pwm-cros-ec.c+22 -70 replies
5/7platform/input: cros_ec: Replace -ENOTSUPP with -ENOPROTOOPTdrivers/input/keyboard/cros_ec_keyb.c drivers/platform/chrome/cros_ec_proto.c+3 -30 replies
6/7platform/chrome: cros_ec_proto: Convert EC error codes to Linux error codesdrivers/platform/chrome/cros_ec_proto.c+46 -110 replies
7/7pwm: cros-ec: Simplify EC error handlingdrivers/pwm/pwm-cros-ec.c+4 -220 replies

Reviews trailers per patch

6 of 7 patches have a Reviewed-by or Acked-by.

PatchThierry RedingUwe Kleine-KönigBrian NorrisDmitry TorokhovJonathan Cameron
1/7R-b A-b
2/7R-b
3/7R-b
4/7A-b A-b
5/7A-b
6/7
7/7A-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v5 thread

Cover letter [PATCH v5 0/7] platform/chrome: cros_ec_proto: Convert EC error codes to Linux error codes

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 error code gets lost. In cros_ec_cmd_xfer_status(), convert all EC errors to Linux error codes to report a more meaningful error to the caller to aid debugging.

To prepare for this change, handle error codes other than -EPROTO for all callers of cros_ec_cmd_xfer_status(). Specifically, no longer assume that -EPROTO reflects an error from the EC and all other error codes reflect a transfer error.

v2: Add patches 1/4 to 3/4 to handle callers of cros_ec_cmd_xfer_status()
v3: Add patches 4/6 and 5/6 to handle additional callers of
cros_ec_cmd_xfer_status()
Use -ENOPROTOOPT for EC_RES_INVALID_VERSION
Implement function to convert error codes
v4: Add coments describing the functionality of cros_ec_num_pwms().
Add patch 7/7 to clean up cros_ec_num_pwms() after the new error code support has been implemented.
Rebased series to v5.8.
v5: If there is no error, cros_ec_cmd_xfer_status() needs to return the
number of received bytes, not 0. While fixing that (in patch 6/7), rearranged the function to reduce its indentation. Rebased series to v5.9-rc1

----------------------------------------------------------------
Guenter Roeck (7):
iio: cros_ec: Accept -EOPNOTSUPP as 'not supported' error code
cros_ec_lightbar: Accept more error codes from cros_ec_cmd_xfer_status platform/chrome: cros_ec_sysfs: Report range of error codes from EC
pwm: cros-ec: Accept more error codes from cros_ec_cmd_xfer_status platform/input: cros_ec: Replace -ENOTSUPP with -ENOPROTOOPT platform/chrome: cros_ec_proto: Convert EC error codes to Linux error codes
pwm: cros-ec: Simplify EC error handling

 .../iio/common/cros_ec_sensors/cros_ec_sensors.c   |  2 +-
 drivers/input/keyboard/cros_ec_keyb.c              |  2 +-
 drivers/platform/chrome/cros_ec_lightbar.c         | 10 ++--
 drivers/platform/chrome/cros_ec_proto.c            | 57 +++++++++++++++++-----
 drivers/platform/chrome/cros_ec_sysfs.c            | 24 ++++-----
 drivers/pwm/pwm-cros-ec.c                          | 37 +++++++-------
 6 files changed, 78 insertions(+), 54 deletions(-)