charger: Drop the THROTTLE_AP #ifdefs

Use IS_ENABLED() for these. This involves adding uvp_throttle_start_time
as a local variable for all boards. The compiler should optimise this
away.

BUG=b:218332694
TEST=make buildall
Check that size does not change on lux:
 make BOARD=lux -j50  |grep "lux " |sed 's/still.*on //'
  *** 69416 bytes in flash and 1152 bytes in RAM lux RO ****
  *** 69364 bytes in flash and 1120 bytes in RAM lux RW ****

Change-Id: Id61d8a5cb9ee47de4be48fc8efa53d5f82ddd664
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4577901
Reviewed-by: Tristan Honscheid <honscheid@google.com>
Commit-Queue: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
diff --git a/common/charge_state.c b/common/charge_state.c
index 3a2cbc4..e628ebc 100644
--- a/common/charge_state.c
+++ b/common/charge_state.c
@@ -65,9 +65,7 @@
 #define BAT_UVP_HYSTERESIS \
 	(BAT_LOW_VOLTAGE_THRESH * BAT_UVP_HYSTERESIS_PCT / 100) /* mV */
 
-#ifdef CONFIG_THROTTLE_AP_ON_BAT_VOLTAGE
 static timestamp_t uvp_throttle_start_time;
-#endif /* CONFIG_THROTTLE_AP_ON_BAT_OLTAGE */
 
 static uint8_t battery_level_shutdown;
 
@@ -781,7 +779,9 @@
 
 static void notify_host_of_low_battery_voltage(void)
 {
-#ifdef CONFIG_THROTTLE_AP_ON_BAT_VOLTAGE
+	if (!IS_ENABLED(CONFIG_THROTTLE_AP_ON_BAT_VOLTAGE))
+		return;
+
 	if ((curr.batt.flags & BATT_FLAG_BAD_VOLTAGE) ||
 	    chipset_in_state(CHIPSET_STATE_ANY_OFF))
 		return;
@@ -806,15 +806,14 @@
 			    THROTTLE_SRC_BAT_VOLTAGE);
 		uvp_throttle_start_time.val = 0;
 	}
-#endif
 }
 
 static void notify_host_of_over_current(struct batt_params *batt)
 {
-#ifdef CONFIG_THROTTLE_AP_ON_BAT_DISCHG_CURRENT
 	static timestamp_t ocp_throttle_start_time;
 
-	if (batt->flags & BATT_FLAG_BAD_CURRENT)
+	if (!IS_ENABLED(CONFIG_THROTTLE_AP_ON_BAT_DISCHG_CURRENT) ||
+	    (batt->flags & BATT_FLAG_BAD_CURRENT))
 		return;
 
 	if ((!ocp_throttle_start_time.val &&
@@ -835,7 +834,6 @@
 		throttle_ap(THROTTLE_OFF, THROTTLE_SOFT,
 			    THROTTLE_SRC_BAT_DISCHG_CURRENT);
 	}
-#endif
 }
 
 const struct batt_params *charger_current_battery_params(void)