summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2019-08-17 05:27:45 +0300
committerKyösti Mälkki <kyosti.malkki@gmail.com>2019-08-20 01:30:53 +0000
commit216f717d315eccc5b33827627b784c06ca8248e8 (patch)
tree317b610ec235a8ebafd0ccb8eb21416f70280fae /src
parent8d75f6c24730f6e91fe0df02c3b2641216f9358c (diff)
google/stout: Use MAYBE_STATIC
Change-Id: I11027acb11a4656536384134d0caebd14b63770c Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/34924 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/mainboard/google/stout/chromeos.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/mainboard/google/stout/chromeos.c b/src/mainboard/google/stout/chromeos.c
index ff247da471..44784b4fe9 100644
--- a/src/mainboard/google/stout/chromeos.c
+++ b/src/mainboard/google/stout/chromeos.c
@@ -71,10 +71,12 @@ int get_lid_switch(void)
*/
int get_recovery_mode_switch(void)
{
-#ifndef __PRE_RAM__
- static int ec_in_rec_mode = 0;
- static int ec_rec_flag_good = 0;
-#endif
+ MAYBE_STATIC int ec_in_rec_mode = 0;
+ MAYBE_STATIC int ec_rec_flag_good = 0;
+
+ if (ec_rec_flag_good)
+ return ec_in_rec_mode;
+
pci_devfn_t dev = PCI_DEV(0, 0x1f, 0);
u8 reg8 = pci_s_read_config8(dev, GEN_PMCON_3);
@@ -83,17 +85,10 @@ int get_recovery_mode_switch(void)
printk(BIOS_SPEW,"%s: EC status:%#x RTC_BAT: %x\n",
__func__, ec_status, reg8 & RTC_BATTERY_DEAD);
-#ifdef __PRE_RAM__
- return (((reg8 & RTC_BATTERY_DEAD) != 0) &&
- ((ec_status & 0x3) == EC_IN_RECOVERY_MODE));
-#else
- if (!ec_rec_flag_good) {
- ec_in_rec_mode = (((reg8 & RTC_BATTERY_DEAD) != 0) &&
- ((ec_status & 0x3) == EC_IN_RECOVERY_MODE));
- ec_rec_flag_good = 1;
- }
+ ec_in_rec_mode = (((reg8 & RTC_BATTERY_DEAD) != 0) &&
+ ((ec_status & 0x3) == EC_IN_RECOVERY_MODE));
+ ec_rec_flag_good = 1;
return ec_in_rec_mode;
-#endif
}
static const struct cros_gpio cros_gpios[] = {