ec/google/chromeec: Simplify get_uptime_info error handling

google_chromeec_get_uptime_info() doesn't need to return an error code
from the lower level calls for the caller to interpret. It is more
appropriate to return a success/failure boolean.

BUG=b:258126464
BRANCH=none
TEST=none

Change-Id: I3e27b8b4eed9d23e6330eda863e43ca78bb174a3
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/69371
Reviewed-by: Boris Mittelberg <bmbm@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
This commit is contained in:
Caveh Jalali
2022-11-02 20:34:43 -07:00
committed by Martin L Roth
parent 60293e9b1f
commit 0bab8ed085

View File

@@ -948,7 +948,7 @@ uint32_t google_chromeec_get_sku_id(void)
return resp.sku_id; return resp.sku_id;
} }
static uint16_t google_chromeec_get_uptime_info( static bool google_chromeec_get_uptime_info(
struct ec_response_uptime_info *resp) struct ec_response_uptime_info *resp)
{ {
struct chromeec_command cmd = { struct chromeec_command cmd = {
@@ -961,8 +961,7 @@ static uint16_t google_chromeec_get_uptime_info(
.cmd_dev_index = 0, .cmd_dev_index = 0,
}; };
google_chromeec_command(&cmd); return google_chromeec_command(&cmd) == 0;
return cmd.cmd_code;
} }
bool google_chromeec_get_ap_watchdog_flag(void) bool google_chromeec_get_ap_watchdog_flag(void)
@@ -970,7 +969,7 @@ bool google_chromeec_get_ap_watchdog_flag(void)
int i; int i;
struct ec_response_uptime_info resp; struct ec_response_uptime_info resp;
if (google_chromeec_get_uptime_info(&resp)) if (!google_chromeec_get_uptime_info(&resp))
return false; return false;
if (resp.ec_reset_flags & EC_RESET_FLAG_AP_WATCHDOG) if (resp.ec_reset_flags & EC_RESET_FLAG_AP_WATCHDOG)
@@ -1297,7 +1296,7 @@ static void google_chromeec_log_uptimeinfo(void)
struct ec_response_uptime_info cmd_resp; struct ec_response_uptime_info cmd_resp;
int i, flag, flag_count; int i, flag, flag_count;
if (google_chromeec_get_uptime_info(&cmd_resp)) { if (!google_chromeec_get_uptime_info(&cmd_resp)) {
/* /*
* Deliberately say nothing for EC's that don't support this * Deliberately say nothing for EC's that don't support this
* command * command