summaryrefslogtreecommitdiff
path: root/common/motion_sense.c
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2019-03-11 16:07:55 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-03-26 04:42:56 -0700
commitac77140b7f4f42075d2377fc9d956a636b05aacf (patch)
treec64c6a30916ff741a2ab235141f7bd071cd54483 /common/motion_sense.c
parentbb266fc26fc05d4ab22de6ad7bce5b477c9f9140 (diff)
downloadchrome-ec-ac77140b7f4f42075d2377fc9d956a636b05aacf.tar.gz
common: bit change 1 << constants with BIT(constants)
Mechanical replacement of bit operation where operand is a constant. More bit operation exist, but prone to errors. Reveal a bug in npcx: chip/npcx/system-npcx7.c:114:54: error: conversion from 'long unsigned int' to 'uint8_t' {aka 'volatile unsigned char'} changes value from '16777215' to '255' [-Werror=overflow] BUG=None BRANCH=None TEST=None Change-Id: I006614026143fa180702ac0d1cc2ceb1b3c6eeb0 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1518660 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'common/motion_sense.c')
-rw-r--r--common/motion_sense.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/common/motion_sense.c b/common/motion_sense.c
index e0332ae073..9601970f7b 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -557,7 +557,7 @@ static void motion_sense_shutdown(void)
sensor->drv->list_activities(sensor,
&enabled, &disabled);
/* exclude double tap, it is used internally. */
- enabled &= ~(1 << MOTIONSENSE_ACTIVITY_DOUBLE_TAP);
+ enabled &= ~BIT(MOTIONSENSE_ACTIVITY_DOUBLE_TAP);
while (enabled) {
int activity = get_next_bit(&enabled);
sensor->drv->manage_activity(sensor, activity, 0, NULL);
@@ -927,8 +927,8 @@ void motion_sense_task(void *u)
uint16_t ready_status;
struct motion_sensor_t *sensor;
#ifdef CONFIG_LID_ANGLE
- const uint16_t lid_angle_sensors = ((1 << CONFIG_LID_ANGLE_SENSOR_BASE)|
- (1 << CONFIG_LID_ANGLE_SENSOR_LID));
+ const uint16_t lid_angle_sensors = (BIT(CONFIG_LID_ANGLE_SENSOR_BASE)|
+ BIT(CONFIG_LID_ANGLE_SENSOR_LID));
#endif
#ifdef CONFIG_ACCEL_FIFO
timestamp_t ts_last_int;
@@ -961,7 +961,7 @@ void motion_sense_task(void *u)
&ts_begin_task);
if (ret != EC_SUCCESS)
continue;
- ready_status |= (1 << i);
+ ready_status |= BIT(i);
}
}
#ifdef CONFIG_GESTURE_DETECTION