diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2019-03-11 16:07:55 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-03-26 04:42:56 -0700 |
commit | ac77140b7f4f42075d2377fc9d956a636b05aacf (patch) | |
tree | c64c6a30916ff741a2ab235141f7bd071cd54483 /chip/host | |
parent | bb266fc26fc05d4ab22de6ad7bce5b477c9f9140 (diff) | |
download | chrome-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 'chip/host')
-rw-r--r-- | chip/host/config_chip.h | 2 | ||||
-rw-r--r-- | chip/host/usb_pd_phy.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/chip/host/config_chip.h b/chip/host/config_chip.h index 8cb8bba79c..8714b57891 100644 --- a/chip/host/config_chip.h +++ b/chip/host/config_chip.h @@ -44,7 +44,7 @@ extern char __host_flash[CONFIG_FLASH_SIZE]; /* Do NOT use common timer code which is designed for hardware counters. */ #undef CONFIG_COMMON_TIMER -#define GPIO_PIN(port, index) GPIO_##port, (1 << index) +#define GPIO_PIN(port, index) GPIO_##port, BIT(index) #define GPIO_PIN_MASK(p, m) .port = GPIO_##p, .mask = (m) #define I2C_PORT_COUNT 1 diff --git a/chip/host/usb_pd_phy.c b/chip/host/usb_pd_phy.c index dd16890e6b..c44b8eea02 100644 --- a/chip/host/usb_pd_phy.c +++ b/chip/host/usb_pd_phy.c @@ -259,7 +259,7 @@ static uint8_t decode_bmc(uint32_t val10) for (i = 0; i < 5; ++i) if (!!(val10 & (1 << (2 * i))) != !!(val10 & (1 << (2 * i + 1)))) - ret |= (1 << i); + ret |= BIT(i); return ret; } |