Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: d096aa3eb604 ("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>

authored by

Fei Shao and committed by
Dmitry Torokhov
62c38016 0bec8b7e

+4 -2
+4 -2
drivers/input/keyboard/cros_ec_keyb.c
··· 226 226 { 227 227 struct cros_ec_keyb *ckdev = container_of(nb, struct cros_ec_keyb, 228 228 notifier); 229 + uint8_t mkbp_event_type = ckdev->ec->event_data.event_type & 230 + EC_MKBP_EVENT_TYPE_MASK; 229 231 u32 val; 230 232 unsigned int ev_type; 231 233 ··· 239 237 if (queued_during_suspend && !device_may_wakeup(ckdev->dev)) 240 238 return NOTIFY_OK; 241 239 242 - switch (ckdev->ec->event_data.event_type & EC_MKBP_EVENT_TYPE_MASK) { 240 + switch (mkbp_event_type) { 243 241 case EC_MKBP_EVENT_KEY_MATRIX: 244 242 pm_wakeup_event(ckdev->dev, 0); 245 243 ··· 266 264 case EC_MKBP_EVENT_SWITCH: 267 265 pm_wakeup_event(ckdev->dev, 0); 268 266 269 - if (ckdev->ec->event_data.event_type == EC_MKBP_EVENT_BUTTON) { 267 + if (mkbp_event_type == EC_MKBP_EVENT_BUTTON) { 270 268 val = get_unaligned_le32( 271 269 &ckdev->ec->event_data.data.buttons); 272 270 ev_type = EV_KEY;