aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/input.c
diff options
context:
space:
mode:
authorTakashi Iwai <[email protected]>2017-11-01 16:43:20 +0000
committerTakashi Iwai <[email protected]>2017-11-01 16:43:20 +0000
commita53a0ab8ff725672fcb47bb9a5ef75fce45679d0 (patch)
tree75cdea78f27fdd569d72cea0b7837bbcc8d871f7 /drivers/input/input.c
parentALSA: seq: Fix nested rwsem annotation for lockdep splat (diff)
parentMerge remote-tracking branches 'asoc/fix/topology', 'asoc/fix/adau17x1', 'aso... (diff)
downloadkernel-a53a0ab8ff725672fcb47bb9a5ef75fce45679d0.tar.gz
kernel-a53a0ab8ff725672fcb47bb9a5ef75fce45679d0.zip
Merge tag 'asoc-fix-v4.14-rc7' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v4.14 A bunch of fixes here, mostly device specific ones (the biggest one being the revert of the hotword support for rt5514), with a couple of core fixes for potential issues with corrupted or otherwise invalid topology files.
Diffstat (limited to 'drivers/input/input.c')
-rw-r--r--drivers/input/input.c80
1 files changed, 37 insertions, 43 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index d268fdc23c64..762bfb9487dc 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -933,58 +933,52 @@ int input_set_keycode(struct input_dev *dev,
}
EXPORT_SYMBOL(input_set_keycode);
-static const struct input_device_id *input_match_device(struct input_handler *handler,
- struct input_dev *dev)
+bool input_match_device_id(const struct input_dev *dev,
+ const struct input_device_id *id)
{
- const struct input_device_id *id;
-
- for (id = handler->id_table; id->flags || id->driver_info; id++) {
-
- if (id->flags & INPUT_DEVICE_ID_MATCH_BUS)
- if (id->bustype != dev->id.bustype)
- continue;
-
- if (id->flags & INPUT_DEVICE_ID_MATCH_VENDOR)
- if (id->vendor != dev->id.vendor)
- continue;
-
- if (id->flags & INPUT_DEVICE_ID_MATCH_PRODUCT)
- if (id->product != dev->id.product)
- continue;
-
- if (id->flags & INPUT_DEVICE_ID_MATCH_VERSION)
- if (id->version != dev->id.version)
- continue;
-
- if (!bitmap_subset(id->evbit, dev->evbit, EV_MAX))
- continue;
-
- if (!bitmap_subset(id->keybit, dev->keybit, KEY_MAX))
- continue;
+ if (id->flags & INPUT_DEVICE_ID_MATCH_BUS)
+ if (id->bustype != dev->id.bustype)
+ return false;
- if (!bitmap_subset(id->relbit, dev->relbit, REL_MAX))
- continue;
+ if (id->flags & INPUT_DEVICE_ID_MATCH_VENDOR)
+ if (id->vendor != dev->id.vendor)
+ return false;
- if (!bitmap_subset(id->absbit, dev->absbit, ABS_MAX))
- continue;
+ if (id->flags & INPUT_DEVICE_ID_MATCH_PRODUCT)
+ if (id->product != dev->id.product)
+ return false;
- if (!bitmap_subset(id->mscbit, dev->mscbit, MSC_MAX))
- continue;
+ if (id->flags & INPUT_DEVICE_ID_MATCH_VERSION)
+ if (id->version != dev->id.version)
+ return false;
- if (!bitmap_subset(id->ledbit, dev->ledbit, LED_MAX))
- continue;
-
- if (!bitmap_subset(id->sndbit, dev->sndbit, SND_MAX))
- continue;
+ if (!bitmap_subset(id->evbit, dev->evbit, EV_MAX) ||
+ !bitmap_subset(id->keybit, dev->keybit, KEY_MAX) ||
+ !bitmap_subset(id->relbit, dev->relbit, REL_MAX) ||
+ !bitmap_subset(id->absbit, dev->absbit, ABS_MAX) ||
+ !bitmap_subset(id->mscbit, dev->mscbit, MSC_MAX) ||
+ !bitmap_subset(id->ledbit, dev->ledbit, LED_MAX) ||
+ !bitmap_subset(id->sndbit, dev->sndbit, SND_MAX) ||
+ !bitmap_subset(id->ffbit, dev->ffbit, FF_MAX) ||
+ !bitmap_subset(id->swbit, dev->swbit, SW_MAX) ||
+ !bitmap_subset(id->propbit, dev->propbit, INPUT_PROP_MAX)) {
+ return false;
+ }
- if (!bitmap_subset(id->ffbit, dev->ffbit, FF_MAX))
- continue;
+ return true;
+}
+EXPORT_SYMBOL(input_match_device_id);
- if (!bitmap_subset(id->swbit, dev->swbit, SW_MAX))
- continue;
+static const struct input_device_id *input_match_device(struct input_handler *handler,
+ struct input_dev *dev)
+{
+ const struct input_device_id *id;
- if (!handler->match || handler->match(handler, dev))
+ for (id = handler->id_table; id->flags || id->driver_info; id++) {
+ if (input_match_device_id(dev, id) &&
+ (!handler->match || handler->match(handler, dev))) {
return id;
+ }
}
return NULL;