From 3b95bc57c86b064fd140ccec3642ad14f40b687f Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Wed, 18 Nov 2020 22:49:27 -0800 Subject: Input: adp5589-keys - remove setup/teardown hooks for gpios This is currently just dead code. It's from around a time when platform-data was used, and a board could hook it's own special callback for setup/teardown, and a private object (via 'context'). This change removes it, as there are no more users in mainline for this. Signed-off-by: Alexandru Ardelean Link: https://lore.kernel.org/r/20201112074308.71351-4-alexandru.ardelean@analog.com Signed-off-by: Dmitry Torokhov --- include/linux/input/adp5589.h | 7 ------- 1 file changed, 7 deletions(-) (limited to 'include') diff --git a/include/linux/input/adp5589.h b/include/linux/input/adp5589.h index c0523af96893..0e4742c8c81e 100644 --- a/include/linux/input/adp5589.h +++ b/include/linux/input/adp5589.h @@ -175,13 +175,6 @@ struct i2c_client; /* forward declaration */ struct adp5589_gpio_platform_data { int gpio_start; /* GPIO Chip base # */ - int (*setup)(struct i2c_client *client, - int gpio, unsigned ngpio, - void *context); - int (*teardown)(struct i2c_client *client, - int gpio, unsigned ngpio, - void *context); - void *context; }; #endif -- cgit v1.2.3 From 278b13ce3a89698711c5a67792ba2dba41555433 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Wed, 2 Oct 2019 10:33:02 -0700 Subject: Input: remove input_polled_dev implementation Now that normal input devices support polling mode, and all users of input_polled_dev API have been converted, we can remove it. Signed-off-by: Dmitry Torokhov --- Documentation/driver-api/input.rst | 9 - drivers/input/Kconfig | 13 -- drivers/input/Makefile | 1 - drivers/input/input-polldev.c | 362 ------------------------------------- include/linux/input-polldev.h | 58 ------ 5 files changed, 443 deletions(-) delete mode 100644 drivers/input/input-polldev.c delete mode 100644 include/linux/input-polldev.h (limited to 'include') diff --git a/Documentation/driver-api/input.rst b/Documentation/driver-api/input.rst index d05bf58fa83e..4bbb26ae2a89 100644 --- a/Documentation/driver-api/input.rst +++ b/Documentation/driver-api/input.rst @@ -25,15 +25,6 @@ Multitouch Library .. kernel-doc:: drivers/input/input-mt.c :export: -Polled input devices --------------------- - -.. kernel-doc:: include/linux/input-polldev.h - :internal: - -.. kernel-doc:: drivers/input/input-polldev.c - :export: - Matrix keyboards/keypads ------------------------ diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig index 1efd3154b68d..ec0e861f185f 100644 --- a/drivers/input/Kconfig +++ b/drivers/input/Kconfig @@ -52,19 +52,6 @@ config INPUT_FF_MEMLESS To compile this driver as a module, choose M here: the module will be called ff-memless. -config INPUT_POLLDEV - tristate "Polled input device skeleton" - help - Say Y here if you are using a driver for an input - device that periodically polls hardware state. This - option is only useful for out-of-tree drivers since - in-tree drivers select it automatically. - - If unsure, say N. - - To compile this driver as a module, choose M here: the - module will be called input-polldev. - config INPUT_SPARSEKMAP tristate "Sparse keymap support library" help diff --git a/drivers/input/Makefile b/drivers/input/Makefile index e35650930371..d8f5310e22ba 100644 --- a/drivers/input/Makefile +++ b/drivers/input/Makefile @@ -9,7 +9,6 @@ obj-$(CONFIG_INPUT) += input-core.o input-core-y := input.o input-compat.o input-mt.o input-poller.o ff-core.o obj-$(CONFIG_INPUT_FF_MEMLESS) += ff-memless.o -obj-$(CONFIG_INPUT_POLLDEV) += input-polldev.o obj-$(CONFIG_INPUT_SPARSEKMAP) += sparse-keymap.o obj-$(CONFIG_INPUT_MATRIXKMAP) += matrix-keymap.o diff --git a/drivers/input/input-polldev.c b/drivers/input/input-polldev.c deleted file mode 100644 index 9bf1c9aeb4c4..000000000000 --- a/drivers/input/input-polldev.c +++ /dev/null @@ -1,362 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Generic implementation of a polled input device - - * Copyright (c) 2007 Dmitry Torokhov - */ - -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include -#include -#include -#include -#include -#include - -MODULE_AUTHOR("Dmitry Torokhov "); -MODULE_DESCRIPTION("Generic implementation of a polled input device"); -MODULE_LICENSE("GPL v2"); - -static void input_polldev_queue_work(struct input_polled_dev *dev) -{ - unsigned long delay; - - delay = msecs_to_jiffies(dev->poll_interval); - if (delay >= HZ) - delay = round_jiffies_relative(delay); - - queue_delayed_work(system_freezable_wq, &dev->work, delay); -} - -static void input_polled_device_work(struct work_struct *work) -{ - struct input_polled_dev *dev = - container_of(work, struct input_polled_dev, work.work); - - dev->poll(dev); - input_polldev_queue_work(dev); -} - -static int input_open_polled_device(struct input_dev *input) -{ - struct input_polled_dev *dev = input_get_drvdata(input); - - if (dev->open) - dev->open(dev); - - /* Only start polling if polling is enabled */ - if (dev->poll_interval > 0) { - dev->poll(dev); - input_polldev_queue_work(dev); - } - - return 0; -} - -static void input_close_polled_device(struct input_dev *input) -{ - struct input_polled_dev *dev = input_get_drvdata(input); - - cancel_delayed_work_sync(&dev->work); - - if (dev->close) - dev->close(dev); -} - -/* SYSFS interface */ - -static ssize_t input_polldev_get_poll(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct input_polled_dev *polldev = dev_get_drvdata(dev); - - return sprintf(buf, "%d\n", polldev->poll_interval); -} - -static ssize_t input_polldev_set_poll(struct device *dev, - struct device_attribute *attr, const char *buf, - size_t count) -{ - struct input_polled_dev *polldev = dev_get_drvdata(dev); - struct input_dev *input = polldev->input; - unsigned int interval; - int err; - - err = kstrtouint(buf, 0, &interval); - if (err) - return err; - - if (interval < polldev->poll_interval_min) - return -EINVAL; - - if (interval > polldev->poll_interval_max) - return -EINVAL; - - mutex_lock(&input->mutex); - - polldev->poll_interval = interval; - - if (input->users) { - cancel_delayed_work_sync(&polldev->work); - if (polldev->poll_interval > 0) - input_polldev_queue_work(polldev); - } - - mutex_unlock(&input->mutex); - - return count; -} - -static DEVICE_ATTR(poll, S_IRUGO | S_IWUSR, input_polldev_get_poll, - input_polldev_set_poll); - - -static ssize_t input_polldev_get_max(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct input_polled_dev *polldev = dev_get_drvdata(dev); - - return sprintf(buf, "%d\n", polldev->poll_interval_max); -} - -static DEVICE_ATTR(max, S_IRUGO, input_polldev_get_max, NULL); - -static ssize_t input_polldev_get_min(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct input_polled_dev *polldev = dev_get_drvdata(dev); - - return sprintf(buf, "%d\n", polldev->poll_interval_min); -} - -static DEVICE_ATTR(min, S_IRUGO, input_polldev_get_min, NULL); - -static struct attribute *sysfs_attrs[] = { - &dev_attr_poll.attr, - &dev_attr_max.attr, - &dev_attr_min.attr, - NULL -}; - -static struct attribute_group input_polldev_attribute_group = { - .attrs = sysfs_attrs -}; - -static const struct attribute_group *input_polldev_attribute_groups[] = { - &input_polldev_attribute_group, - NULL -}; - -/** - * input_allocate_polled_device - allocate memory for polled device - * - * The function allocates memory for a polled device and also - * for an input device associated with this polled device. - */ -struct input_polled_dev *input_allocate_polled_device(void) -{ - struct input_polled_dev *dev; - - dev = kzalloc(sizeof(struct input_polled_dev), GFP_KERNEL); - if (!dev) - return NULL; - - dev->input = input_allocate_device(); - if (!dev->input) { - kfree(dev); - return NULL; - } - - return dev; -} -EXPORT_SYMBOL(input_allocate_polled_device); - -struct input_polled_devres { - struct input_polled_dev *polldev; -}; - -static int devm_input_polldev_match(struct device *dev, void *res, void *data) -{ - struct input_polled_devres *devres = res; - - return devres->polldev == data; -} - -static void devm_input_polldev_release(struct device *dev, void *res) -{ - struct input_polled_devres *devres = res; - struct input_polled_dev *polldev = devres->polldev; - - dev_dbg(dev, "%s: dropping reference/freeing %s\n", - __func__, dev_name(&polldev->input->dev)); - - input_put_device(polldev->input); - kfree(polldev); -} - -static void devm_input_polldev_unregister(struct device *dev, void *res) -{ - struct input_polled_devres *devres = res; - struct input_polled_dev *polldev = devres->polldev; - - dev_dbg(dev, "%s: unregistering device %s\n", - __func__, dev_name(&polldev->input->dev)); - input_unregister_device(polldev->input); - - /* - * Note that we are still holding extra reference to the input - * device so it will stick around until devm_input_polldev_release() - * is called. - */ -} - -/** - * devm_input_allocate_polled_device - allocate managed polled device - * @dev: device owning the polled device being created - * - * Returns prepared &struct input_polled_dev or %NULL. - * - * Managed polled input devices do not need to be explicitly unregistered - * or freed as it will be done automatically when owner device unbinds - * from * its driver (or binding fails). Once such managed polled device - * is allocated, it is ready to be set up and registered in the same - * fashion as regular polled input devices (using - * input_register_polled_device() function). - * - * If you want to manually unregister and free such managed polled devices, - * it can be still done by calling input_unregister_polled_device() and - * input_free_polled_device(), although it is rarely needed. - * - * NOTE: the owner device is set up as parent of input device and users - * should not override it. - */ -struct input_polled_dev *devm_input_allocate_polled_device(struct device *dev) -{ - struct input_polled_dev *polldev; - struct input_polled_devres *devres; - - devres = devres_alloc(devm_input_polldev_release, sizeof(*devres), - GFP_KERNEL); - if (!devres) - return NULL; - - polldev = input_allocate_polled_device(); - if (!polldev) { - devres_free(devres); - return NULL; - } - - polldev->input->dev.parent = dev; - polldev->devres_managed = true; - - devres->polldev = polldev; - devres_add(dev, devres); - - return polldev; -} -EXPORT_SYMBOL(devm_input_allocate_polled_device); - -/** - * input_free_polled_device - free memory allocated for polled device - * @dev: device to free - * - * The function frees memory allocated for polling device and drops - * reference to the associated input device. - */ -void input_free_polled_device(struct input_polled_dev *dev) -{ - if (dev) { - if (dev->devres_managed) - WARN_ON(devres_destroy(dev->input->dev.parent, - devm_input_polldev_release, - devm_input_polldev_match, - dev)); - input_put_device(dev->input); - kfree(dev); - } -} -EXPORT_SYMBOL(input_free_polled_device); - -/** - * input_register_polled_device - register polled device - * @dev: device to register - * - * The function registers previously initialized polled input device - * with input layer. The device should be allocated with call to - * input_allocate_polled_device(). Callers should also set up poll() - * method and set up capabilities (id, name, phys, bits) of the - * corresponding input_dev structure. - */ -int input_register_polled_device(struct input_polled_dev *dev) -{ - struct input_polled_devres *devres = NULL; - struct input_dev *input = dev->input; - int error; - - if (dev->devres_managed) { - devres = devres_alloc(devm_input_polldev_unregister, - sizeof(*devres), GFP_KERNEL); - if (!devres) - return -ENOMEM; - - devres->polldev = dev; - } - - input_set_drvdata(input, dev); - INIT_DELAYED_WORK(&dev->work, input_polled_device_work); - - if (!dev->poll_interval) - dev->poll_interval = 500; - if (!dev->poll_interval_max) - dev->poll_interval_max = dev->poll_interval; - - input->open = input_open_polled_device; - input->close = input_close_polled_device; - - input->dev.groups = input_polldev_attribute_groups; - - error = input_register_device(input); - if (error) { - devres_free(devres); - return error; - } - - /* - * Take extra reference to the underlying input device so - * that it survives call to input_unregister_polled_device() - * and is deleted only after input_free_polled_device() - * has been invoked. This is needed to ease task of freeing - * sparse keymaps. - */ - input_get_device(input); - - if (dev->devres_managed) { - dev_dbg(input->dev.parent, "%s: registering %s with devres.\n", - __func__, dev_name(&input->dev)); - devres_add(input->dev.parent, devres); - } - - return 0; -} -EXPORT_SYMBOL(input_register_polled_device); - -/** - * input_unregister_polled_device - unregister polled device - * @dev: device to unregister - * - * The function unregisters previously registered polled input - * device from input layer. Polling is stopped and device is - * ready to be freed with call to input_free_polled_device(). - */ -void input_unregister_polled_device(struct input_polled_dev *dev) -{ - if (dev->devres_managed) - WARN_ON(devres_destroy(dev->input->dev.parent, - devm_input_polldev_unregister, - devm_input_polldev_match, - dev)); - - input_unregister_device(dev->input); -} -EXPORT_SYMBOL(input_unregister_polled_device); diff --git a/include/linux/input-polldev.h b/include/linux/input-polldev.h deleted file mode 100644 index 14821fd231c0..000000000000 --- a/include/linux/input-polldev.h +++ /dev/null @@ -1,58 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -#ifndef _INPUT_POLLDEV_H -#define _INPUT_POLLDEV_H - -/* - * Copyright (c) 2007 Dmitry Torokhov - */ - -#include -#include - -/** - * struct input_polled_dev - simple polled input device - * @private: private driver data. - * @open: driver-supplied method that prepares device for polling - * (enabled the device and maybe flushes device state). - * @close: driver-supplied method that is called when device is no - * longer being polled. Used to put device into low power mode. - * @poll: driver-supplied method that polls the device and posts - * input events (mandatory). - * @poll_interval: specifies how often the poll() method should be called. - * Defaults to 500 msec unless overridden when registering the device. - * @poll_interval_max: specifies upper bound for the poll interval. - * Defaults to the initial value of @poll_interval. - * @poll_interval_min: specifies lower bound for the poll interval. - * Defaults to 0. - * @input: input device structure associated with the polled device. - * Must be properly initialized by the driver (id, name, phys, bits). - * - * Polled input device provides a skeleton for supporting simple input - * devices that do not raise interrupts but have to be periodically - * scanned or polled to detect changes in their state. - */ -struct input_polled_dev { - void *private; - - void (*open)(struct input_polled_dev *dev); - void (*close)(struct input_polled_dev *dev); - void (*poll)(struct input_polled_dev *dev); - unsigned int poll_interval; /* msec */ - unsigned int poll_interval_max; /* msec */ - unsigned int poll_interval_min; /* msec */ - - struct input_dev *input; - -/* private: */ - struct delayed_work work; - - bool devres_managed; -}; - -struct input_polled_dev *input_allocate_polled_device(void); -struct input_polled_dev *devm_input_allocate_polled_device(struct device *dev); -void input_free_polled_device(struct input_polled_dev *dev); -int input_register_polled_device(struct input_polled_dev *dev); -void input_unregister_polled_device(struct input_polled_dev *dev); - -#endif -- cgit v1.2.3 From 39be39ceffd572baddfeff8b50aba931d3d6d785 Mon Sep 17 00:00:00 2001 From: Andrzej Pietrasiewicz Date: Sun, 4 Oct 2020 21:15:46 -0700 Subject: Input: add input_device_enabled() A helper function for drivers to decide if the device is used or not. A lockdep check is introduced as inspecting ->users should be done under input device's mutex. Signed-off-by: Andrzej Pietrasiewicz Link: https://lore.kernel.org/r/20200608112211.12125-2-andrzej.p@collabora.com Signed-off-by: Dmitry Torokhov --- drivers/input/input.c | 8 ++++++++ include/linux/input.h | 2 ++ 2 files changed, 10 insertions(+) (limited to 'include') diff --git a/drivers/input/input.c b/drivers/input/input.c index 3cfd2c18eebd..41377bfa142d 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -2127,6 +2127,14 @@ void input_enable_softrepeat(struct input_dev *dev, int delay, int period) } EXPORT_SYMBOL(input_enable_softrepeat); +bool input_device_enabled(struct input_dev *dev) +{ + lockdep_assert_held(&dev->mutex); + + return dev->users > 0; +} +EXPORT_SYMBOL_GPL(input_device_enabled); + /** * input_register_device - register device with input core * @dev: device to be registered diff --git a/include/linux/input.h b/include/linux/input.h index 56f2fd32e609..eda4587dba67 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -502,6 +502,8 @@ bool input_match_device_id(const struct input_dev *dev, void input_enable_softrepeat(struct input_dev *dev, int delay, int period); +bool input_device_enabled(struct input_dev *dev); + extern struct class input_class; /** -- cgit v1.2.3 From a181616487dbdbc953e476d1da15365f887859ed Mon Sep 17 00:00:00 2001 From: Patrik Fimml Date: Wed, 2 Dec 2020 14:42:04 -0800 Subject: Input: Add "inhibited" property Userspace might want to implement a policy to temporarily disregard input from certain devices, including not treating them as wakeup sources. An example use case is a laptop, whose keyboard can be folded under the screen to create tablet-like experience. The user then must hold the laptop in such a way that it is difficult to avoid pressing the keyboard keys. It is therefore desirable to temporarily disregard input from the keyboard, until it is folded back. This obviously is a policy which should be kept out of the kernel, but the kernel must provide suitable means to implement such a policy. This patch adds a sysfs interface for exactly this purpose. To implement the said interface it adds an "inhibited" property to struct input_dev, and effectively creates four states a device can be in: closed uninhibited, closed inhibited, open uninhibited, open inhibited. It also defers calling driver's ->open() and ->close() to until they are actually needed, e.g. it makes no sense to prepare the underlying device for generating events (->open()) if the device is inhibited. uninhibit closed <------------ closed uninhibited ------------> inhibited | ^ inhibit | ^ 1st | | 1st | | open | | open | | | | | | | | last | | last | | close | | close v | uninhibit v | open <------------ open uninhibited ------------> inhibited The top inhibit/uninhibit transition happens when users == 0. The bottom inhibit/uninhibit transition happens when users > 0. The left open/close transition happens when !inhibited. The right open/close transition happens when inhibited. Due to all transitions being serialized with dev->mutex, it is impossible to have "diagonal" transitions between closed uninhibited and open inhibited or between open uninhibited and closed inhibited. No new callbacks are added to drivers, because their open() and close() serve exactly the purpose to tell the driver to start/stop providing events to the input core. Consequently, open() and close() - if provided - are called in both inhibit and uninhibit paths. Signed-off-by: Patrik Fimml Co-developed-by: Andrzej Pietrasiewicz Signed-off-by: Andrzej Pietrasiewicz Link: https://lore.kernel.org/r/20200608112211.12125-8-andrzej.p@collabora.com Signed-off-by: Dmitry Torokhov --- drivers/input/input.c | 112 ++++++++++++++++++++++++++++++++++++++++++++++---- include/linux/input.h | 12 +++++- 2 files changed, 115 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/drivers/input/input.c b/drivers/input/input.c index 41377bfa142d..ccaeb2426385 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -367,8 +367,13 @@ static int input_get_disposition(struct input_dev *dev, static void input_handle_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) { - int disposition = input_get_disposition(dev, type, code, &value); + int disposition; + /* filter-out events from inhibited devices */ + if (dev->inhibited) + return; + + disposition = input_get_disposition(dev, type, code, &value); if (disposition != INPUT_IGNORE_EVENT && type != EV_SYN) add_input_randomness(type, code, value); @@ -612,10 +617,10 @@ int input_open_device(struct input_handle *handle) handle->open++; - if (dev->users++) { + if (dev->users++ || dev->inhibited) { /* - * Device is already opened, so we can exit immediately and - * report success. + * Device is already opened and/or inhibited, + * so we can exit immediately and report success. */ goto out; } @@ -675,10 +680,9 @@ void input_close_device(struct input_handle *handle) __input_release_device(handle); - if (!--dev->users) { + if (!dev->inhibited && !--dev->users) { if (dev->poller) input_dev_poller_stop(dev->poller); - if (dev->close) dev->close(dev); } @@ -1416,12 +1420,49 @@ static ssize_t input_dev_show_properties(struct device *dev, } static DEVICE_ATTR(properties, S_IRUGO, input_dev_show_properties, NULL); +static int input_inhibit_device(struct input_dev *dev); +static int input_uninhibit_device(struct input_dev *dev); + +static ssize_t inhibited_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct input_dev *input_dev = to_input_dev(dev); + + return scnprintf(buf, PAGE_SIZE, "%d\n", input_dev->inhibited); +} + +static ssize_t inhibited_store(struct device *dev, + struct device_attribute *attr, const char *buf, + size_t len) +{ + struct input_dev *input_dev = to_input_dev(dev); + ssize_t rv; + bool inhibited; + + if (strtobool(buf, &inhibited)) + return -EINVAL; + + if (inhibited) + rv = input_inhibit_device(input_dev); + else + rv = input_uninhibit_device(input_dev); + + if (rv != 0) + return rv; + + return len; +} + +static DEVICE_ATTR_RW(inhibited); + static struct attribute *input_dev_attrs[] = { &dev_attr_name.attr, &dev_attr_phys.attr, &dev_attr_uniq.attr, &dev_attr_modalias.attr, &dev_attr_properties.attr, + &dev_attr_inhibited.attr, NULL }; @@ -1703,6 +1744,63 @@ void input_reset_device(struct input_dev *dev) } EXPORT_SYMBOL(input_reset_device); +static int input_inhibit_device(struct input_dev *dev) +{ + int ret = 0; + + mutex_lock(&dev->mutex); + + if (dev->inhibited) + goto out; + + if (dev->users) { + if (dev->close) + dev->close(dev); + if (dev->poller) + input_dev_poller_stop(dev->poller); + } + + spin_lock_irq(&dev->event_lock); + input_dev_release_keys(dev); + input_dev_toggle(dev, false); + spin_unlock_irq(&dev->event_lock); + + dev->inhibited = true; + +out: + mutex_unlock(&dev->mutex); + return ret; +} + +static int input_uninhibit_device(struct input_dev *dev) +{ + int ret = 0; + + mutex_lock(&dev->mutex); + + if (!dev->inhibited) + goto out; + + if (dev->users) { + if (dev->open) { + ret = dev->open(dev); + if (ret) + goto out; + } + if (dev->poller) + input_dev_poller_start(dev->poller); + } + + dev->inhibited = false; + spin_lock_irq(&dev->event_lock); + input_dev_toggle(dev, true); + spin_unlock_irq(&dev->event_lock); + +out: + mutex_unlock(&dev->mutex); + return ret; +} + #ifdef CONFIG_PM_SLEEP static int input_dev_suspend(struct device *dev) { @@ -2131,7 +2229,7 @@ bool input_device_enabled(struct input_dev *dev) { lockdep_assert_held(&dev->mutex); - return dev->users > 0; + return !dev->inhibited && dev->users > 0; } EXPORT_SYMBOL_GPL(input_device_enabled); diff --git a/include/linux/input.h b/include/linux/input.h index eda4587dba67..0354b298d874 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -90,9 +90,11 @@ enum input_clock_type { * @open: this method is called when the very first user calls * input_open_device(). The driver must prepare the device * to start generating events (start polling thread, - * request an IRQ, submit URB, etc.) + * request an IRQ, submit URB, etc.). The meaning of open() is + * to start providing events to the input core. * @close: this method is called when the very last user calls - * input_close_device(). + * input_close_device(). The meaning of close() is to stop + * providing events to the input core. * @flush: purges the device. Most commonly used to get rid of force * feedback effects loaded into the device when disconnecting * from it @@ -127,6 +129,10 @@ enum input_clock_type { * and needs not be explicitly unregistered or freed. * @timestamp: storage for a timestamp set by input_set_timestamp called * by a driver + * @inhibited: indicates that the input device is inhibited. If that is + * the case then input core ignores any events generated by the device. + * Device's close() is called when it is being inhibited and its open() + * is called when it is being uninhibited. */ struct input_dev { const char *name; @@ -201,6 +207,8 @@ struct input_dev { bool devres_managed; ktime_t timestamp[INPUT_CLK_MAX]; + + bool inhibited; }; #define to_input_dev(d) container_of(d, struct input_dev, dev) -- cgit v1.2.3