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 /driver/ppc/sn5s330.c | |
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 'driver/ppc/sn5s330.c')
-rw-r--r-- | driver/ppc/sn5s330.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/driver/ppc/sn5s330.c b/driver/ppc/sn5s330.c index ef63402b6b..98c2641440 100644 --- a/driver/ppc/sn5s330.c +++ b/driver/ppc/sn5s330.c @@ -707,14 +707,14 @@ static void sn5s330_irq_deferred(void) uint32_t pending = atomic_read_clear(&irq_pending); for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) - if ((1 << i) & pending) + if (BIT(i) & pending) sn5s330_handle_interrupt(i); } DECLARE_DEFERRED(sn5s330_irq_deferred); void sn5s330_interrupt(int port) { - atomic_or(&irq_pending, (1 << port)); + atomic_or(&irq_pending, BIT(port)); hook_call_deferred(&sn5s330_irq_deferred_data, 0); } |