diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2017-02-20 15:16:02 -0800 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2017-02-20 15:16:02 -0800 |
commit | 6e11617fcff3688f70650a3e40addb0043dda137 (patch) | |
tree | a24f378c1a1e9f627ca1076a8b5bbd2ad7422630 /drivers/input | |
parent | 722c5ac708b4f5c1fcfad5fed4c95234c8b06590 (diff) | |
parent | a1b5359271e5c77d5ec8a575b379a6ba3e867097 (diff) |
Merge branch 'next' into for-linus
Prepare input updates for 4.11 merge window.
Diffstat (limited to 'drivers/input')
122 files changed, 2137 insertions, 2122 deletions
diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig index 6261874c07c9..ff8037798779 100644 --- a/drivers/input/Kconfig +++ b/drivers/input/Kconfig @@ -94,7 +94,6 @@ comment "Userland interfaces" config INPUT_MOUSEDEV tristate "Mouse interface" - default y help Say Y here if you want your mouse to be accessible as char devices 13:32+ - /dev/input/mouseX and 13:63 - /dev/input/mice as an @@ -109,7 +108,6 @@ config INPUT_MOUSEDEV config INPUT_MOUSEDEV_PSAUX bool "Provide legacy /dev/psaux device" - default y depends on INPUT_MOUSEDEV help Say Y here if you want your mouse also be accessible as char device @@ -118,7 +116,6 @@ config INPUT_MOUSEDEV_PSAUX If unsure, say Y. - config INPUT_MOUSEDEV_SCREEN_X int "Horizontal screen resolution" depends on INPUT_MOUSEDEV diff --git a/drivers/input/input.c b/drivers/input/input.c index d95c34ee5dc1..067d648028a2 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -1749,7 +1749,7 @@ static const struct dev_pm_ops input_dev_pm_ops = { }; #endif /* CONFIG_PM */ -static struct device_type input_dev_type = { +static const struct device_type input_dev_type = { .groups = input_dev_attr_groups, .release = input_dev_release, .uevent = input_dev_uevent, @@ -2091,6 +2091,12 @@ int input_register_device(struct input_dev *dev) const char *path; int error; + if (test_bit(EV_ABS, dev->evbit) && !dev->absinfo) { + dev_err(&dev->dev, + "Absolute device without dev->absinfo, refusing to register\n"); + return -EINVAL; + } + if (dev->devres_managed) { devres = devres_alloc(devm_input_device_unregister, sizeof(struct input_devres), GFP_KERNEL); diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index abd18f31b24f..065e67bf56dd 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c @@ -87,7 +87,7 @@ static int joydev_correct(int value, struct js_corr *corr) return 0; } - return value < -32767 ? -32767 : (value > 32767 ? 32767 : value); + return clamp(value, -32767, 32767); } static void joydev_pass_event(struct joydev_client *client, @@ -187,6 +187,17 @@ static void joydev_detach_client(struct joydev *joydev, synchronize_rcu(); } +static void joydev_refresh_state(struct joydev *joydev) +{ + struct input_dev *dev = joydev->handle.dev; + int i, val; + + for (i = 0; i < joydev->nabs; i++) { + val = input_abs_get_val(dev, joydev->abspam[i]); + joydev->abs[i] = joydev_correct(val, &joydev->corr[i]); + } +} + static int joydev_open_device(struct joydev *joydev) { int retval; @@ -201,6 +212,8 @@ static int joydev_open_device(struct joydev *joydev) retval = input_open_device(&joydev->handle); if (retval) joydev->open--; + else + joydev_refresh_state(joydev); } mutex_unlock(&joydev->mutex); @@ -872,7 +885,6 @@ static int joydev_connect(struct input_handler *handler, struct input_dev *dev, j = joydev->abspam[i]; if (input_abs_get_max(dev, j) == input_abs_get_min(dev, j)) { joydev->corr[i].type = JS_CORR_NONE; - joydev->abs[i] = input_abs_get_val(dev, j); continue; } joydev->corr[i].type = JS_CORR_BROKEN; @@ -887,10 +899,6 @@ static int joydev_connect(struct input_handler *handler, struct input_dev *dev, if (t) { joydev->corr[i].coef[2] = (1 << 29) / t; joydev->corr[i].coef[3] = (1 << 29) / t; - - joydev->abs[i] = - joydev_correct(input_abs_get_val(dev, j), - joydev->corr + i); } } diff --git a/drivers/input/joystick/maplecontrol.c b/drivers/input/joystick/maplecontrol.c index 8aa6e4c497da..ff54e195d42c 100644 --- a/drivers/input/joystick/maplecontrol.c +++ b/drivers/input/joystick/maplecontrol.c @@ -139,7 +139,6 @@ static int probe_maple_controller(struct device *dev) idev->dev.parent = &mdev->dev; idev->name = mdev->product_name; idev->id.bustype = |