From patchwork Thu Jan 5 17:14:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 9499387 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 51910606B5 for ; Thu, 5 Jan 2017 17:17:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B0632841C for ; Thu, 5 Jan 2017 17:17:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F0CE28422; Thu, 5 Jan 2017 17:17:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C907E2841C for ; Thu, 5 Jan 2017 17:17:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031668AbdAERQJ (ORCPT ); Thu, 5 Jan 2017 12:16:09 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:34865 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967609AbdAERQF (ORCPT ); Thu, 5 Jan 2017 12:16:05 -0500 Received: by mail-pf0-f193.google.com with SMTP id i88so28691679pfk.2; Thu, 05 Jan 2017 09:16:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=5gh46oNQjkDbRf9E+A0oQ0oX00hFpbC9PP4bJ7Bs4AE=; b=VC4+IHjBmehpZXSSgZgknNWNjUpWMGJkWw3Z5l0V0KaUG/kgBh3yeeH8qkCxj4RY6s 0Wr8aFdPyZSMBRx3LWf9ZwoQyrOuh8f7xoFveUaDQ5hT9f+ds4lSjqmM81OQs26o8B4l sroietnNSyo1DM76+icmf9oD6X+t21mOUXtqp3OmOyER0eHz5wuvOpPNaLlcEof0+bX9 lMpC12+qRcaZUPcfKW+/2UQCSJ5ldMp5SG7QZc/JNEWWqayDEq2DJKhH4rQcv7iIuDGV 16PGcHFnSL4JF/dcH0B1MQm5wdhDU35tpFgo8vtQscruc97F4gMv7wIYm+Iy42HBaRTF DStg== 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; bh=5gh46oNQjkDbRf9E+A0oQ0oX00hFpbC9PP4bJ7Bs4AE=; b=bWfC3QAXuaZqeJWrzKFKfNS4v26QM2a9UUBIstkYgKl183398aGIpAXpNuUpMdrLFT aKYNWBZzFqn+BBWGQLjKASfhCrXPpZAYO0pua7Njik1ykA/PLOkxL22ex/LSUWrCtCYs P/KG6jlFijUaspefS1es4jkLBGXmAlbJBmMYVHr3j8yBPBhVrCu8VvR6nF9ho7jL/P7A Isoe9CK0IimFEYv0c8xBhoZDHc4ZXrvR2cWCbg0NTO5AbQq8y5xC1jHLd/C2mvTWBi5M Iq1IbyKET68ipHKY1w5kuUnCpeOpXOajWnS6R3m8qbC3SjbJGv8F7FQ6QRPw2BxaWXf4 s/1g== X-Gm-Message-State: AIkVDXLdswNkKGVkP4M4KDrUIJJnYW5vnKMEeDAVhU9vui2/ic/q87xyscHsIJRQ1ZC3Zg== X-Received: by 10.84.212.2 with SMTP id d2mr160934973pli.24.1483636564189; Thu, 05 Jan 2017 09:16:04 -0800 (PST) Received: from localhost.localdomain ([240f:4:c2bc:1:9509:afdd:5ccb:93b]) by smtp.gmail.com with ESMTPSA id l7sm154872872pfg.35.2017.01.05.09.16.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Jan 2017 09:16:03 -0800 (PST) From: Akinobu Mita To: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Akinobu Mita , Greg Kroah-Hartman , Jiri Slaby , Dmitry Torokhov Subject: [PATCH] sysrq: attach sysrq handler correctly for 32-bit kernel Date: Fri, 6 Jan 2017 02:14:16 +0900 Message-Id: <1483636456-23336-1-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The sysrq input handler should be attached to the input device which has a left alt key. On 32-bit kernels, some input devices which has a left alt key cannot attach sysrq handler. Because the keybit bitmap in struct input_device_id for sysrq is not correctly initialized. KEY_LEFTALT is 56 which is greater than BITS_PER_LONG on 32-bit kernels. I found this problem when using a matrix keypad device which defines a KEY_LEFTALT (56) but doesn't have a KEY_O (24 == 56%32). Cc: Greg Kroah-Hartman Cc: Jiri Slaby Cc: Dmitry Torokhov Signed-off-by: Akinobu Mita Acked-by: Dmitry Torokhov --- drivers/tty/sysrq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c index 52bbd27..701c085 100644 --- a/drivers/tty/sysrq.c +++ b/drivers/tty/sysrq.c @@ -946,8 +946,8 @@ static const struct input_device_id sysrq_ids[] = { { .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT, - .evbit = { BIT_MASK(EV_KEY) }, - .keybit = { BIT_MASK(KEY_LEFTALT) }, + .evbit = { [BIT_WORD(EV_KEY)] = BIT_MASK(EV_KEY) }, + .keybit = { [BIT_WORD(KEY_LEFTALT)] = BIT_MASK(KEY_LEFTALT) }, }, { }, };