diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2019-03-11 15:57:52 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-03-26 04:42:55 -0700 |
commit | bb266fc26fc05d4ab22de6ad7bce5b477c9f9140 (patch) | |
tree | f6ada087f62246c3a9547e649ac8846b0ed6d5ab /driver/touchpad_st.c | |
parent | 0bfc511527cf2aebfa163c63a1d028419ca0b0c3 (diff) | |
download | chrome-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 'driver/touchpad_st.c')
-rw-r--r-- | driver/touchpad_st.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/driver/touchpad_st.c b/driver/touchpad_st.c index d4ba6e7d5b..8c4a5cf2dd 100644 --- a/driver/touchpad_st.c +++ b/driver/touchpad_st.c @@ -55,26 +55,26 @@ static void touchpad_power_control(void); */ static int system_state; -#define SYSTEM_STATE_DEBUG_MODE (1 << 0) -#define SYSTEM_STATE_ENABLE_HEAT_MAP (1 << 1) -#define SYSTEM_STATE_ENABLE_DOME_SWITCH (1 << 2) -#define SYSTEM_STATE_ACTIVE_MODE (1 << 3) -#define SYSTEM_STATE_DOME_SWITCH_LEVEL (1 << 4) -#define SYSTEM_STATE_READY (1 << 5) +#define SYSTEM_STATE_DEBUG_MODE BIT(0) +#define SYSTEM_STATE_ENABLE_HEAT_MAP BIT(1) +#define SYSTEM_STATE_ENABLE_DOME_SWITCH BIT(2) +#define SYSTEM_STATE_ACTIVE_MODE BIT(3) +#define SYSTEM_STATE_DOME_SWITCH_LEVEL BIT(4) +#define SYSTEM_STATE_READY BIT(5) /* * Pending action for touchpad. */ static int tp_control; -#define TP_CONTROL_SHALL_HALT (1 << 0) -#define TP_CONTROL_SHALL_RESET (1 << 1) -#define TP_CONTROL_SHALL_INIT (1 << 2) -#define TP_CONTROL_SHALL_INIT_FULL (1 << 3) -#define TP_CONTROL_SHALL_DUMP_ERROR (1 << 4) -#define TP_CONTROL_RESETTING (1 << 5) -#define TP_CONTROL_INIT (1 << 6) -#define TP_CONTROL_INIT_FULL (1 << 7) +#define TP_CONTROL_SHALL_HALT BIT(0) +#define TP_CONTROL_SHALL_RESET BIT(1) +#define TP_CONTROL_SHALL_INIT BIT(2) +#define TP_CONTROL_SHALL_INIT_FULL BIT(3) +#define TP_CONTROL_SHALL_DUMP_ERROR BIT(4) +#define TP_CONTROL_RESETTING BIT(5) +#define TP_CONTROL_INIT BIT(6) +#define TP_CONTROL_INIT_FULL BIT(7) /* * Number of times we have reset the touchpad because of errors. @@ -124,7 +124,7 @@ static struct { struct packet_header_t { uint8_t index; -#define HEADER_FLAGS_NEW_FRAME (1 << 0) +#define HEADER_FLAGS_NEW_FRAME BIT(0) uint8_t flags; } __packed; BUILD_ASSERT(sizeof(struct packet_header_t) < USB_ISO_PACKET_SIZE); @@ -133,7 +133,7 @@ static struct packet_header_t packet_header; /* What will be sent to USB interface. */ struct st_tp_usb_packet_t { -#define USB_FRAME_FLAGS_BUTTON (1 << 0) +#define USB_FRAME_FLAGS_BUTTON BIT(0) /* * This will be true if user clicked on touchpad. * TODO(b/70482333): add corresponding code for button signal. @@ -375,14 +375,14 @@ static int st_tp_update_system_state(int new_state, int mask) }; if (new_state & SYSTEM_STATE_ENABLE_HEAT_MAP) { CPRINTS("Heatmap enabled"); - tx_buf[2] |= 1 << 0; + tx_buf[2] |= BIT(0); need_locked_scan_mode = 1; } else { CPRINTS("Heatmap disabled"); } if (new_state & SYSTEM_STATE_ENABLE_DOME_SWITCH) - tx_buf[2] |= 1 << 1; + tx_buf[2] |= BIT(1); ret = spi_transaction(SPI, tx_buf, sizeof(tx_buf), NULL, 0); if (ret) return ret; @@ -1782,7 +1782,7 @@ static int get_heat_map_addr(void) } struct st_tp_interrupt_t { -#define ST_TP_INT_FRAME_AVAILABLE (1 << 0) +#define ST_TP_INT_FRAME_AVAILABLE BIT(0) uint8_t flags; } __packed; |