summaryrefslogtreecommitdiffstats
path: root/drivers/input/misc/pcf8574_keypad.c
diff options
context:
space:
mode:
authorAndrew Liu <andrew.liu200917@gmail.com>2013-11-23 10:06:36 -0800
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2013-11-25 18:26:17 -0800
commite4cfb034e89a1c7148f617735d92a3655d27773f (patch)
tree5fcd037bdae5695fa786ea691e671c57bb15f67b /drivers/input/misc/pcf8574_keypad.c
parent5cf0eb9875cb26ebdc60d08444272b2ea219386e (diff)
downloadlinux-e4cfb034e89a1c7148f617735d92a3655d27773f.tar.bz2
Input: keyboard - "keycode & KEY_MAX" changes some keycode values
For exmaple, keycode: KEY_OK(0x160) is changed by "and" operation with KEY_MAX(0x2ff) to KEY_KPENTER(96). Signed-off-by: Andrew Liu <andrew.liu200917@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/misc/pcf8574_keypad.c')
-rw-r--r--drivers/input/misc/pcf8574_keypad.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/input/misc/pcf8574_keypad.c b/drivers/input/misc/pcf8574_keypad.c
index e37392976fdd..0deca5a3c87f 100644
--- a/drivers/input/misc/pcf8574_keypad.c
+++ b/drivers/input/misc/pcf8574_keypad.c
@@ -113,9 +113,12 @@ static int pcf8574_kp_probe(struct i2c_client *client, const struct i2c_device_i
idev->keycodemax = ARRAY_SIZE(lp->btncode);
for (i = 0; i < ARRAY_SIZE(pcf8574_kp_btncode); i++) {
- lp->btncode[i] = pcf8574_kp_btncode[i];
- __set_bit(lp->btncode[i] & KEY_MAX, idev->keybit);
+ if (lp->btncode[i] <= KEY_MAX) {
+ lp->btncode[i] = pcf8574_kp_btncode[i];
+ __set_bit(lp->btncode[i], idev->keybit);
+ }
}
+ __clear_bit(KEY_RESERVED, idev->keybit);
sprintf(lp->name, DRV_NAME);
sprintf(lp->phys, "kp_data/input0");