From f209b18df3b66d78a9838787182d40fc72eee010 Mon Sep 17 00:00:00 2001 From: Eric Lai Date: Tue, 20 Oct 2020 02:44:53 +0800 Subject: mb/google/zork: Update style of check on cbi return values Since google_chromeec_cbi_get_board_version and google_chromeec_cbi_get_fw_config both call cbi_get_unit32 and return 0 as success, non-zero as failure. Let's add more readability for the false condition. BUG=None TEST=check with empty CBI value Signed-off-by: Eric Lai Change-Id: Ia49ac1ee35302f8f6afe8c0eb8e13afdf36c5b2b Reviewed-on: https://review.coreboot.org/c/coreboot/+/46566 Reviewed-by: Martin Roth Reviewed-by: Furquan Shaikh Tested-by: build bot (Jenkins) --- src/mainboard/google/zork/variants/baseboard/helpers.c | 8 ++++---- src/mainboard/google/zork/variants/berknip/gpio.c | 2 +- src/mainboard/google/zork/variants/dalboz/gpio.c | 2 +- src/mainboard/google/zork/variants/dirinboz/gpio.c | 2 +- src/mainboard/google/zork/variants/ezkinil/gpio.c | 2 +- src/mainboard/google/zork/variants/morphius/gpio.c | 2 +- src/mainboard/google/zork/variants/trembyle/gpio.c | 2 +- src/mainboard/google/zork/variants/vilboz/gpio.c | 2 +- src/mainboard/google/zork/variants/woomax/gpio.c | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src/mainboard/google/zork') diff --git a/src/mainboard/google/zork/variants/baseboard/helpers.c b/src/mainboard/google/zork/variants/baseboard/helpers.c index d95ab823f6..cc07fe18d6 100644 --- a/src/mainboard/google/zork/variants/baseboard/helpers.c +++ b/src/mainboard/google/zork/variants/baseboard/helpers.c @@ -57,7 +57,7 @@ static int get_fw_config(uint32_t *val) return 0; } - if (google_chromeec_cbi_get_fw_config(&known_value)) { + if (google_chromeec_cbi_get_fw_config(&known_value) != 0) { printk(BIOS_ERR, "FW_CONFIG not set in CBI\n"); return -1; } @@ -95,7 +95,7 @@ bool variant_uses_v3_schematics(void) if (!CONFIG(VARIANT_SUPPORTS_PRE_V3_SCHEMATICS)) return true; - if (google_chromeec_cbi_get_board_version(&board_version)) + if (google_chromeec_cbi_get_board_version(&board_version) != 0) return false; if ((int)board_version < CONFIG_VARIANT_MIN_BOARD_ID_V3_SCHEMATICS) @@ -111,7 +111,7 @@ bool variant_uses_v3_6_schematics(void) if (!CONFIG(VARIANT_SUPPORTS_PRE_V3_6_SCHEMATICS)) return true; - if (google_chromeec_cbi_get_board_version(&board_version)) + if (google_chromeec_cbi_get_board_version(&board_version) != 0) return false; if ((int)board_version < CONFIG_VARIANT_MIN_BOARD_ID_V3_6_SCHEMATICS) @@ -136,7 +136,7 @@ bool variant_has_active_low_wifi_power(void) if (!CONFIG(VARIANT_SUPPORTS_WIFI_POWER_ACTIVE_HIGH)) return true; - if (google_chromeec_cbi_get_board_version(&board_version)) + if (google_chromeec_cbi_get_board_version(&board_version) != 0) return false; if ((int)board_version < CONFIG_VARIANT_MIN_BOARD_ID_WIFI_POWER_ACTIVE_LOW) diff --git a/src/mainboard/google/zork/variants/berknip/gpio.c b/src/mainboard/google/zork/variants/berknip/gpio.c index c8cb10fa71..ae2d02a48d 100644 --- a/src/mainboard/google/zork/variants/berknip/gpio.c +++ b/src/mainboard/google/zork/variants/berknip/gpio.c @@ -61,7 +61,7 @@ const struct soc_amd_gpio *variant_override_gpio_table(size_t *size) * and so apply overrides. If board version is provided by the EC, then apply overrides * if version < 2. */ - if (google_chromeec_cbi_get_board_version(&board_version)) + if (google_chromeec_cbi_get_board_version(&board_version) != 0) board_version = 1; if (board_version <= 1) { diff --git a/src/mainboard/google/zork/variants/dalboz/gpio.c b/src/mainboard/google/zork/variants/dalboz/gpio.c index 7600d4c8ce..2b46938e9b 100644 --- a/src/mainboard/google/zork/variants/dalboz/gpio.c +++ b/src/mainboard/google/zork/variants/dalboz/gpio.c @@ -47,7 +47,7 @@ const struct soc_amd_gpio *variant_override_gpio_table(size_t *size) * and so apply overrides. If board version is provided by the EC, then apply overrides * if version < 2. */ - if (google_chromeec_cbi_get_board_version(&board_version)) + if (google_chromeec_cbi_get_board_version(&board_version) != 0) board_version = 1; if (board_version < 2) { diff --git a/src/mainboard/google/zork/variants/dirinboz/gpio.c b/src/mainboard/google/zork/variants/dirinboz/gpio.c index 8da85b6720..7f9582c9b6 100644 --- a/src/mainboard/google/zork/variants/dirinboz/gpio.c +++ b/src/mainboard/google/zork/variants/dirinboz/gpio.c @@ -36,7 +36,7 @@ const struct soc_amd_gpio *variant_override_gpio_table(size_t *size) * and so apply overrides. If board version is provided by the EC, then apply overrides * if version < 2. */ - if (google_chromeec_cbi_get_board_version(&board_version)) + if (google_chromeec_cbi_get_board_version(&board_version) != 0) board_version = 1; if (board_version < 2) { diff --git a/src/mainboard/google/zork/variants/ezkinil/gpio.c b/src/mainboard/google/zork/variants/ezkinil/gpio.c index 0ec1ab23da..d2dd104e89 100644 --- a/src/mainboard/google/zork/variants/ezkinil/gpio.c +++ b/src/mainboard/google/zork/variants/ezkinil/gpio.c @@ -81,7 +81,7 @@ const struct soc_amd_gpio *variant_override_gpio_table(size_t *size) * and so apply overrides. If board version is provided by the EC, then apply overrides * if version < 2. */ - if (google_chromeec_cbi_get_board_version(&board_version)) + if (google_chromeec_cbi_get_board_version(&board_version) != 0) board_version = 1; if (board_version <= 1) { diff --git a/src/mainboard/google/zork/variants/morphius/gpio.c b/src/mainboard/google/zork/variants/morphius/gpio.c index 8da0de4f60..9b36e3747e 100644 --- a/src/mainboard/google/zork/variants/morphius/gpio.c +++ b/src/mainboard/google/zork/variants/morphius/gpio.c @@ -69,7 +69,7 @@ const struct soc_amd_gpio *variant_override_gpio_table(size_t *size) * and so apply overrides. If board version is provided by the EC, then apply overrides * if version < 2. */ - if (google_chromeec_cbi_get_board_version(&board_version)) + if (google_chromeec_cbi_get_board_version(&board_version) != 0) board_version = 1; if (board_version <= 1) { diff --git a/src/mainboard/google/zork/variants/trembyle/gpio.c b/src/mainboard/google/zork/variants/trembyle/gpio.c index 9931479cc0..4d73ea0122 100644 --- a/src/mainboard/google/zork/variants/trembyle/gpio.c +++ b/src/mainboard/google/zork/variants/trembyle/gpio.c @@ -60,7 +60,7 @@ const struct soc_amd_gpio *variant_override_gpio_table(size_t *size) * and so apply overrides. If board version is provided by the EC, then apply overrides * if version < 2. */ - if (google_chromeec_cbi_get_board_version(&board_version)) + if (google_chromeec_cbi_get_board_version(&board_version) != 0) board_version = 1; if (board_version <= 2) { diff --git a/src/mainboard/google/zork/variants/vilboz/gpio.c b/src/mainboard/google/zork/variants/vilboz/gpio.c index 12b303a9c5..91ed61a5c2 100644 --- a/src/mainboard/google/zork/variants/vilboz/gpio.c +++ b/src/mainboard/google/zork/variants/vilboz/gpio.c @@ -25,7 +25,7 @@ const struct soc_amd_gpio *variant_override_gpio_table(size_t *size) * and so apply overrides. If board version is provided by the EC, then apply overrides * if version < 2. */ - if (google_chromeec_cbi_get_board_version(&board_version)) + if (google_chromeec_cbi_get_board_version(&board_version) != 0) board_version = 1; if (board_version < 2) { diff --git a/src/mainboard/google/zork/variants/woomax/gpio.c b/src/mainboard/google/zork/variants/woomax/gpio.c index ebbcbea624..cb98df7d41 100644 --- a/src/mainboard/google/zork/variants/woomax/gpio.c +++ b/src/mainboard/google/zork/variants/woomax/gpio.c @@ -60,7 +60,7 @@ const struct soc_amd_gpio *variant_override_gpio_table(size_t *size) uint32_t board_version; /* If board version cannot be read, assume it is board_version 0. */ - if (google_chromeec_cbi_get_board_version(&board_version)) + if (google_chromeec_cbi_get_board_version(&board_version) != 0) board_version = 0; if (board_version == 0) { -- cgit v1.2.3