summaryrefslogtreecommitdiff
path: root/common/keyboard_8042.c
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2019-03-11 15:57:52 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-03-26 04:42:55 -0700
commitbb266fc26fc05d4ab22de6ad7bce5b477c9f9140 (patch)
treef6ada087f62246c3a9547e649ac8846b0ed6d5ab /common/keyboard_8042.c
parent0bfc511527cf2aebfa163c63a1d028419ca0b0c3 (diff)
downloadchrome-ec-bb266fc26fc05d4ab22de6ad7bce5b477c9f9140.tar.gz
common: replace 1 << digits, with BIT(digits)
Requested for linux integration, use BIT instead of 1 << First step replace bit operation with operand containing only digits. Fix an error in motion_lid try to set bit 31 of a signed integer. BUG=None BRANCH=None TEST=compile Change-Id: Ie843611f2f68e241f0f40d4067f7ade726951d29 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1518659 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'common/keyboard_8042.c')
-rw-r--r--common/keyboard_8042.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/common/keyboard_8042.c b/common/keyboard_8042.c
index f45b84d465..660bd3970e 100644
--- a/common/keyboard_8042.c
+++ b/common/keyboard_8042.c
@@ -126,7 +126,7 @@ static enum scancode_set_list scancode_set = SCANCODE_SET_2;
* the inter-char delay = (2 ** B) * (D + 8) / 240 (sec)
* Default: 500ms delay, 10.9 chars/sec.
*/
-#define DEFAULT_TYPEMATIC_VALUE ((1 << 5) | (1 << 3) | (3 << 0))
+#define DEFAULT_TYPEMATIC_VALUE (BIT(5) | BIT(3) | (3 << 0))
static uint8_t typematic_value_from_host;
static int typematic_first_delay;
static int typematic_inter_delay;
@@ -531,7 +531,7 @@ static int handle_keyboard_data(uint8_t data, uint8_t *output)
case STATE_WRITE_OUTPUT_PORT:
CPRINTS5("KB eaten by STATE_WRITE_OUTPUT_PORT: 0x%02x",
data);
- A20_status = (data & (1 << 1)) ? 1 : 0;
+ A20_status = (data & BIT(1)) ? 1 : 0;
data_port_state = STATE_NORMAL;
break;
@@ -696,9 +696,9 @@ static int handle_keyboard_command(uint8_t command, uint8_t *output)
case I8042_READ_OUTPUT_PORT:
output[out_len++] =
- (lpc_keyboard_input_pending() ? (1 << 5) : 0) |
- (lpc_keyboard_has_char() ? (1 << 4) : 0) |
- (A20_status ? (1 << 1) : 0) |
+ (lpc_keyboard_input_pending() ? BIT(5) : 0) |
+ (lpc_keyboard_has_char() ? BIT(4) : 0) |
+ (A20_status ? BIT(1) : 0) |
1; /* Main processor in normal mode */
break;
@@ -756,7 +756,7 @@ static int handle_keyboard_command(uint8_t command, uint8_t *output)
* b0=0 to reset CPU, see I8042_SYSTEM_RESET above
* b1=0 to disable A20 line
*/
- A20_status = command & (1 << 1) ? 1 : 0;
+ A20_status = command & BIT(1) ? 1 : 0;
} else {
CPRINTS("KB unsupported cmd: 0x%02x", command);
reset_rate_and_delay();