summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2018-06-20 10:40:26 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-06-28 07:06:46 -0700
commitdcfbe0be69d3445edfd45fb036bfae2581b6fdd5 (patch)
treede448bc3d41945e0bc0cf2f098e10ca14fc49419 /common
parent6f38ed23f3d467937f15cf0474b8f323564bcc0d (diff)
downloadchrome-ec-dcfbe0be69d3445edfd45fb036bfae2581b6fdd5.tar.gz
ec: Make it possible to build tests using clang
We might want to try out address sanitizer/fuzzer on some host tests: make it possible to build host tests using clang. Board builds are broken, and there is no intention to fix them, at least for now. BRANCH=none BUG=chromium:854924 TEST=make buildall -j TEST=make CC=clang runtests -j Change-Id: Id49a1b8537bc403d53437a2245f4fab6ceae89ac Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1107522 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/charge_manager.c2
-rw-r--r--common/lightbar.c23
-rw-r--r--common/mkbp_event.c2
-rw-r--r--common/usb_pd_policy.c4
-rw-r--r--common/usb_pd_protocol.c2
5 files changed, 14 insertions, 19 deletions
diff --git a/common/charge_manager.c b/common/charge_manager.c
index 81382b21da..2abb770667 100644
--- a/common/charge_manager.c
+++ b/common/charge_manager.c
@@ -81,9 +81,11 @@ static int override_port = OVERRIDE_OFF;
static int delayed_override_port = OVERRIDE_OFF;
static timestamp_t delayed_override_deadline;
+#ifdef CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT
/* Bitmap of ports used as power source */
static volatile uint32_t source_port_bitmap;
BUILD_ASSERT(sizeof(source_port_bitmap)*8 >= CONFIG_USB_PD_PORT_COUNT);
+#endif
static uint8_t source_port_last_rp[CONFIG_USB_PD_PORT_COUNT];
/*
diff --git a/common/lightbar.c b/common/lightbar.c
index 9a01e64ccd..c7fed67e7e 100644
--- a/common/lightbar.c
+++ b/common/lightbar.c
@@ -412,21 +412,6 @@ static inline int cycle_010(uint8_t i)
((_ramp_table[bucket + 1] - _ramp_table[bucket]) * index >> 2);
}
-/* This function provides a smooth oscillation between -0.5 and +0.5.
- * Zero starts at 0x00. */
-static inline int cycle_0p0n0(uint8_t i)
-{
- return cycle_010(i + 64) - FP_SCALE / 2;
-}
-
-/* This function provides a pulsing oscillation between -0.5 and +0.5. */
-static inline int cycle_npn(uint16_t i)
-{
- if ((i / 256) % 4)
- return -FP_SCALE / 2;
- return cycle_010(i) - FP_SCALE / 2;
-}
-
/******************************************************************************/
/* Here's where we keep messages waiting to be delivered to the lightbar task.
* If more than one is sent before the task responds, we only want to deliver
@@ -524,6 +509,14 @@ static uint32_t sequence_S3S0(void)
#ifdef BLUE_PULSING
+/* This function provides a pulsing oscillation between -0.5 and +0.5. */
+static inline int cycle_npn(uint16_t i)
+{
+ if ((i / 256) % 4)
+ return -FP_SCALE / 2;
+ return cycle_010(i) - FP_SCALE / 2;
+}
+
/* CPU is fully on */
static uint32_t sequence_S0(void)
{
diff --git a/common/mkbp_event.c b/common/mkbp_event.c
index 160ae250c8..40a6e21066 100644
--- a/common/mkbp_event.c
+++ b/common/mkbp_event.c
@@ -57,6 +57,7 @@ static void set_host_interrupt(int active)
interrupt_enable();
}
+#ifdef CONFIG_MKBP_WAKEUP_MASK
/**
* Check if the host is sleeping. Check our power state in addition to the
* self-reported sleep state of host (CONFIG_POWER_TRACK_HOST_SLEEP_STATE).
@@ -73,6 +74,7 @@ static inline int host_is_sleeping(void)
#endif
return is_sleeping;
}
+#endif /* CONFIG_MKBP_WAKEUP_MASK */
int mkbp_send_event(uint8_t event_type)
{
diff --git a/common/usb_pd_policy.c b/common/usb_pd_policy.c
index 9f4b41b74d..9d2b374259 100644
--- a/common/usb_pd_policy.c
+++ b/common/usb_pd_policy.c
@@ -70,7 +70,7 @@ int pd_check_requested_voltage(uint32_t rdo, const int port)
return EC_SUCCESS;
}
-static int stub_pd_board_check_request(uint32_t rdo, int pdo_cnt)
+__attribute__((weak)) int pd_board_check_request(uint32_t rdo, int pdo_cnt)
{
int idx = RDO_POS(rdo);
@@ -78,8 +78,6 @@ static int stub_pd_board_check_request(uint32_t rdo, int pdo_cnt)
return (!idx || idx > pdo_cnt) ?
EC_ERROR_INVAL : EC_SUCCESS;
}
-int pd_board_check_request(uint32_t, int)
- __attribute__((weak, alias("stub_pd_board_check_request")));
#ifdef CONFIG_USB_PD_DUAL_ROLE
/* Last received source cap */
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index 07268fc310..0cae3bde9e 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -4003,7 +4003,7 @@ static int command_pd(int argc, char **argv)
for (i = 0; i < PD_RW_HASH_SIZE / 4; i++)
ccprintf("%08x ", pd[port].dev_rw_hash[i]);
ccprintf("\nImage %s\n", system_image_copy_t_to_string(
- pd[port].current_image));
+ (enum system_image_copy_t)pd[port].current_image));
} else if (!strncasecmp(argv[2], "soft", 4)) {
set_state(port, PD_STATE_SOFT_RESET);
task_wake(PD_PORT_TO_TASK_ID(port));