diff options
Diffstat (limited to 'drivers/input/input.c')
| -rw-r--r-- | drivers/input/input.c | 83 |
1 files changed, 38 insertions, 45 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c index d268fdc23c64..02e6ea7955fe 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
| @@ -933,58 +933,51 @@ int input_set_keycode(struct input_dev *dev, | |||
| 933 | } | 933 | } |
| 934 | EXPORT_SYMBOL(input_set_keycode); | 934 | EXPORT_SYMBOL(input_set_keycode); |
| 935 | 935 | ||
| 936 | bool input_match_device_id(const struct input_dev *dev, | ||
| 937 | const struct input_device_id *id) | ||
| 938 | { | ||
| 939 | if (id->flags & INPUT_DEVICE_ID_MATCH_BUS) | ||
| 940 | if (id->bustype != dev->id.bustype) | ||
| 941 | return false; | ||
| 942 | |||
| 943 | if (id->flags & INPUT_DEVICE_ID_MATCH_VENDOR) | ||
| 944 | if (id->vendor != dev->id.vendor) | ||
| 945 | return false; | ||
| 946 | |||
| 947 | if (id->flags & INPUT_DEVICE_ID_MATCH_PRODUCT) | ||
| 948 | if (id->product != dev->id.product) | ||
| 949 | return false; | ||
| 950 | |||
| 951 | if (id->flags & INPUT_DEVICE_ID_MATCH_VERSION) | ||
| 952 | if (id->version != dev->id.version) | ||
| 953 | return false; | ||
| 954 | |||
| 955 | if (!bitmap_subset(id->evbit, dev->evbit, EV_MAX) || | ||
| 956 | !bitmap_subset(id->keybit, dev->keybit, KEY_MAX) || | ||
| 957 | !bitmap_subset(id->relbit, dev->relbit, REL_MAX) || | ||
| 958 | !bitmap_subset(id->absbit, dev->absbit, ABS_MAX) || | ||
| 959 | !bitmap_subset(id->mscbit, dev->mscbit, MSC_MAX) || | ||
| 960 | !bitmap_subset(id->ledbit, dev->ledbit, LED_MAX) || | ||
| 961 | !bitmap_subset(id->sndbit, dev->sndbit, SND_MAX) || | ||
| 962 | !bitmap_subset(id->ffbit, dev->ffbit, FF_MAX) || | ||
| 963 | !bitmap_subset(id->swbit, dev->swbit, SW_MAX)) { | ||
| 964 | return false; | ||
| 965 | } | ||
| 966 | |||
| 967 | return true; | ||
| 968 | } | ||
| 969 | EXPORT_SYMBOL(input_match_device_id); | ||
| 970 | |||
| 936 | static const struct input_device_id *input_match_device(struct input_handler *handler, | 971 | static const struct input_device_id *input_match_device(struct input_handler *handler, |
| 937 | struct input_dev *dev) | 972 | struct input_dev *dev) |
| 938 | { | 973 | { |
| 939 | const struct input_device_id *id; | 974 | const struct input_device_id *id; |
| 940 | 975 | ||
| 941 | for (id = handler->id_table; id->flags || id->driver_info; id++) { | 976 | for (id = handler->id_table; id->flags || id->driver_info; id++) { |
| 942 | 977 | if (input_match_device_id(dev, id) && | |
| 943 | if (id->flags & INPUT_DEVICE_ID_MATCH_BUS) | 978 | (!handler->match || handler->match(handler, dev))) { |
| 944 | if (id->bustype != dev->id.bustype) | ||
| 945 | continue; | ||
| 946 | |||
| 947 | if (id->flags & INPUT_DEVICE_ID_MATCH_VENDOR) | ||
| 948 | if (id->vendor != dev->id.vendor) | ||
| 949 | continue; | ||
| 950 | |||
| 951 | if (id->flags & INPUT_DEVICE_ID_MATCH_PRODUCT) | ||
| 952 | if (id->product != dev->id.product) | ||
| 953 | continue; | ||
| 954 | |||
| 955 | if (id->flags & INPUT_DEVICE_ID_MATCH_VERSION) | ||
| 956 | if (id->version != dev->id.version) | ||
| 957 | continue; | ||
| 958 | |||
| 959 | if (!bitmap_subset(id->evbit, dev->evbit, EV_MAX)) | ||
| 960 | continue; | ||
| 961 | |||
| 962 | if (!bitmap_subset(id->keybit, dev->keybit, KEY_MAX)) | ||
| 963 | continue; | ||
| 964 | |||
| 965 | if (!bitmap_subset(id->relbit, dev->relbit, REL_MAX)) | ||
| 966 | continue; | ||
| 967 | |||
| 968 | if (!bitmap_subset(id->absbit, dev->absbit, ABS_MAX)) | ||
| 969 | continue; | ||
| 970 | |||
| 971 | if (!bitmap_subset(id->mscbit, dev->mscbit, MSC_MAX)) | ||
| 972 | continue; | ||
| 973 | |||
| 974 | if (!bitmap_subset(id->ledbit, dev->ledbit, LED_MAX)) | ||
| 975 | continue; | ||
| 976 | |||
| 977 | if (!bitmap_subset(id->sndbit, dev->sndbit, SND_MAX)) | ||
| 978 | continue; | ||
| 979 | |||
| 980 | if (!bitmap_subset(id->ffbit, dev->ffbit, FF_MAX)) | ||
| 981 | continue; | ||
| 982 | |||
| 983 | if (!bitmap_subset(id->swbit, dev->swbit, SW_MAX)) | ||
| 984 | continue; | ||
| 985 | |||
| 986 | if (!handler->match || handler->match(handler, dev)) | ||
| 987 | return id; | 979 | return id; |
| 980 | } | ||
| 988 | } | 981 | } |
| 989 | 982 | ||
| 990 | return NULL; | 983 | return NULL; |
