Skip to content

Commit 62c3801

Browse files
Fei Shaodtor
authored andcommitted
Input: cros_ec_keyb - add back missing mask for event_type
In the previous patch we didn't mask out event_type in case statement, so switches are always picked instead of buttons, which results in ChromeOS devices misbehaving when power button is pressed. This patch adds back the missing mask. Fixes: d096aa3 ("Input: cros_ec_keyb: mask out extra flags in event_type") Signed-off-by: Fei Shao <fshao@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 0bec8b7 commit 62c3801

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎drivers/input/keyboard/cros_ec_keyb.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ static int cros_ec_keyb_work(struct notifier_block *nb,
226226
{
227227
struct cros_ec_keyb *ckdev = container_of(nb, struct cros_ec_keyb,
228228
notifier);
229+
uint8_t mkbp_event_type = ckdev->ec->event_data.event_type &
230+
EC_MKBP_EVENT_TYPE_MASK;
229231
u32 val;
230232
unsigned int ev_type;
231233

@@ -237,7 +239,7 @@ static int cros_ec_keyb_work(struct notifier_block *nb,
237239
if (queued_during_suspend && !device_may_wakeup(ckdev->dev))
238240
return NOTIFY_OK;
239241

240-
switch (ckdev->ec->event_data.event_type & EC_MKBP_EVENT_TYPE_MASK) {
242+
switch (mkbp_event_type) {
241243
case EC_MKBP_EVENT_KEY_MATRIX:
242244
pm_wakeup_event(ckdev->dev, 0);
243245

@@ -264,7 +266,7 @@ static int cros_ec_keyb_work(struct notifier_block *nb,
264266
case EC_MKBP_EVENT_SWITCH:
265267
pm_wakeup_event(ckdev->dev, 0);
266268

267-
if (ckdev->ec->event_data.event_type == EC_MKBP_EVENT_BUTTON) {
269+
if (mkbp_event_type == EC_MKBP_EVENT_BUTTON) {
268270
val = get_unaligned_le32(
269271
&ckdev->ec->event_data.data.buttons);
270272
ev_type = EV_KEY;

0 commit comments

Comments
 (0)