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>
This commit is contained in:
Caveh Jalali 2022-11-02 19:55:39 -07:00 committed by Martin L Roth
parent b456a96361
commit 2320c03087
1 changed files with 4 additions and 4 deletions

View File

@ -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)