Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp791230ybl; Tue, 13 Aug 2019 02:39:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMWRcjVWi+vGuo5CllKkPr9RQeisPuTufWIQwG/MzaHox1/ATxdnag8W4mgzGe9SnAJm6w X-Received: by 2002:a63:1455:: with SMTP id 21mr33554100pgu.116.1565689184114; Tue, 13 Aug 2019 02:39:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565689184; cv=none; d=google.com; s=arc-20160816; b=g2jUaT/LxI6EgD6VrxE5Z80EMf/BcRbo8+wSDbxBN1VmiZiqDPWbhXprt2+fgLk4MV kN/5QarrOcXkzdzb7Qa4nVzuEi64HGK25WKtdxCFBbhWjbAhXRsoWyz4Q08Kt2z89VdJ WYLoEHFdJmtVAnkDK6ft3Np7ecregkxdTiU7fO/YnOnVo/V5c8sE06LW/2YyRcZ8kUY4 OhKpmiec1pI/Lw7wAugc3N8vltvCaI/EXHv1HfGT04tg4HkdALsn1rPih+PgNuvVHJpp 1Z4aA4eouPa4M2xL+H2rnUilk4+PKyihU9eQrfXgXs7rnYwe+Uv8tuxiLx8Bdn19Gem4 devg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=RaD6A+K4/8jdvOIsXluiNkAgL7M1+kFjGExIzAUXUW8=; b=ZoIZCAQI2JdGE8Gtt2BK+6wcGJcaRfp/yx0La45kudnjSq94AAc5GskX1UkKFLSTlA mfMZUq/fds7eXpzDPyuta1fLzHCfsF8IPPcFUltGtkyH9Wc5RdL4oIbgUBOKNQhjUtVJ vG4f4VCsq9z0jaT5LZv1IWi/oFwYv8zmcT25WGiV6dNTxC+iEF3qQp9oqZYO9Jlrd3U4 CU0cV0F8eANU/ek9QGPOtpID9M9pCAXgH6davOK72fk0Ln2gC52VcgZtoUYw90RLyYFt qDpE+Bz1MRD0rj0oKJAAO+hO923YbXDJHJKGGKr/EL6wJJyE1zXCLCZlTpeKTdcTJorS +UUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=P9qJfWwQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f19si41565pgf.179.2019.08.13.02.39.27; Tue, 13 Aug 2019 02:39:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=P9qJfWwQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728007AbfHMJi3 (ORCPT + 99 others); Tue, 13 Aug 2019 05:38:29 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:41148 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727869AbfHMJi3 (ORCPT ); Tue, 13 Aug 2019 05:38:29 -0400 Received: by mail-pf1-f195.google.com with SMTP id 196so4111392pfz.8 for ; Tue, 13 Aug 2019 02:38:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=RaD6A+K4/8jdvOIsXluiNkAgL7M1+kFjGExIzAUXUW8=; b=P9qJfWwQxPZfidskchVBFJ6nzdSG06wa9bYO4Ka8Z3FpbaIb/pOM0nWavs1Rp0cmwE avzBz1VE8gXB7z8yFrZriS82QzSv0+jDDzi0wloLQEWVaq4cFhu7k0W3SFCupnzo7Awb ok5s05HaN62VYRuFe331qpIqNLxTOiLF3gKl4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=RaD6A+K4/8jdvOIsXluiNkAgL7M1+kFjGExIzAUXUW8=; b=DUUDbVLIOu7aN4eYfLORiLX/7BoJA5ZnUooVzrQD//cx1s9A45X4r1EtO3AsMH4bVf TgZIJA+d3aTUlidPT0SNqDRBtoBjHqDqqAcHQVT4DGgDLh351WivOnJQxK0uddEfOJgv YkQs4mj8CKANldonXf488rihC4kU4HxhpMGNvWjAD3FTO4GctL4aifKAAEaEPdwfS9t/ Cyu+r6UwbbP3jdns2l729FTKYMyvxPyp78Hj0W8G0NB2HymIgXMLe9odPUwEl9AofLHk BRqtX5GVp0kfrJzQOkOflaNb5XeDsUoLg/zJpi/wSBazxQm8uDU4g/I4rq8Hi3ZZ+aN0 Vb1w== X-Gm-Message-State: APjAAAV1X+QQXFJqTGL5HPctIEOFDVql5lQ+7vuJ94T+32Jn5tJNTZxf 3E73Ix9vSlhWk95GtiWGYVI6mw== X-Received: by 2002:a17:90a:be06:: with SMTP id a6mr1383491pjs.92.1565689108872; Tue, 13 Aug 2019 02:38:28 -0700 (PDT) Received: from fshao-glinux.tpe.corp.google.com ([2401:fa00:1:10:c4f0:9345:d0e8:a355]) by smtp.gmail.com with ESMTPSA id d2sm993283pjs.21.2019.08.13.02.38.26 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 13 Aug 2019 02:38:28 -0700 (PDT) From: Fei Shao To: linux-arm-kernel@lists.infradead.org Cc: Dmitry Torokhov , Benson Leung , Enric Balletbo i Serra , Guenter Roeck , Ting Shen , Brian Norris , Fei Shao , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] Input: cros_ec_keyb: Add back missing mask for event_type Date: Tue, 13 Aug 2019 17:38:21 +0800 Message-Id: <20190813093821.74158-1-fshao@chromium.org> X-Mailer: git-send-email 2.23.0.rc1.153.gdeed80330f-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/input/keyboard/cros_ec_keyb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c index 38cb6d82d8fe..bef7bee6f05e 100644 --- a/drivers/input/keyboard/cros_ec_keyb.c +++ b/drivers/input/keyboard/cros_ec_keyb.c @@ -226,6 +226,8 @@ static int cros_ec_keyb_work(struct notifier_block *nb, { struct cros_ec_keyb *ckdev = container_of(nb, struct cros_ec_keyb, notifier); + uint8_t mkbp_event_type = ckdev->ec->event_data.event_type & + EC_MKBP_EVENT_TYPE_MASK; u32 val; unsigned int ev_type; @@ -237,7 +239,7 @@ static int cros_ec_keyb_work(struct notifier_block *nb, if (queued_during_suspend && !device_may_wakeup(ckdev->dev)) return NOTIFY_OK; - switch (ckdev->ec->event_data.event_type & EC_MKBP_EVENT_TYPE_MASK) { + switch (mkbp_event_type) { case EC_MKBP_EVENT_KEY_MATRIX: pm_wakeup_event(ckdev->dev, 0); @@ -264,7 +266,7 @@ static int cros_ec_keyb_work(struct notifier_block *nb, case EC_MKBP_EVENT_SWITCH: pm_wakeup_event(ckdev->dev, 0); - if (ckdev->ec->event_data.event_type == EC_MKBP_EVENT_BUTTON) { + if (mkbp_event_type == EC_MKBP_EVENT_BUTTON) { val = get_unaligned_le32( &ckdev->ec->event_data.data.buttons); ev_type = EV_KEY; -- 2.23.0.rc1.153.gdeed80330f-goog