aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/input.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-02 20:16:10 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-02 20:16:10 -0400
commitfc47912d9cda50ae6bd9ca30e97e8c03de5b7b60 (patch)
treed7da6ce3b23c1524e681ee33aa6e21d3c0586108 /drivers/input/input.c
parent06fe918e9f177dc2a0592b0ad40a6ce4920b2033 (diff)
parentdde3ada3d0069855eeb353707b2b0f946191cfd6 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input updates from Dmitry Torokhov: "A few drivers were updated with device tree bindings and others got a few small cleanups and fixes." Fix trivial conflict in drivers/input/keyboard/omap-keypad.c due to changes clashing with a whitespace cleanup. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (28 commits) Input: wacom - mark Intuos5 pad as in-prox when touching buttons Input: synaptics - adjust threshold for treating position values as negative Input: hgpk - use %*ph to dump small buffer Input: gpio_keys_polled - fix dt pdata->nbuttons Input: Add KD[GS]KBDIACRUC ioctls to the compatible list Input: omap-keypad - fixed formatting Input: tegra - move platform data header Input: wacom - add support for EMR on Cintiq 24HD touch Input: s3c2410_ts - make s3c_ts_pmops const Input: samsung-keypad - use of_get_child_count() helper Input: samsung-keypad - use of_match_ptr() Input: uinput - fix formatting Input: uinput - specify exact bit sizes on userspace APIs Input: uinput - mark failed submission requests as free Input: uinput - fix race that can block nonblocking read Input: uinput - return -EINVAL when read buffer size is too small Input: uinput - take event lock when fetching events from buffer Input: get rid of MATCH_BIT() macro Input: rotary-encoder - add DT bindings Input: rotary-encoder - constify platform data pointers ...
Diffstat (limited to 'drivers/input/input.c')
-rw-r--r--drivers/input/input.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 5244f3d05b12..ace3f7c4226d 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -918,18 +918,10 @@ int input_set_keycode(struct input_dev *dev,
918} 918}
919EXPORT_SYMBOL(input_set_keycode); 919EXPORT_SYMBOL(input_set_keycode);
920 920
921#define MATCH_BIT(bit, max) \
922 for (i = 0; i < BITS_TO_LONGS(max); i++) \
923 if ((id->bit[i] & dev->bit[i]) != id->bit[i]) \
924 break; \
925 if (i != BITS_TO_LONGS(max)) \
926 continue;
927
928static const struct input_device_id *input_match_device(struct input_handler *handler, 921static const struct input_device_id *input_match_device(struct input_handler *handler,
929 struct input_dev *dev) 922 struct input_dev *dev)
930{ 923{
931 const struct input_device_id *id; 924 const struct input_device_id *id;
932 int i;
933 925
934 for (id = handler->id_table; id->flags || id->driver_info; id++) { 926 for (id = handler->id_table; id->flags || id->driver_info; id++) {
935 927
@@ -949,15 +941,32 @@ static const struct input_device_id *input_match_device(struct input_handler *ha
949 if (id->version != dev->id.version) 941 if (id->version != dev->id.version)
950 continue; 942 continue;
951 943
952 MATCH_BIT(evbit, EV_MAX); 944 if (!bitmap_subset(id->evbit, dev->evbit, EV_MAX))
953 MATCH_BIT(keybit, KEY_MAX); 945 continue;
954 MATCH_BIT(relbit, REL_MAX); 946
955 MATCH_BIT(absbit, ABS_MAX); 947 if (!bitmap_subset(id->keybit, dev->keybit, KEY_MAX))
956 MATCH_BIT(mscbit, MSC_MAX); 948 continue;
957 MATCH_BIT(ledbit, LED_MAX); 949
958 MATCH_BIT(sndbit, SND_MAX); 950 if (!bitmap_subset(id->relbit, dev->relbit, REL_MAX))
959 MATCH_BIT(ffbit, FF_MAX); 951 continue;
960 MATCH_BIT(swbit, SW_MAX); 952
953 if (!bitmap_subset(id->absbit, dev->absbit, ABS_MAX))
954 continue;
955
956 if (!bitmap_subset(id->mscbit, dev->mscbit, MSC_MAX))
957 continue;
958
959 if (!bitmap_subset(id->ledbit, dev->ledbit, LED_MAX))
960 continue;
961
962 if (!bitmap_subset(id->sndbit, dev->sndbit, SND_MAX))
963 continue;
964
965 if (!bitmap_subset(id->ffbit, dev->ffbit, FF_MAX))
966 continue;
967
968 if (!bitmap_subset(id->swbit, dev->swbit, SW_MAX))
969 continue;
961 970
962 if (!handler->match || handler->match(handler, dev)) 971 if (!handler->match || handler->match(handler, dev))
963 return id; 972 return id;