Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp800018ybl; Tue, 13 Aug 2019 02:50:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqw6YHLmlG+jo3qYjkc+4V7rns6LMlaS2H1PJPPOuL3M+eXmZsSn+0T34oVJ6D4Cdc6RKiAZ X-Received: by 2002:a62:1a45:: with SMTP id a66mr14448640pfa.142.1565689808154; Tue, 13 Aug 2019 02:50:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565689808; cv=none; d=google.com; s=arc-20160816; b=CGncj15Xq2Bc2VbGxp5VgcKhPoPYF7dhkWQ+ItjqCKl077owGeRH34hja7bKtQjXzD 7EsyRqC995zXzt7RLFKSyJKYzdX3UObNZEiU9J0UCedcS6m5OoJsefUiFoALMpUBDDXq pewN2oDT8Q2CX4FzCSfXlBUlUsBRZu6z7ZQHlTGFhR7/ARfhDzVuDMbRn9N+JL6CK4JJ ia6yn4pxkeDQ5fv8t4u3Z7c1HJjTgnGT1xBPKZB1bkQFbHQHgxaPML+RbSYhh98XGmNE pOC4rJHshHgeNWwrF0F24Ww5ogaXX8xGShg40zzzdMJWEsVbAHXsHIcx+nLROtW2eXPE 2ofg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=kc38QbcHV7pkptm5fiPW3dVekfJJ+xCxwUWXKBIaN8U=; b=lulAiVBbmuUmiGo1bzaP1LUqnu7x0KmiWxysDaoSdmeU2yCUmaPf6Ya2/8gt0auYso waiMmnM0ZatJtu5YXyfqBPF5MsGwvcge9YG31s/6tZ+EUNu7qwqfOBGOEQlUgTmXdEW5 /FBLsBK4oyedu4OtpE9Kb+ritq6h4v8wWrRZLNBgmWjexCqb5STLyMSA2wcsNdmsCwiN Gapi3lkmt0SNXKXB0KcRe9QijyeP/YNDQxoDE41rahTPjQ8h+wYUk6s316t8QOKYu0Ps k/DYAP+LaS62eHxviSVjC1nlegdsnIsSKUmXH7jW3f3DBr3QF1U23HW7JaPwMqkBhD0J 8A3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=RWWrNVi9; 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 m129si65391947pfm.15.2019.08.13.02.49.52; Tue, 13 Aug 2019 02:50:08 -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=RWWrNVi9; 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 S1727625AbfHMJrg (ORCPT + 99 others); Tue, 13 Aug 2019 05:47:36 -0400 Received: from mail-qk1-f193.google.com ([209.85.222.193]:35085 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726650AbfHMJrf (ORCPT ); Tue, 13 Aug 2019 05:47:35 -0400 Received: by mail-qk1-f193.google.com with SMTP id r21so79200089qke.2 for ; Tue, 13 Aug 2019 02:47:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kc38QbcHV7pkptm5fiPW3dVekfJJ+xCxwUWXKBIaN8U=; b=RWWrNVi9zhN6jA53rD5YyEnuQ3736IwlQbfyNGthICPxreJz/TAJi7/YoKrFormYA3 xXViBLLAdVjnrUBe82FiPrJrV871oPvdim/1uM1KHWarwvpyontipCCoptsjCa6GSN3C JXL97YxRXUApdUZCHhynLD4frQIcK6FPX9pp0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kc38QbcHV7pkptm5fiPW3dVekfJJ+xCxwUWXKBIaN8U=; b=hggQf/sAn6NfQOZ5cdJ0VFf/DcmDq3lXC5QQUoaU7/SesGR7S1ehZirTLsUn6C9o+R LOGfhPKWGb1sm9z7R5KeoE4M7SYyaN0eoMR/8uDGZY6wcUIGc0evx5HWCFIDWvMax1P5 Lx8MfI/Sb13Eivs3cCh7l95XQ/gYRc/xcUTgJRvnz8A4MhlSnBxB1527H3BnZ0ue3LNl b+jKhXxoow8OaLARVqnDjmH9kdWh/xEuTuZr8LTPp4Ik3y2riHwHxef/WcIiK/Whk+SG vO86eoaOjz8lFvOb42k7GTXoHCt+eX3/SsQBxkg/xXhIsmElAEfyRkPtKQG3N/hN22gY 49JQ== X-Gm-Message-State: APjAAAXO5s+osxqGce++XCymlrBWEvKKnQwxII0P4DOVFE0C3oeUnVAC 8/4dS1QuNgV66/2X9QsEZWem0CV5iNw/T4lutcIe5w== X-Received: by 2002:a37:5ec7:: with SMTP id s190mr22499051qkb.299.1565689654858; Tue, 13 Aug 2019 02:47:34 -0700 (PDT) MIME-Version: 1.0 References: <20190813093821.74158-1-fshao@chromium.org> In-Reply-To: <20190813093821.74158-1-fshao@chromium.org> From: Nicolas Boichat Date: Tue, 13 Aug 2019 17:47:22 +0800 Message-ID: Subject: Re: [PATCH] Input: cros_ec_keyb: Add back missing mask for event_type To: Fei Shao Cc: linux-arm Mailing List , Dmitry Torokhov , Benson Leung , Enric Balletbo i Serra , Guenter Roeck , Ting Shen , Brian Norris , "open list:HID CORE LAYER" , lkml Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 13, 2019 at 5:38 PM Fei Shao wrote: > > 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 Reviewed-by: Nicolas Boichat > --- > 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