]>
Commit | Line | Data |
---|---|---|
7e0d956d GKH |
1 | From 802c03881f29844af0252b6e22be5d2f65f93fd0 Mon Sep 17 00:00:00 2001 |
2 | From: Akinobu Mita <akinobu.mita@gmail.com> | |
3 | Date: Fri, 6 Jan 2017 02:14:16 +0900 | |
4 | Subject: sysrq: attach sysrq handler correctly for 32-bit kernel | |
5 | ||
6 | From: Akinobu Mita <akinobu.mita@gmail.com> | |
7 | ||
8 | commit 802c03881f29844af0252b6e22be5d2f65f93fd0 upstream. | |
9 | ||
10 | The sysrq input handler should be attached to the input device which has | |
11 | a left alt key. | |
12 | ||
13 | On 32-bit kernels, some input devices which has a left alt key cannot | |
14 | attach sysrq handler. Because the keybit bitmap in struct input_device_id | |
15 | for sysrq is not correctly initialized. KEY_LEFTALT is 56 which is | |
16 | greater than BITS_PER_LONG on 32-bit kernels. | |
17 | ||
18 | I found this problem when using a matrix keypad device which defines | |
19 | a KEY_LEFTALT (56) but doesn't have a KEY_O (24 == 56%32). | |
20 | ||
21 | Cc: Jiri Slaby <jslaby@suse.com> | |
22 | Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> | |
23 | Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> | |
24 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
25 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
26 | ||
27 | --- | |
28 | drivers/tty/sysrq.c | 4 ++-- | |
29 | 1 file changed, 2 insertions(+), 2 deletions(-) | |
30 | ||
31 | --- a/drivers/tty/sysrq.c | |
32 | +++ b/drivers/tty/sysrq.c | |
33 | @@ -939,8 +939,8 @@ static const struct input_device_id sysr | |
34 | { | |
35 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT | | |
36 | INPUT_DEVICE_ID_MATCH_KEYBIT, | |
37 | - .evbit = { BIT_MASK(EV_KEY) }, | |
38 | - .keybit = { BIT_MASK(KEY_LEFTALT) }, | |
39 | + .evbit = { [BIT_WORD(EV_KEY)] = BIT_MASK(EV_KEY) }, | |
40 | + .keybit = { [BIT_WORD(KEY_LEFTALT)] = BIT_MASK(KEY_LEFTALT) }, | |
41 | }, | |
42 | { }, | |
43 | }; |