summaryrefslogtreecommitdiff
path: root/common/lightbar.c
diff options
context:
space:
mode:
authorJett Rink <jettrink@chromium.org>2019-04-16 13:44:40 -0600
committerchrome-bot <chrome-bot@chromium.org>2019-04-23 02:43:45 -0700
commit4a9757f7ae86eb8ba536b656c09e0ee96c301969 (patch)
treec0348aaf2a5bd6a2b6438df15ede8eef255b1984 /common/lightbar.c
parent673665032d4f7d0809367edf0d8deddbee24b726 (diff)
downloadchrome-ec-4a9757f7ae86eb8ba536b656c09e0ee96c301969.tar.gz
cleanup: update TASK_EVENT_CUSTOM usage
The lightbar.c uses the TASK_EVENT_CUSTOM macro in a non-standard way comparing it to the rest of the code base. Update the style in preparation for changing the TASK_EVENT_CUSTOM macro to be a BUILD_CHECK_INLINE macro. Without this cleanup CL, this code breaks. BRANCH=none BUG=none TEST=builds Change-Id: I4fdbb35a2aeeb1f8718b22c017607aee5fa1730a Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1570606 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'common/lightbar.c')
-rw-r--r--common/lightbar.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/common/lightbar.c b/common/lightbar.c
index c0dd35e56b..11fe41a5aa 100644
--- a/common/lightbar.c
+++ b/common/lightbar.c
@@ -418,15 +418,16 @@ static inline int cycle_010(uint8_t i)
* the latest one. */
static uint32_t pending_msg;
/* And here's the task event that we use to trigger delivery. */
-#define PENDING_MSG 1
+#define PENDING_MSG TASK_EVENT_CUSTOM(BIT(0))
/* Interruptible delay. */
-#define WAIT_OR_RET(A) do { \
- uint32_t msg = task_wait_event(A); \
- uint32_t p_msg = pending_msg; \
- if (TASK_EVENT_CUSTOM(msg) == PENDING_MSG && \
- p_msg != st.cur_seq) \
- return p_msg; } while (0)
+#define WAIT_OR_RET(A) \
+ do { \
+ uint32_t msg = task_wait_event(A); \
+ uint32_t p_msg = pending_msg; \
+ if (msg == PENDING_MSG && p_msg != st.cur_seq) \
+ return p_msg; \
+ } while (0)
/******************************************************************************/
/* Here are the preprogrammed sequences. */
@@ -814,7 +815,7 @@ static uint32_t sequence_STOP(void)
uint32_t msg;
do {
- msg = TASK_EVENT_CUSTOM(task_wait_event(-1));
+ msg = task_wait_event(-1);
CPRINTS("LB %s() got pending_msg %d", __func__, pending_msg);
} while (msg != PENDING_MSG || (
pending_msg != LIGHTBAR_RUN &&
@@ -1657,9 +1658,7 @@ void lightbar_sequence_f(enum lightbar_sequence num, const char *f)
CPRINTS("LB %s() requests %d %s", f, num,
lightbar_cmds[num].string);
pending_msg = num;
- task_set_event(TASK_ID_LIGHTBAR,
- TASK_EVENT_CUSTOM(PENDING_MSG),
- 0);
+ task_set_event(TASK_ID_LIGHTBAR, PENDING_MSG, 0);
} else
CPRINTS("LB %s() requests %d - ignored", f, num);
}