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>
This commit is contained in:
Kyösti Mälkki 2019-08-17 05:27:45 +03:00
parent 8d75f6c247
commit 216f717d31
1 changed files with 9 additions and 14 deletions

View File

@ -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;
}
return ec_in_rec_mode;
#endif
}
static const struct cros_gpio cros_gpios[] = {