summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaveh Jalali <caveh@chromium.org>2022-11-02 19:55:39 -0700
committerMartin L Roth <gaumless@gmail.com>2022-11-10 15:09:48 +0000
commit2320c03087bd46f752966793d652ccd9a0870324 (patch)
tree710f660f828d608fac63da28796aa177b1ceb774
parentb456a96361fd8f170b2c6ff17a8ce23c787e0d7c (diff)
ec/google/chromeec: Simplify KEYBOARD_BACKLIGHT error handling
Simplify the implementation of setting the keyboard backlight PWM value. Host command stubs typcially don't need to examine the host command's return value as stored in cmd_code because that level of detail is not very interesting. Higher value error codes are returned in actual result structures. This host command can return EC_RES_ERROR for out of range PWM values which is already a generic error and unlikely to happen since we already limit the range to 0..100 here. Finally, none of the callers in coreboot check the return value. BUG=b:258126464 BRANCH=none TEST=none Change-Id: If17bc4e31baba02ba2f7ae8e7a5cbec7f97688c5 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/69369 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--src/ec/google/chromeec/ec.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c
index b609559f7a..3afe840d53 100644
--- a/src/ec/google/chromeec/ec.c
+++ b/src/ec/google/chromeec/ec.c
@@ -87,10 +87,10 @@ int google_chromeec_kbbacklight(int percent)
.cmd_dev_index = 0,
};
- google_chromeec_command(&cmd);
- printk(BIOS_DEBUG, "Google Chrome set keyboard backlight: status (%x)\n",
- cmd.cmd_code);
- return cmd.cmd_code;
+ if (google_chromeec_command(&cmd) != 0)
+ return -1;
+
+ return 0;
}
void google_chromeec_post(uint8_t postcode)