From b13fecb1c3a603c4b8e99b306fecf4f668c11b32 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Mon, 13 Jul 2020 15:01:26 -0700 Subject: treewide: Replace DECLARE_TASKLET() with DECLARE_TASKLET_OLD() This converts all the existing DECLARE_TASKLET() (and ...DISABLED) macros with DECLARE_TASKLET_OLD() in preparation for refactoring the tasklet callback type. All existing DECLARE_TASKLET() users had a "0" data argument, it has been removed here as well. Reviewed-by: Greg Kroah-Hartman Acked-by: Thomas Gleixner Signed-off-by: Kees Cook --- drivers/input/keyboard/omap-keypad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input/keyboard') diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c index 5fe7a5633e33..dbe836c7ff47 100644 --- a/drivers/input/keyboard/omap-keypad.c +++ b/drivers/input/keyboard/omap-keypad.c @@ -46,7 +46,7 @@ struct omap_kp { unsigned short keymap[]; }; -static DECLARE_TASKLET_DISABLED(kp_tasklet, omap_kp_tasklet, 0); +static DECLARE_TASKLET_DISABLED_OLD(kp_tasklet, omap_kp_tasklet); static unsigned int *row_gpios; static unsigned int *col_gpios; -- cgit v1.2.3-59-g8ed1b From 5b27585a8524cbb1c720502d3014a5fb85951ab9 Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Sun, 8 Nov 2020 22:17:31 -0800 Subject: Input: nomadik-ske-keypad - provide some missing struct member docs Fixes the following W=1 kernel build warning(s): drivers/input/keyboard/nomadik-ske-keypad.c:71: warning: Function parameter or member 'pclk' not described in 'ske_keypad' drivers/input/keyboard/nomadik-ske-keypad.c:71: warning: Function parameter or member 'ske_keypad_lock' not described in 'ske_keypad' Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20201104162427.2984742-20-lee.jones@linaro.org Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/nomadik-ske-keypad.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/input/keyboard') diff --git a/drivers/input/keyboard/nomadik-ske-keypad.c b/drivers/input/keyboard/nomadik-ske-keypad.c index 608446e14614..0d55a95347f1 100644 --- a/drivers/input/keyboard/nomadik-ske-keypad.c +++ b/drivers/input/keyboard/nomadik-ske-keypad.c @@ -58,6 +58,8 @@ * @board: keypad platform device * @keymap: matrix scan code table for keycodes * @clk: clock structure pointer + * @pclk: clock structure pointer + * @ske_keypad_lock: spinlock protecting the keypad read/writes */ struct ske_keypad { int irq; -- cgit v1.2.3-59-g8ed1b From 55be5087a8ab1f8a6bc225b507c924e43199774e Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Sun, 8 Nov 2020 22:19:07 -0800 Subject: Input: pmic8xxx-keypad - fix kernel-doc formatting Fixes the following W=1 kernel build warning(s): drivers/input/keyboard/pmic8xxx-keypad.c:106: warning: Function parameter or member 'num_rows' not described in 'pmic8xxx_kp' drivers/input/keyboard/pmic8xxx-keypad.c:106: warning: Function parameter or member 'num_cols' not described in 'pmic8xxx_kp' drivers/input/keyboard/pmic8xxx-keypad.c:106: warning: Function parameter or member 'input' not described in 'pmic8xxx_kp' drivers/input/keyboard/pmic8xxx-keypad.c:106: warning: Function parameter or member 'regmap' not described in 'pmic8xxx_kp' drivers/input/keyboard/pmic8xxx-keypad.c:106: warning: Function parameter or member 'key_sense_irq' not described in 'pmic8xxx_kp' drivers/input/keyboard/pmic8xxx-keypad.c:106: warning: Function parameter or member 'key_stuck_irq' not described in 'pmic8xxx_kp' drivers/input/keyboard/pmic8xxx-keypad.c:106: warning: Function parameter or member 'keycodes' not described in 'pmic8xxx_kp' drivers/input/keyboard/pmic8xxx-keypad.c:106: warning: Function parameter or member 'dev' not described in 'pmic8xxx_kp' drivers/input/keyboard/pmic8xxx-keypad.c:106: warning: Function parameter or member 'keystate' not described in 'pmic8xxx_kp' drivers/input/keyboard/pmic8xxx-keypad.c:106: warning: Function parameter or member 'stuckstate' not described in 'pmic8xxx_kp' drivers/input/keyboard/pmic8xxx-keypad.c:106: warning: Function parameter or member 'ctrl_reg' not described in 'pmic8xxx_kp' Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20201104162427.2984742-21-lee.jones@linaro.org Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/pmic8xxx-keypad.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'drivers/input/keyboard') diff --git a/drivers/input/keyboard/pmic8xxx-keypad.c b/drivers/input/keyboard/pmic8xxx-keypad.c index 91d5811d6f0e..36bee6f5a8af 100644 --- a/drivers/input/keyboard/pmic8xxx-keypad.c +++ b/drivers/input/keyboard/pmic8xxx-keypad.c @@ -76,17 +76,17 @@ /** * struct pmic8xxx_kp - internal keypad data structure - * @num_cols - number of columns of keypad - * @num_rows - number of row of keypad - * @input - input device pointer for keypad - * @regmap - regmap handle - * @key_sense_irq - key press/release irq number - * @key_stuck_irq - key stuck notification irq number - * @keycodes - array to hold the key codes - * @dev - parent device pointer - * @keystate - present key press/release state - * @stuckstate - present state when key stuck irq - * @ctrl_reg - control register value + * @num_cols: number of columns of keypad + * @num_rows: number of row of keypad + * @input: input device pointer for keypad + * @regmap: regmap handle + * @key_sense_irq: key press/release irq number + * @key_stuck_irq: key stuck notification irq number + * @keycodes: array to hold the key codes + * @dev: parent device pointer + * @keystate: present key press/release state + * @stuckstate: present state when key stuck irq + * @ctrl_reg: control register value */ struct pmic8xxx_kp { unsigned int num_rows; -- cgit v1.2.3-59-g8ed1b From 2216c0e414c6596b03a354b5c08ba98af4cbef85 Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Sun, 8 Nov 2020 22:08:01 -0800 Subject: Input: gpio_keys - fix misnamed function parameter 'dev' Fixes the following W=1 kernel build warning(s): drivers/input/keyboard/gpio_keys.c:119: warning: Function parameter or member 'dev' not described in 'get_bm_events_by_type' drivers/input/keyboard/gpio_keys.c:119: warning: Excess function parameter 'input' description in 'get_bm_events_by_type' Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20201104162427.2984742-12-lee.jones@linaro.org Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/gpio_keys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input/keyboard') diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index f2d4e4daa818..a079504e98e8 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -108,7 +108,7 @@ static int get_n_events_by_type(int type) /** * get_bm_events_by_type() - returns bitmap of supported events per @type - * @input: input device from which bitmap is retrieved + * @dev: input device from which bitmap is retrieved * @type: type of button (%EV_KEY, %EV_SW) * * Return value of this function can be used to allocate bitmap -- cgit v1.2.3-59-g8ed1b From e0d80b647c12d5deb163365005742739745960cf Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Wed, 4 Nov 2020 14:51:52 -0800 Subject: Input: cros_ec_keyb - struct headers should start with 'struct ' Fixes the following W=1 kernel build warning(s): drivers/input/keyboard/cros_ec_keyb.c:72: warning: cannot understand function prototype: 'struct cros_ec_bs_map ' Signed-off-by: Lee Jones Reviewed-by: Benson Leung Link: https://lore.kernel.org/r/20201104162427.2984742-8-lee.jones@linaro.org [dtor: fixed up docbook comments for cros_ec_keyb structure as well] Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/cros_ec_keyb.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'drivers/input/keyboard') diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c index fc1793ca2f17..023f083dadd3 100644 --- a/drivers/input/keyboard/cros_ec_keyb.c +++ b/drivers/input/keyboard/cros_ec_keyb.c @@ -27,7 +27,9 @@ #include -/* +/** + * struct cros_ec_keyb - Structure representing EC keyboard device + * * @rows: Number of rows in the keypad * @cols: Number of columns in the keypad * @row_shift: log2 or number of rows, rounded up @@ -58,10 +60,9 @@ struct cros_ec_keyb { struct notifier_block notifier; }; - /** - * cros_ec_bs_map - Struct mapping Linux keycodes to EC button/switch bitmap - * #defines + * struct cros_ec_bs_map - Mapping between Linux keycodes and EC button/switch + * bitmap #defines * * @ev_type: The type of the input event to generate (e.g., EV_KEY). * @code: A linux keycode -- cgit v1.2.3-59-g8ed1b From f1556986babffb0dd75970cd7a0563e3e1ee387a Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Thu, 12 Nov 2020 23:27:03 -0800 Subject: Input: samsung-keypad - remove set but unused variable 'var' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes the following W=1 kernel build warning(s): drivers/input/keyboard/samsung-keypad.c: In function ‘samsung_keypad_irq’: drivers/input/keyboard/samsung-keypad.c:149:15: warning: variable ‘val’ set but not used [-Wunused-but-set-variable] Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20201112110204.2083435-3-lee.jones@linaro.org Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/samsung-keypad.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/input/keyboard') diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c index 70c1d086bdd2..1ed939d9798c 100644 --- a/drivers/input/keyboard/samsung-keypad.c +++ b/drivers/input/keyboard/samsung-keypad.c @@ -146,13 +146,12 @@ static irqreturn_t samsung_keypad_irq(int irq, void *dev_id) { struct samsung_keypad *keypad = dev_id; unsigned int row_state[SAMSUNG_MAX_COLS]; - unsigned int val; bool key_down; pm_runtime_get_sync(&keypad->pdev->dev); do { - val = readl(keypad->base + SAMSUNG_KEYIFSTSCLR); + readl(keypad->base + SAMSUNG_KEYIFSTSCLR); /* Clear interrupt. */ writel(~0x0, keypad->base + SAMSUNG_KEYIFSTSCLR); -- cgit v1.2.3-59-g8ed1b From 41d7d26b8fb26e7e8056c1a3b6cf358d40cb367a Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Wed, 18 Nov 2020 22:40:22 -0800 Subject: Input: adp5589-keys - use devm_kzalloc() to allocate the kpad object This removes the need to manually free the kpad object and cleans up some exit/error paths. The error path cleanup should reduce the risk of any memory leaks with this object. Signed-off-by: Alexandru Ardelean Link: https://lore.kernel.org/r/20201112074308.71351-2-alexandru.ardelean@analog.com Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/adp5589-keys.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'drivers/input/keyboard') diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c index eb0e9cd66bcb..922497b65ab0 100644 --- a/drivers/input/keyboard/adp5589-keys.c +++ b/drivers/input/keyboard/adp5589-keys.c @@ -1007,7 +1007,7 @@ static int adp5589_probe(struct i2c_client *client, return -EINVAL; } - kpad = kzalloc(sizeof(*kpad), GFP_KERNEL); + kpad = devm_kzalloc(&client->dev, sizeof(*kpad), GFP_KERNEL); if (!kpad) return -ENOMEM; @@ -1028,17 +1028,15 @@ static int adp5589_probe(struct i2c_client *client, } ret = adp5589_read(client, ADP5589_5_ID); - if (ret < 0) { - error = ret; - goto err_free_mem; - } + if (ret < 0) + return ret; revid = (u8) ret & ADP5589_5_DEVICE_ID_MASK; if (pdata->keymapsize) { error = adp5589_keypad_add(kpad, revid); if (error) - goto err_free_mem; + return error; } error = adp5589_setup(kpad); @@ -1059,8 +1057,6 @@ static int adp5589_probe(struct i2c_client *client, err_keypad_remove: adp5589_keypad_remove(kpad); -err_free_mem: - kfree(kpad); return error; } @@ -1072,7 +1068,6 @@ static int adp5589_remove(struct i2c_client *client) adp5589_write(client, kpad->var->reg(ADP5589_GENERAL_CFG), 0); adp5589_keypad_remove(kpad); adp5589_gpio_remove(kpad); - kfree(kpad); return 0; } -- cgit v1.2.3-59-g8ed1b From 760a1219ff264c4bb68ae561bf4d5eea5daac8dc Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Wed, 18 Nov 2020 22:41:46 -0800 Subject: Input: adp5589-keys - use device-managed function in adp5589_keypad_add() This change makes use of the devm_input_allocate_device() function, which gets rid of the input_free_device() and input_unregister_device() calls. When a device is allocated via input_allocate_device(), the input_register_device() call will also be device-managed, so there is no longer need to manually call unregister. Also, the irq is allocated with the devm_request_threaded_irq(), so with these two changes, the adp5589_keypad_remove() function is no longer needed. This cleans up the error & exit paths. Signed-off-by: Alexandru Ardelean Link: https://lore.kernel.org/r/20201112074308.71351-3-alexandru.ardelean@analog.com Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/adp5589-keys.c | 41 +++++++++-------------------------- 1 file changed, 10 insertions(+), 31 deletions(-) (limited to 'drivers/input/keyboard') diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c index 922497b65ab0..0e2ad9628ba9 100644 --- a/drivers/input/keyboard/adp5589-keys.c +++ b/drivers/input/keyboard/adp5589-keys.c @@ -909,7 +909,7 @@ static int adp5589_keypad_add(struct adp5589_kpad *kpad, unsigned int revid) return -EINVAL; } - input = input_allocate_device(); + input = devm_input_allocate_device(&client->dev); if (!input) return -ENOMEM; @@ -955,36 +955,21 @@ static int adp5589_keypad_add(struct adp5589_kpad *kpad, unsigned int revid) error = input_register_device(input); if (error) { dev_err(&client->dev, "unable to register input device\n"); - goto err_free_input; + return error; } - error = request_threaded_irq(client->irq, NULL, adp5589_irq, - IRQF_TRIGGER_FALLING | IRQF_ONESHOT, - client->dev.driver->name, kpad); + error = devm_request_threaded_irq(&client->dev, client->irq, + NULL, adp5589_irq, + IRQF_TRIGGER_FALLING | IRQF_ONESHOT, + client->dev.driver->name, kpad); if (error) { - dev_err(&client->dev, "irq %d busy?\n", client->irq); - goto err_unreg_dev; + dev_err(&client->dev, "unable to request irq %d\n", client->irq); + return error; } device_init_wakeup(&client->dev, 1); return 0; - -err_unreg_dev: - input_unregister_device(input); - input = NULL; -err_free_input: - input_free_device(input); - - return error; -} - -static void adp5589_keypad_remove(struct adp5589_kpad *kpad) -{ - if (kpad->input) { - free_irq(kpad->client->irq, kpad); - input_unregister_device(kpad->input); - } } static int adp5589_probe(struct i2c_client *client, @@ -1041,24 +1026,19 @@ static int adp5589_probe(struct i2c_client *client, error = adp5589_setup(kpad); if (error) - goto err_keypad_remove; + return error; if (kpad->gpimapsize) adp5589_report_switch_state(kpad); error = adp5589_gpio_add(kpad); if (error) - goto err_keypad_remove; + return error; i2c_set_clientdata(client, kpad); dev_info(&client->dev, "Rev.%d keypad, irq %d\n", revid, client->irq); return 0; - -err_keypad_remove: - adp5589_keypad_remove(kpad); - - return error; } static int adp5589_remove(struct i2c_client *client) @@ -1066,7 +1046,6 @@ static int adp5589_remove(struct i2c_client *client) struct adp5589_kpad *kpad = i2c_get_clientdata(client); adp5589_write(client, kpad->var->reg(ADP5589_GENERAL_CFG), 0); - adp5589_keypad_remove(kpad); adp5589_gpio_remove(kpad); return 0; -- cgit v1.2.3-59-g8ed1b 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 --- drivers/input/keyboard/adp5589-keys.c | 21 --------------------- include/linux/input/adp5589.h | 7 ------- 2 files changed, 28 deletions(-) (limited to 'drivers/input/keyboard') diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c index 0e2ad9628ba9..4008cd3be18e 100644 --- a/drivers/input/keyboard/adp5589-keys.c +++ b/drivers/input/keyboard/adp5589-keys.c @@ -539,35 +539,14 @@ static int adp5589_gpio_add(struct adp5589_kpad *kpad) ADP5589_GPIO_DIRECTION_A) + i); } - if (gpio_data->setup) { - error = gpio_data->setup(kpad->client, - kpad->gc.base, kpad->gc.ngpio, - gpio_data->context); - if (error) - dev_warn(dev, "setup failed, %d\n", error); - } - return 0; } static void adp5589_gpio_remove(struct adp5589_kpad *kpad) { - struct device *dev = &kpad->client->dev; - const struct adp5589_kpad_platform_data *pdata = dev_get_platdata(dev); - const struct adp5589_gpio_platform_data *gpio_data = pdata->gpio_data; - int error; - if (!kpad->export_gpio) return; - if (gpio_data->teardown) { - error = gpio_data->teardown(kpad->client, - kpad->gc.base, kpad->gc.ngpio, - gpio_data->context); - if (error) - dev_warn(dev, "teardown failed %d\n", error); - } - gpiochip_remove(&kpad->gc); } #else 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-59-g8ed1b From 74f2c59324a3cb0e69937c2289a13f36231a6f3e Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Wed, 18 Nov 2020 22:50:02 -0800 Subject: Input: adp5589-keys - use devm_gpiochip_add_data() for gpios This change makes use of the devm_gpiochip_add_data() function. With this the gpiochip_remove() function can be removed, and the adp5589_gpio_remove() function as well. The kpad->export_gpio variable is also redundant now, and has been removed. Signed-off-by: Alexandru Ardelean Link: https://lore.kernel.org/r/20201112074308.71351-5-alexandru.ardelean@analog.com Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/adp5589-keys.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'drivers/input/keyboard') diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c index 4008cd3be18e..81d9525245d2 100644 --- a/drivers/input/keyboard/adp5589-keys.c +++ b/drivers/input/keyboard/adp5589-keys.c @@ -238,7 +238,6 @@ struct adp5589_kpad { bool support_row5; #ifdef CONFIG_GPIOLIB unsigned char gpiomap[ADP5589_MAXGPIO]; - bool export_gpio; struct gpio_chip gc; struct mutex gpio_lock; /* Protect cached dir, dat_out */ u8 dat_out[3]; @@ -512,8 +511,6 @@ static int adp5589_gpio_add(struct adp5589_kpad *kpad) return 0; } - kpad->export_gpio = true; - kpad->gc.direction_input = adp5589_gpio_direction_input; kpad->gc.direction_output = adp5589_gpio_direction_output; kpad->gc.get = adp5589_gpio_get_value; @@ -526,11 +523,9 @@ static int adp5589_gpio_add(struct adp5589_kpad *kpad) mutex_init(&kpad->gpio_lock); - error = gpiochip_add_data(&kpad->gc, kpad); - if (error) { - dev_err(dev, "gpiochip_add_data() failed, err: %d\n", error); + error = devm_gpiochip_add_data(dev, &kpad->gc, kpad); + if (error) return error; - } for (i = 0; i <= kpad->var->bank(kpad->var->maxgpio); i++) { kpad->dat_out[i] = adp5589_read(kpad->client, kpad->var->reg( @@ -541,23 +536,11 @@ static int adp5589_gpio_add(struct adp5589_kpad *kpad) return 0; } - -static void adp5589_gpio_remove(struct adp5589_kpad *kpad) -{ - if (!kpad->export_gpio) - return; - - gpiochip_remove(&kpad->gc); -} #else static inline int adp5589_gpio_add(struct adp5589_kpad *kpad) { return 0; } - -static inline void adp5589_gpio_remove(struct adp5589_kpad *kpad) -{ -} #endif static void adp5589_report_switches(struct adp5589_kpad *kpad, @@ -1025,7 +1008,6 @@ static int adp5589_remove(struct i2c_client *client) struct adp5589_kpad *kpad = i2c_get_clientdata(client); adp5589_write(client, kpad->var->reg(ADP5589_GENERAL_CFG), 0); - adp5589_gpio_remove(kpad); return 0; } -- cgit v1.2.3-59-g8ed1b From 30df385e35a48f773b85117fc490152c2395e45b Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Wed, 18 Nov 2020 22:55:39 -0800 Subject: Input: adp5589-keys - use devm_add_action_or_reset() for register clear The driver clears the general configuration register during the remove() hook. This should also be done in case the driver exits on error. This change move the clear of that register to the devm_add_action_or_reset() hook. Signed-off-by: Alexandru Ardelean Link: https://lore.kernel.org/r/20201112074308.71351-6-alexandru.ardelean@analog.com Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/adp5589-keys.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'drivers/input/keyboard') diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c index 81d9525245d2..31145a85c819 100644 --- a/drivers/input/keyboard/adp5589-keys.c +++ b/drivers/input/keyboard/adp5589-keys.c @@ -934,6 +934,14 @@ static int adp5589_keypad_add(struct adp5589_kpad *kpad, unsigned int revid) return 0; } +static void adp5589_clear_config(void *data) +{ + struct i2c_client *client = data; + struct adp5589_kpad *kpad = i2c_get_clientdata(client); + + adp5589_write(client, kpad->var->reg(ADP5589_GENERAL_CFG), 0); +} + static int adp5589_probe(struct i2c_client *client, const struct i2c_device_id *id) { @@ -974,6 +982,11 @@ static int adp5589_probe(struct i2c_client *client, break; } + error = devm_add_action_or_reset(&client->dev, adp5589_clear_config, + client); + if (error) + return error; + ret = adp5589_read(client, ADP5589_5_ID); if (ret < 0) return ret; @@ -1003,15 +1016,6 @@ static int adp5589_probe(struct i2c_client *client, return 0; } -static int adp5589_remove(struct i2c_client *client) -{ - struct adp5589_kpad *kpad = i2c_get_clientdata(client); - - adp5589_write(client, kpad->var->reg(ADP5589_GENERAL_CFG), 0); - - return 0; -} - #ifdef CONFIG_PM_SLEEP static int adp5589_suspend(struct device *dev) { @@ -1063,7 +1067,6 @@ static struct i2c_driver adp5589_driver = { .pm = &adp5589_dev_pm_ops, }, .probe = adp5589_probe, - .remove = adp5589_remove, .id_table = adp5589_id, }; -- cgit v1.2.3-59-g8ed1b From a26506788320d8dda4e3520dd1b020f20cc7a2fd Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Thu, 19 Nov 2020 10:10:58 -0800 Subject: Input: adp5589-keys - mark suspend and resume methods as __maybe_unused This improves compile coverage of the code; unused code will be dropped by the linker. Acked-by: Alexandru Ardelean Link: https://lore.kernel.org/r/20201119072418.GA114677@dtor-ws Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/adp5589-keys.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/input/keyboard') diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c index 31145a85c819..a9b69a268c09 100644 --- a/drivers/input/keyboard/adp5589-keys.c +++ b/drivers/input/keyboard/adp5589-keys.c @@ -1016,8 +1016,7 @@ static int adp5589_probe(struct i2c_client *client, return 0; } -#ifdef CONFIG_PM_SLEEP -static int adp5589_suspend(struct device *dev) +static int __maybe_unused adp5589_suspend(struct device *dev) { struct adp5589_kpad *kpad = dev_get_drvdata(dev); struct i2c_client *client = kpad->client; @@ -1033,7 +1032,7 @@ static int adp5589_suspend(struct device *dev) return 0; } -static int adp5589_resume(struct device *dev) +static int __maybe_unused adp5589_resume(struct device *dev) { struct adp5589_kpad *kpad = dev_get_drvdata(dev); struct i2c_client *client = kpad->client; @@ -1048,7 +1047,6 @@ static int adp5589_resume(struct device *dev) return 0; } -#endif static SIMPLE_DEV_PM_OPS(adp5589_dev_pm_ops, adp5589_suspend, adp5589_resume); -- cgit v1.2.3-59-g8ed1b From 478a57072a4c4fafd83e10c329c9c8ad5c0ff97b Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Thu, 19 Nov 2020 10:11:22 -0800 Subject: Input: adp5589-keys - use BIT() Let's use BIT() macro instead of explicitly shifting '1'. Acked-by: Alexandru Ardelean Link: https://lore.kernel.org/r/20201119072440.GA116840@dtor-ws Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/adp5589-keys.c | 69 ++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 34 deletions(-) (limited to 'drivers/input/keyboard') diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c index a9b69a268c09..e2cdf14d90cd 100644 --- a/drivers/input/keyboard/adp5589-keys.c +++ b/drivers/input/keyboard/adp5589-keys.c @@ -7,6 +7,7 @@ * Copyright (C) 2010-2011 Analog Devices Inc. */ +#include #include #include #include @@ -153,48 +154,48 @@ #define ADP5589_5_MAN_ID 0x02 /* GENERAL_CFG Register */ -#define OSC_EN (1 << 7) +#define OSC_EN BIT(7) #define CORE_CLK(x) (((x) & 0x3) << 5) -#define LCK_TRK_LOGIC (1 << 4) /* ADP5589 only */ -#define LCK_TRK_GPI (1 << 3) /* ADP5589 only */ -#define INT_CFG (1 << 1) -#define RST_CFG (1 << 0) +#define LCK_TRK_LOGIC BIT(4) /* ADP5589 only */ +#define LCK_TRK_GPI BIT(3) /* ADP5589 only */ +#define INT_CFG BIT(1) +#define RST_CFG BIT(0) /* INT_EN Register */ -#define LOGIC2_IEN (1 << 5) /* ADP5589 only */ -#define LOGIC1_IEN (1 << 4) -#define LOCK_IEN (1 << 3) /* ADP5589 only */ -#define OVRFLOW_IEN (1 << 2) -#define GPI_IEN (1 << 1) -#define EVENT_IEN (1 << 0) +#define LOGIC2_IEN BIT(5) /* ADP5589 only */ +#define LOGIC1_IEN BIT(4) +#define LOCK_IEN BIT(3) /* ADP5589 only */ +#define OVRFLOW_IEN BIT(2) +#define GPI_IEN BIT(1) +#define EVENT_IEN BIT(0) /* Interrupt Status Register */ -#define LOGIC2_INT (1 << 5) /* ADP5589 only */ -#define LOGIC1_INT (1 << 4) -#define LOCK_INT (1 << 3) /* ADP5589 only */ -#define OVRFLOW_INT (1 << 2) -#define GPI_INT (1 << 1) -#define EVENT_INT (1 << 0) +#define LOGIC2_INT BIT(5) /* ADP5589 only */ +#define LOGIC1_INT BIT(4) +#define LOCK_INT BIT(3) /* ADP5589 only */ +#define OVRFLOW_INT BIT(2) +#define GPI_INT BIT(1) +#define EVENT_INT BIT(0) /* STATUS Register */ -#define LOGIC2_STAT (1 << 7) /* ADP5589 only */ -#define LOGIC1_STAT (1 << 6) -#define LOCK_STAT (1 << 5) /* ADP5589 only */ +#define LOGIC2_STAT BIT(7) /* ADP5589 only */ +#define LOGIC1_STAT BIT(6) +#define LOCK_STAT BIT(5) /* ADP5589 only */ #define KEC 0x1F /* PIN_CONFIG_D Register */ -#define C4_EXTEND_CFG (1 << 6) /* RESET2 */ -#define R4_EXTEND_CFG (1 << 5) /* RESET1 */ +#define C4_EXTEND_CFG BIT(6) /* RESET2 */ +#define R4_EXTEND_CFG BIT(5) /* RESET1 */ /* LOCK_CFG */ -#define LOCK_EN (1 << 0) +#define LOCK_EN BIT(0) #define PTIME_MASK 0x3 #define LTIME_MASK 0x3 /* ADP5589 only */ /* Key Event Register xy */ -#define KEY_EV_PRESSED (1 << 7) -#define KEY_EV_MASK (0x7F) +#define KEY_EV_PRESSED BIT(7) +#define KEY_EV_MASK 0x7F #define KEYP_MAX_EVENT 16 #define ADP5589_MAXGPIO 19 @@ -472,7 +473,7 @@ static int adp5589_build_gpiomap(struct adp5589_kpad *kpad, memset(pin_used, false, sizeof(pin_used)); for (i = 0; i < kpad->var->maxgpio; i++) - if (pdata->keypad_en_mask & (1 << i)) + if (pdata->keypad_en_mask & BIT(i)) pin_used[i] = true; for (i = 0; i < kpad->gpimapsize; i++) @@ -651,13 +652,13 @@ static int adp5589_setup(struct adp5589_kpad *kpad) unsigned short pin = pdata->gpimap[i].pin; if (pin <= kpad->var->gpi_pin_row_end) { - evt_mode1 |= (1 << (pin - kpad->var->gpi_pin_row_base)); + evt_mode1 |= BIT(pin - kpad->var->gpi_pin_row_base); } else { evt_mode2 |= - ((1 << (pin - kpad->var->gpi_pin_col_base)) & 0xFF); + BIT(pin - kpad->var->gpi_pin_col_base) & 0xFF; if (!kpad->is_adp5585) - evt_mode3 |= ((1 << (pin - - kpad->var->gpi_pin_col_base)) >> 8); + evt_mode3 |= + BIT(pin - kpad->var->gpi_pin_col_base) >> 8; } } @@ -677,7 +678,7 @@ static int adp5589_setup(struct adp5589_kpad *kpad) dev_warn(&client->dev, "Conflicting pull resistor config\n"); for (i = 0; i <= kpad->var->max_row_num; i++) { - unsigned val = 0, bit = (1 << i); + unsigned int val = 0, bit = BIT(i); if (pdata->pullup_en_300k & bit) val = 0; else if (pdata->pulldown_en_300k & bit) @@ -697,7 +698,7 @@ static int adp5589_setup(struct adp5589_kpad *kpad) } for (i = 0; i <= kpad->var->max_col_num; i++) { - unsigned val = 0, bit = 1 << (i + kpad->var->col_shift); + unsigned int val = 0, bit = BIT(i + kpad->var->col_shift); if (pdata->pullup_en_300k & bit) val = 0; else if (pdata->pulldown_en_300k & bit) @@ -813,7 +814,7 @@ static void adp5589_report_switch_state(struct adp5589_kpad *kpad) input_report_switch(kpad->input, kpad->gpimap[i].sw_evt, - !(gpi_stat_tmp & (1 << pin_loc))); + !(gpi_stat_tmp & BIT(pin_loc))); } input_sync(kpad->input); @@ -859,7 +860,7 @@ static int adp5589_keypad_add(struct adp5589_kpad *kpad, unsigned int revid) return -EINVAL; } - if ((1 << (pin - kpad->var->gpi_pin_row_base)) & + if (BIT(pin - kpad->var->gpi_pin_row_base) & pdata->keypad_en_mask) { dev_err(&client->dev, "invalid gpi row/col data\n"); return -EINVAL; -- cgit v1.2.3-59-g8ed1b From 39f4879e99a42d3ebcf9876bf4201d95679445d3 Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Thu, 19 Nov 2020 19:20:09 -0800 Subject: Input: applespi - provide missing struct 'message' descriptions Fixes the following W=1 kernel build warning(s): drivers/input/keyboard/applespi.c:306: warning: Function parameter or member 'keyboard' not described in 'message' drivers/input/keyboard/applespi.c:306: warning: Function parameter or member 'touchpad' not described in 'message' drivers/input/keyboard/applespi.c:306: warning: Function parameter or member 'tp_info' not described in 'message' drivers/input/keyboard/applespi.c:306: warning: Function parameter or member 'tp_info_command' not described in 'message' drivers/input/keyboard/applespi.c:306: warning: Function parameter or member 'init_mt_command' not described in 'message' drivers/input/keyboard/applespi.c:306: warning: Function parameter or member 'capsl_command' not described in 'message' drivers/input/keyboard/applespi.c:306: warning: Function parameter or member 'bl_command' not described in 'message' drivers/input/keyboard/applespi.c:306: warning: Function parameter or member 'data' not described in 'message' Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20201112110204.2083435-15-lee.jones@linaro.org Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/applespi.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'drivers/input/keyboard') diff --git a/drivers/input/keyboard/applespi.c b/drivers/input/keyboard/applespi.c index 14362ebab9a9..8053a3d2ff63 100644 --- a/drivers/input/keyboard/applespi.c +++ b/drivers/input/keyboard/applespi.c @@ -286,6 +286,15 @@ struct command_protocol_bl { * structure (after re-assembly in case of being split over * multiple spi-packets), minus the trailing crc. The total size * of the message struct is therefore @length + 10. + * + * @keyboard: Keyboard message + * @touchpad: Touchpad message + * @tp_info: Touchpad info (response) + * @tp_info_command: Touchpad info (CRC) + * @init_mt_command: Initialise Multitouch + * @capsl_command: Toggle caps-lock LED + * @bl_command: Keyboard brightness + * @data: Buffer data */ struct message { __le16 type; -- cgit v1.2.3-59-g8ed1b From 59bbf83835f591b95c3bdd09d900f3584fa227af Mon Sep 17 00:00:00 2001 From: Zhang Qilong Date: Fri, 20 Nov 2020 16:36:49 -0800 Subject: Input: omap4-keypad - fix runtime PM error handling In omap4_keypad_probe, the patch fix several bugs. 1) pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to pm_runtime_put_noidle will result in reference leak. 2) In err_unmap, forget to disable runtime of device, pm_runtime_enable will increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced. 3) In err_pm_disable, it will call pm_runtime_put_sync twice not one time. To fix this we factor out code reading revision and disabling touchpad, and drop PM reference once we are done talking to the device. Fixes: f77621cc640a7 ("Input: omap-keypad - dynamically handle register offsets") Fixes: 5ad567ffbaf20 ("Input: omap4-keypad - wire up runtime PM handling") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20201120133918.2559681-1-zhangqilong3@huawei.com Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/omap4-keypad.c | 89 +++++++++++++++++++++-------------- 1 file changed, 53 insertions(+), 36 deletions(-) (limited to 'drivers/input/keyboard') diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c index d6c924032aaa..dd16f7b3c7ef 100644 --- a/drivers/input/keyboard/omap4-keypad.c +++ b/drivers/input/keyboard/omap4-keypad.c @@ -186,12 +186,8 @@ static int omap4_keypad_open(struct input_dev *input) return 0; } -static void omap4_keypad_close(struct input_dev *input) +static void omap4_keypad_stop(struct omap4_keypad *keypad_data) { - struct omap4_keypad *keypad_data = input_get_drvdata(input); - - disable_irq(keypad_data->irq); - /* Disable interrupts and wake-up events */ kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE, OMAP4_VAL_IRQDISABLE); @@ -200,7 +196,15 @@ static void omap4_keypad_close(struct input_dev *input) /* clear pending interrupts */ kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS, kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS)); +} + +static void omap4_keypad_close(struct input_dev *input) +{ + struct omap4_keypad *keypad_data; + keypad_data = input_get_drvdata(input); + disable_irq(keypad_data->irq); + omap4_keypad_stop(keypad_data); enable_irq(keypad_data->irq); pm_runtime_put_sync(input->dev.parent); @@ -223,13 +227,37 @@ static int omap4_keypad_parse_dt(struct device *dev, return 0; } +static int omap4_keypad_check_revision(struct device *dev, + struct omap4_keypad *keypad_data) +{ + unsigned int rev; + + rev = __raw_readl(keypad_data->base + OMAP4_KBD_REVISION); + rev &= 0x03 << 30; + rev >>= 30; + switch (rev) { + case KBD_REVISION_OMAP4: + keypad_data->reg_offset = 0x00; + keypad_data->irqreg_offset = 0x00; + break; + case KBD_REVISION_OMAP5: + keypad_data->reg_offset = 0x10; + keypad_data->irqreg_offset = 0x0c; + break; + default: + dev_err(dev, "Keypad reports unsupported revision %d", rev); + return -EINVAL; + } + + return 0; +} + static int omap4_keypad_probe(struct platform_device *pdev) { struct omap4_keypad *keypad_data; struct input_dev *input_dev; struct resource *res; unsigned int max_keys; - int rev; int irq; int error; @@ -269,41 +297,33 @@ static int omap4_keypad_probe(struct platform_device *pdev) goto err_release_mem; } + pm_runtime_enable(&pdev->dev); /* * Enable clocks for the keypad module so that we can read * revision register. */ - pm_runtime_enable(&pdev->dev); error = pm_runtime_get_sync(&pdev->dev); if (error) { dev_err(&pdev->dev, "pm_runtime_get_sync() failed\n"); - goto err_unmap; - } - rev = __raw_readl(keypad_data->base + OMAP4_KBD_REVISION); - rev &= 0x03 << 30; - rev >>= 30; - switch (rev) { - case KBD_REVISION_OMAP4: - keypad_data->reg_offset = 0x00; - keypad_data->irqreg_offset = 0x00; - break; - case KBD_REVISION_OMAP5: - keypad_data->reg_offset = 0x10; - keypad_data->irqreg_offset = 0x0c; - break; - default: - dev_err(&pdev->dev, - "Keypad reports unsupported revision %d", rev); - error = -EINVAL; - goto err_pm_put_sync; + pm_runtime_put_noidle(&pdev->dev); + } else { + error = omap4_keypad_check_revision(&pdev->dev, + keypad_data); + if (!error) { + /* Ensure device does not raise interrupts */ + omap4_keypad_stop(keypad_data); + } + pm_runtime_put_sync(&pdev->dev); } + if (error) + goto err_pm_disable; /* input device allocation */ keypad_data->input = input_dev = input_allocate_device(); if (!input_dev) { error = -ENOMEM; - goto err_pm_put_sync; + goto err_pm_disable; } input_dev->name = pdev->name; @@ -349,28 +369,25 @@ static int omap4_keypad_probe(struct platform_device *pdev) goto err_free_keymap; } - device_init_wakeup(&pdev->dev, true); - pm_runtime_put_sync(&pdev->dev); - error = input_register_device(keypad_data->input); if (error < 0) { dev_err(&pdev->dev, "failed to register input device\n"); - goto err_pm_disable; + goto err_free_irq; } + device_init_wakeup(&pdev->dev, true); platform_set_drvdata(pdev, keypad_data); + return 0; -err_pm_disable: - pm_runtime_disable(&pdev->dev); +err_free_irq: free_irq(keypad_data->irq, keypad_data); err_free_keymap: kfree(keypad_data->keymap); err_free_input: input_free_device(input_dev); -err_pm_put_sync: - pm_runtime_put_sync(&pdev->dev); -err_unmap: +err_pm_disable: + pm_runtime_disable(&pdev->dev); iounmap(keypad_data->base); err_release_mem: release_mem_region(res->start, resource_size(res)); -- cgit v1.2.3-59-g8ed1b From c1b46cd4df97534c6b942bb30526a2c47f0cb3c8 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Sun, 22 Nov 2020 17:52:32 -0800 Subject: Input: omap4-keypad - set up interrupt as wakeup source Marking main interrupt as wakeup interrupt in probe allows us to drop custom suspend/resume methods whose only purpose was to configure interrupt for waking up the system. Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/omap4-keypad.c | 43 +++++++---------------------------- 1 file changed, 8 insertions(+), 35 deletions(-) (limited to 'drivers/input/keyboard') diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c index dd16f7b3c7ef..b17ac2a295b9 100644 --- a/drivers/input/keyboard/omap4-keypad.c +++ b/drivers/input/keyboard/omap4-keypad.c @@ -18,6 +18,7 @@ #include #include #include +#include /* OMAP4 registers */ #define OMAP4_KBD_REVISION 0x00 @@ -69,7 +70,6 @@ struct omap4_keypad { struct input_dev *input; void __iomem *base; - bool irq_wake_enabled; unsigned int irq; unsigned int rows; @@ -376,6 +376,11 @@ static int omap4_keypad_probe(struct platform_device *pdev) } device_init_wakeup(&pdev->dev, true); + error = dev_pm_set_wake_irq(&pdev->dev, keypad_data->irq); + if (error) + dev_warn(&pdev->dev, + "failed to set up wakeup irq: %d\n", error); + platform_set_drvdata(pdev, keypad_data); return 0; @@ -401,6 +406,8 @@ static int omap4_keypad_remove(struct platform_device *pdev) struct omap4_keypad *keypad_data = platform_get_drvdata(pdev); struct resource *res; + dev_pm_clear_wake_irq(&pdev->dev); + free_irq(keypad_data->irq, keypad_data); pm_runtime_disable(&pdev->dev); @@ -424,45 +431,11 @@ static const struct of_device_id omap_keypad_dt_match[] = { }; MODULE_DEVICE_TABLE(of, omap_keypad_dt_match); -#ifdef CONFIG_PM_SLEEP -static int omap4_keypad_suspend(struct device *dev) -{ - struct platform_device *pdev = to_platform_device(dev); - struct omap4_keypad *keypad_data = platform_get_drvdata(pdev); - int error; - - if (device_may_wakeup(&pdev->dev)) { - error = enable_irq_wake(keypad_data->irq); - if (!error) - keypad_data->irq_wake_enabled = true; - } - - return 0; -} - -static int omap4_keypad_resume(struct device *dev) -{ - struct platform_device *pdev = to_platform_device(dev); - struct omap4_keypad *keypad_data = platform_get_drvdata(pdev); - - if (device_may_wakeup(&pdev->dev) && keypad_data->irq_wake_enabled) { - disable_irq_wake(keypad_data->irq); - keypad_data->irq_wake_enabled = false; - } - - return 0; -} -#endif - -static SIMPLE_DEV_PM_OPS(omap4_keypad_pm_ops, - omap4_keypad_suspend, omap4_keypad_resume); - static struct platform_driver omap4_keypad_driver = { .probe = omap4_keypad_probe, .remove = omap4_keypad_remove, .driver = { .name = "omap4-keypad", - .pm = &omap4_keypad_pm_ops, .of_match_table = omap_keypad_dt_match, }, }; -- cgit v1.2.3-59-g8ed1b From d69f0a43c677e8afc67a222e1e7b51b9acc69cd3 Mon Sep 17 00:00:00 2001 From: Andrzej Pietrasiewicz Date: Sun, 4 Oct 2020 21:16:07 -0700 Subject: Input: use input_device_enabled() Use the newly added helper in relevant input drivers. Signed-off-by: Andrzej Pietrasiewicz Link: https://lore.kernel.org/r/20200608112211.12125-3-andrzej.p@collabora.com Signed-off-by: Dmitry Torokhov --- drivers/input/input-poller.c | 2 +- drivers/input/joystick/xpad.c | 4 ++-- drivers/input/keyboard/ep93xx_keypad.c | 2 +- drivers/input/keyboard/gpio_keys.c | 4 ++-- drivers/input/keyboard/imx_keypad.c | 4 ++-- drivers/input/keyboard/ipaq-micro-keys.c | 2 +- drivers/input/keyboard/lpc32xx-keys.c | 4 ++-- drivers/input/keyboard/pmic8xxx-keypad.c | 4 ++-- drivers/input/keyboard/pxa27x_keypad.c | 2 +- drivers/input/keyboard/samsung-keypad.c | 4 ++-- drivers/input/keyboard/spear-keyboard.c | 8 ++++---- drivers/input/keyboard/st-keyscan.c | 4 ++-- drivers/input/keyboard/tegra-kbc.c | 4 ++-- drivers/input/misc/drv260x.c | 4 ++-- drivers/input/misc/drv2665.c | 4 ++-- drivers/input/misc/drv2667.c | 4 ++-- drivers/input/misc/kxtj9.c | 4 ++-- drivers/input/misc/sirfsoc-onkey.c | 2 +- drivers/input/mouse/cyapa.c | 6 +++--- drivers/input/mouse/cyapa_gen3.c | 3 ++- drivers/input/mouse/cyapa_gen5.c | 3 ++- drivers/input/mouse/navpoint.c | 4 ++-- drivers/input/touchscreen/ad7879.c | 6 +++--- drivers/input/touchscreen/atmel_mxt_ts.c | 4 ++-- drivers/input/touchscreen/auo-pixcir-ts.c | 8 ++++---- drivers/input/touchscreen/bu21029_ts.c | 4 ++-- drivers/input/touchscreen/chipone_icn8318.c | 4 ++-- drivers/input/touchscreen/cyttsp_core.c | 4 ++-- drivers/input/touchscreen/eeti_ts.c | 4 ++-- drivers/input/touchscreen/ektf2127.c | 4 ++-- drivers/input/touchscreen/imx6ul_tsc.c | 4 ++-- drivers/input/touchscreen/ipaq-micro-ts.c | 2 +- drivers/input/touchscreen/iqs5xx.c | 4 ++-- drivers/input/touchscreen/lpc32xx_ts.c | 4 ++-- drivers/input/touchscreen/melfas_mip4.c | 8 ++++---- drivers/input/touchscreen/mms114.c | 6 +++--- drivers/input/touchscreen/pixcir_i2c_ts.c | 8 ++++---- drivers/input/touchscreen/ucb1400_ts.c | 4 ++-- drivers/input/touchscreen/wm97xx-core.c | 14 +++++++++----- drivers/input/touchscreen/zforce_ts.c | 8 ++++---- drivers/input/touchscreen/zinitix.c | 4 ++-- 41 files changed, 96 insertions(+), 90 deletions(-) (limited to 'drivers/input/keyboard') diff --git a/drivers/input/input-poller.c b/drivers/input/input-poller.c index 7d6b4e8879f1..688e3cb1c2a0 100644 --- a/drivers/input/input-poller.c +++ b/drivers/input/input-poller.c @@ -166,7 +166,7 @@ static ssize_t input_dev_set_poll_interval(struct device *dev, poller->poll_interval = interval; - if (input->users) { + if (input_device_enabled(input)) { cancel_delayed_work_sync(&poller->work); if (poller->poll_interval > 0) input_dev_poller_queue_work(poller); diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 2cd4296c2d08..e64c76c34fc1 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -1902,7 +1902,7 @@ static int xpad_suspend(struct usb_interface *intf, pm_message_t message) xpad360w_poweroff_controller(xpad); } else { mutex_lock(&input->mutex); - if (input->users) + if (input_device_enabled(input)) xpad_stop_input(xpad); mutex_unlock(&input->mutex); } @@ -1922,7 +1922,7 @@ static int xpad_resume(struct usb_interface *intf) retval = xpad360w_start_input(xpad); } else { mutex_lock(&input->mutex); - if (input->users) { + if (input_device_enabled(input)) { retval = xpad_start_input(xpad); } else if (xpad->xtype == XTYPE_XBOXONE) { /* diff --git a/drivers/input/keyboard/ep93xx_keypad.c b/drivers/input/keyboard/ep93xx_keypad.c index f831f01501d5..c8194333d612 100644 --- a/drivers/input/keyboard/ep93xx_keypad.c +++ b/drivers/input/keyboard/ep93xx_keypad.c @@ -208,7 +208,7 @@ static int ep93xx_keypad_resume(struct device *dev) mutex_lock(&input_dev->mutex); - if (input_dev->users) { + if (input_device_enabled(input_dev)) { if (!keypad->enabled) { ep93xx_keypad_config(keypad); clk_enable(keypad->clk); diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index a079504e98e8..77bac4ddf324 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -965,7 +965,7 @@ static int __maybe_unused gpio_keys_suspend(struct device *dev) return error; } else { mutex_lock(&input->mutex); - if (input->users) + if (input_device_enabled(input)) gpio_keys_close(input); mutex_unlock(&input->mutex); } @@ -983,7 +983,7 @@ static int __maybe_unused gpio_keys_resume(struct device *dev) gpio_keys_disable_wakeup(ddata); } else { mutex_lock(&input->mutex); - if (input->users) + if (input_device_enabled(input)) error = gpio_keys_open(input); mutex_unlock(&input->mutex); } diff --git a/drivers/input/keyboard/imx_keypad.c b/drivers/input/keyboard/imx_keypad.c index 5a46d113e909..1f5c9ea5e9e5 100644 --- a/drivers/input/keyboard/imx_keypad.c +++ b/drivers/input/keyboard/imx_keypad.c @@ -532,7 +532,7 @@ static int __maybe_unused imx_kbd_noirq_suspend(struct device *dev) /* imx kbd can wake up system even clock is disabled */ mutex_lock(&input_dev->mutex); - if (input_dev->users) + if (input_device_enabled(input_dev)) clk_disable_unprepare(kbd->clk); mutex_unlock(&input_dev->mutex); @@ -562,7 +562,7 @@ static int __maybe_unused imx_kbd_noirq_resume(struct device *dev) mutex_lock(&input_dev->mutex); - if (input_dev->users) { + if (input_device_enabled(input_dev)) { ret = clk_prepare_enable(kbd->clk); if (ret) goto err_clk; diff --git a/drivers/input/keyboard/ipaq-micro-keys.c b/drivers/input/keyboard/ipaq-micro-keys.c index e3f9e445e880..13a66a8e3411 100644 --- a/drivers/input/keyboard/ipaq-micro-keys.c +++ b/drivers/input/keyboard/ipaq-micro-keys.c @@ -140,7 +140,7 @@ static int __maybe_unused micro_key_resume(struct device *dev) mutex_lock(&input->mutex); - if (input->users) + if (input_device_enabled(input)) micro_key_start(keys); mutex_unlock(&input->mutex); diff --git a/drivers/input/keyboard/lpc32xx-keys.c b/drivers/input/keyboard/lpc32xx-keys.c index 348af2aeb5de..943aeeb0de79 100644 --- a/drivers/input/keyboard/lpc32xx-keys.c +++ b/drivers/input/keyboard/lpc32xx-keys.c @@ -273,7 +273,7 @@ static int lpc32xx_kscan_suspend(struct device *dev) mutex_lock(&input->mutex); - if (input->users) { + if (input_device_enabled(input)) { /* Clear IRQ and disable clock */ writel(1, LPC32XX_KS_IRQ(kscandat->kscan_base)); clk_disable_unprepare(kscandat->clk); @@ -292,7 +292,7 @@ static int lpc32xx_kscan_resume(struct device *dev) mutex_lock(&input->mutex); - if (input->users) { + if (input_device_enabled(input)) { /* Enable clock and clear IRQ */ retval = clk_prepare_enable(kscandat->clk); if (retval == 0) diff --git a/drivers/input/keyboard/pmic8xxx-keypad.c b/drivers/input/keyboard/pmic8xxx-keypad.c index 36bee6f5a8af..4766c5048ce2 100644 --- a/drivers/input/keyboard/pmic8xxx-keypad.c +++ b/drivers/input/keyboard/pmic8xxx-keypad.c @@ -633,7 +633,7 @@ static int pmic8xxx_kp_suspend(struct device *dev) } else { mutex_lock(&input_dev->mutex); - if (input_dev->users) + if (input_device_enabled(input_dev)) pmic8xxx_kp_disable(kp); mutex_unlock(&input_dev->mutex); @@ -653,7 +653,7 @@ static int pmic8xxx_kp_resume(struct device *dev) } else { mutex_lock(&input_dev->mutex); - if (input_dev->users) + if (input_device_enabled(input_dev)) pmic8xxx_kp_enable(kp); mutex_unlock(&input_dev->mutex); diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c index 7e65708b25a4..a7f8257c8a02 100644 --- a/drivers/input/keyboard/pxa27x_keypad.c +++ b/drivers/input/keyboard/pxa27x_keypad.c @@ -694,7 +694,7 @@ static int pxa27x_keypad_resume(struct device *dev) } else { mutex_lock(&input_dev->mutex); - if (input_dev->users) { + if (input_device_enabled(input_dev)) { /* Enable unit clock */ ret = clk_prepare_enable(keypad->clk); if (!ret) diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c index 1ed939d9798c..df0258dcf89e 100644 --- a/drivers/input/keyboard/samsung-keypad.c +++ b/drivers/input/keyboard/samsung-keypad.c @@ -536,7 +536,7 @@ static int samsung_keypad_suspend(struct device *dev) mutex_lock(&input_dev->mutex); - if (input_dev->users) + if (input_device_enabled(input_dev)) samsung_keypad_stop(keypad); samsung_keypad_toggle_wakeup(keypad, true); @@ -556,7 +556,7 @@ static int samsung_keypad_resume(struct device *dev) samsung_keypad_toggle_wakeup(keypad, false); - if (input_dev->users) + if (input_device_enabled(input_dev)) samsung_keypad_start(keypad); mutex_unlock(&input_dev->mutex); diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c index 9b8d78f87253..9838c79cb288 100644 --- a/drivers/input/keyboard/spear-keyboard.c +++ b/drivers/input/keyboard/spear-keyboard.c @@ -318,7 +318,7 @@ static int __maybe_unused spear_kbd_suspend(struct device *dev) writel_relaxed(val, kbd->io_base + MODE_CTL_REG); } else { - if (input_dev->users) { + if (input_device_enabled(input_dev)) { writel_relaxed(mode_ctl_reg & ~MODE_CTL_START_SCAN, kbd->io_base + MODE_CTL_REG); clk_disable(kbd->clk); @@ -326,7 +326,7 @@ static int __maybe_unused spear_kbd_suspend(struct device *dev) } /* store current configuration */ - if (input_dev->users) + if (input_device_enabled(input_dev)) kbd->mode_ctl_reg = mode_ctl_reg; /* restore previous clk state */ @@ -351,12 +351,12 @@ static int __maybe_unused spear_kbd_resume(struct device *dev) disable_irq_wake(kbd->irq); } } else { - if (input_dev->users) + if (input_device_enabled(input_dev)) clk_enable(kbd->clk); } /* restore current configuration */ - if (input_dev->users) + if (input_device_enabled(input_dev)) writel_relaxed(kbd->mode_ctl_reg, kbd->io_base + MODE_CTL_REG); mutex_unlock(&input_dev->mutex); diff --git a/drivers/input/keyboard/st-keyscan.c b/drivers/input/keyboard/st-keyscan.c index 27562cd67fb6..a045d61165ac 100644 --- a/drivers/input/keyboard/st-keyscan.c +++ b/drivers/input/keyboard/st-keyscan.c @@ -221,7 +221,7 @@ static int keyscan_suspend(struct device *dev) if (device_may_wakeup(dev)) enable_irq_wake(keypad->irq); - else if (input->users) + else if (input_device_enabled(input)) keyscan_stop(keypad); mutex_unlock(&input->mutex); @@ -239,7 +239,7 @@ static int keyscan_resume(struct device *dev) if (device_may_wakeup(dev)) disable_irq_wake(keypad->irq); - else if (input->users) + else if (input_device_enabled(input)) retval = keyscan_start(keypad); mutex_unlock(&input->mutex); diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c index d34d6947960f..9671842a082a 100644 --- a/drivers/input/keyboard/tegra-kbc.c +++ b/drivers/input/keyboard/tegra-kbc.c @@ -756,7 +756,7 @@ static int tegra_kbc_suspend(struct device *dev) enable_irq(kbc->irq); enable_irq_wake(kbc->irq); } else { - if (kbc->idev->users) + if (input_device_enabled(kbc->idev)) tegra_kbc_stop(kbc); } mutex_unlock(&kbc->idev->mutex); @@ -796,7 +796,7 @@ static int tegra_kbc_resume(struct device *dev) input_sync(kbc->idev); } } else { - if (kbc->idev->users) + if (input_device_enabled(kbc->idev)) err = tegra_kbc_start(kbc); } mutex_unlock(&kbc->idev->mutex); diff --git a/drivers/input/misc/drv260x.c b/drivers/input/misc/drv260x.c index cc51de7759a0..0efe56f49aa9 100644 --- a/drivers/input/misc/drv260x.c +++ b/drivers/input/misc/drv260x.c @@ -580,7 +580,7 @@ static int __maybe_unused drv260x_suspend(struct device *dev) mutex_lock(&haptics->input_dev->mutex); - if (haptics->input_dev->users) { + if (input_device_enabled(haptics->input_dev)) { ret = regmap_update_bits(haptics->regmap, DRV260X_MODE, DRV260X_STANDBY_MASK, @@ -612,7 +612,7 @@ static int __maybe_unused drv260x_resume(struct device *dev) mutex_lock(&haptics->input_dev->mutex); - if (haptics->input_dev->users) { + if (input_device_enabled(haptics->input_dev)) { ret = regulator_enable(haptics->regulator); if (ret) { dev_err(dev, "Failed to enable regulator\n"); diff --git a/drivers/input/misc/drv2665.c b/drivers/input/misc/drv2665.c index 0e65ab180f49..21913e8085d7 100644 --- a/drivers/input/misc/drv2665.c +++ b/drivers/input/misc/drv2665.c @@ -230,7 +230,7 @@ static int __maybe_unused drv2665_suspend(struct device *dev) mutex_lock(&haptics->input_dev->mutex); - if (haptics->input_dev->users) { + if (input_device_enabled(haptics->input_dev)) { ret = regmap_update_bits(haptics->regmap, DRV2665_CTRL_2, DRV2665_STANDBY, DRV2665_STANDBY); if (ret) { @@ -259,7 +259,7 @@ static int __maybe_unused drv2665_resume(struct device *dev) mutex_lock(&haptics->input_dev->mutex); - if (haptics->input_dev->users) { + if (input_device_enabled(haptics->input_dev)) { ret = regulator_enable(haptics->regulator); if (ret) { dev_err(dev, "Failed to enable regulator\n"); diff --git a/drivers/input/misc/drv2667.c b/drivers/input/misc/drv2667.c index dc19eb6a8713..3f67b9b010bf 100644 --- a/drivers/input/misc/drv2667.c +++ b/drivers/input/misc/drv2667.c @@ -407,7 +407,7 @@ static int __maybe_unused drv2667_suspend(struct device *dev) mutex_lock(&haptics->input_dev->mutex); - if (haptics->input_dev->users) { + if (input_device_enabled(haptics->input_dev)) { ret = regmap_update_bits(haptics->regmap, DRV2667_CTRL_2, DRV2667_STANDBY, DRV2667_STANDBY); if (ret) { @@ -436,7 +436,7 @@ static int __maybe_unused drv2667_resume(struct device *dev) mutex_lock(&haptics->input_dev->mutex); - if (haptics->input_dev->users) { + if (input_device_enabled(haptics->input_dev)) { ret = regulator_enable(haptics->regulator); if (ret) { dev_err(dev, "Failed to enable regulator\n"); diff --git a/drivers/input/misc/kxtj9.c b/drivers/input/misc/kxtj9.c index 52313c6e3fb3..bbb81617c2b2 100644 --- a/drivers/input/misc/kxtj9.c +++ b/drivers/input/misc/kxtj9.c @@ -503,7 +503,7 @@ static int __maybe_unused kxtj9_suspend(struct device *dev) mutex_lock(&input_dev->mutex); - if (input_dev->users) + if (input_device_enabled(input_dev)) kxtj9_disable(tj9); mutex_unlock(&input_dev->mutex); @@ -518,7 +518,7 @@ static int __maybe_unused kxtj9_resume(struct device *dev) mutex_lock(&input_dev->mutex); - if (input_dev->users) + if (input_device_enabled(input_dev)) kxtj9_enable(tj9); mutex_unlock(&input_dev->mutex); diff --git a/drivers/input/misc/sirfsoc-onkey.c b/drivers/input/misc/sirfsoc-onkey.c index 60e1f31ee60a..7982bf8fb839 100644 --- a/drivers/input/misc/sirfsoc-onkey.c +++ b/drivers/input/misc/sirfsoc-onkey.c @@ -181,7 +181,7 @@ static int __maybe_unused sirfsoc_pwrc_resume(struct device *dev) * if users touch X_ONKEY_B, see arch/arm/mach-prima2/pm.c */ mutex_lock(&input->mutex); - if (input->users) + if (input_device_enabled(input)) sirfsoc_pwrc_toggle_interrupts(pwrcdrv, true); mutex_unlock(&input->mutex); diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c index dacf7c0e43f9..3f4069511b13 100644 --- a/drivers/input/mouse/cyapa.c +++ b/drivers/input/mouse/cyapa.c @@ -526,7 +526,7 @@ static void cyapa_enable_irq_for_cmd(struct cyapa *cyapa) { struct input_dev *input = cyapa->input; - if (!input || !input->users) { + if (!input || !input_device_enabled(input)) { /* * When input is NULL, TP must be in deep sleep mode. * In this mode, later non-power I2C command will always failed @@ -546,7 +546,7 @@ static void cyapa_disable_irq_for_cmd(struct cyapa *cyapa) { struct input_dev *input = cyapa->input; - if (!input || !input->users) { + if (!input || !input_device_enabled(input)) { if (cyapa->gen >= CYAPA_GEN5) disable_irq(cyapa->client->irq); if (!input || cyapa->operational) @@ -652,7 +652,7 @@ static int cyapa_reinitialize(struct cyapa *cyapa) } out: - if (!input || !input->users) { + if (!input || !input_device_enabled(input)) { /* Reset to power OFF state to save power when no user open. */ if (cyapa->operational) cyapa->ops->set_power_mode(cyapa, diff --git a/drivers/input/mouse/cyapa_gen3.c b/drivers/input/mouse/cyapa_gen3.c index a0361f9325f8..a97f4acb6452 100644 --- a/drivers/input/mouse/cyapa_gen3.c +++ b/drivers/input/mouse/cyapa_gen3.c @@ -952,7 +952,8 @@ static int cyapa_gen3_set_power_mode(struct cyapa *cyapa, u8 power_mode, * doing so before issuing the next command may result in errors * depending on the command's content. */ - if (cyapa->operational && input && input->users && + if (cyapa->operational && + input && input_device_enabled(input) && (pm_stage == CYAPA_PM_RUNTIME_SUSPEND || pm_stage == CYAPA_PM_RUNTIME_RESUME)) { /* Try to polling in 120Hz, read may fail, just ignore it. */ diff --git a/drivers/input/mouse/cyapa_gen5.c b/drivers/input/mouse/cyapa_gen5.c index 5c37af994b5b..abf42f77b4c5 100644 --- a/drivers/input/mouse/cyapa_gen5.c +++ b/drivers/input/mouse/cyapa_gen5.c @@ -518,7 +518,8 @@ int cyapa_empty_pip_output_data(struct cyapa *cyapa, *len = length; /* Response found, success. */ return 0; - } else if (cyapa->operational && input && input->users && + } else if (cyapa->operational && + input && input_device_enabled(input) && (pm_stage == CYAPA_PM_RUNTIME_RESUME || pm_stage == CYAPA_PM_RUNTIME_SUSPEND)) { /* Parse the data and report it if it's valid. */ diff --git a/drivers/input/mouse/navpoint.c b/drivers/input/mouse/navpoint.c index c112980c2341..4d67575bb276 100644 --- a/drivers/input/mouse/navpoint.c +++ b/drivers/input/mouse/navpoint.c @@ -322,7 +322,7 @@ static int __maybe_unused navpoint_suspend(struct device *dev) struct input_dev *input = navpoint->input; mutex_lock(&input->mutex); - if (input->users) + if (input_device_enabled(input)) navpoint_down(navpoint); mutex_unlock(&input->mutex); @@ -336,7 +336,7 @@ static int __maybe_unused navpoint_resume(struct device *dev) struct input_dev *input = navpoint->input; mutex_lock(&input->mutex); - if (input->users) + if (input_device_enabled(input)) navpoint_up(navpoint); mutex_unlock(&input->mutex); diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c index 556a2af46e18..e850853328f1 100644 --- a/drivers/input/touchscreen/ad7879.c +++ b/drivers/input/touchscreen/ad7879.c @@ -306,7 +306,7 @@ static int __maybe_unused ad7879_suspend(struct device *dev) mutex_lock(&ts->input->mutex); - if (!ts->suspended && !ts->disabled && ts->input->users) + if (!ts->suspended && !ts->disabled && input_device_enabled(ts->input)) __ad7879_disable(ts); ts->suspended = true; @@ -322,7 +322,7 @@ static int __maybe_unused ad7879_resume(struct device *dev) mutex_lock(&ts->input->mutex); - if (ts->suspended && !ts->disabled && ts->input->users) + if (ts->suspended && !ts->disabled && input_device_enabled(ts->input)) __ad7879_enable(ts); ts->suspended = false; @@ -339,7 +339,7 @@ static void ad7879_toggle(struct ad7879 *ts, bool disable) { mutex_lock(&ts->input->mutex); - if (!ts->suspended && ts->input->users != 0) { + if (!ts->suspended && input_device_enabled(ts->input)) { if (disable) { if (ts->disabled) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index e34984388791..dde364dfb79d 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -3237,7 +3237,7 @@ static int __maybe_unused mxt_suspend(struct device *dev) mutex_lock(&input_dev->mutex); - if (input_dev->users) + if (input_device_enabled(input_dev)) mxt_stop(data); mutex_unlock(&input_dev->mutex); @@ -3260,7 +3260,7 @@ static int __maybe_unused mxt_resume(struct device *dev) mutex_lock(&input_dev->mutex); - if (input_dev->users) + if (input_device_enabled(input_dev)) mxt_start(data); mutex_unlock(&input_dev->mutex); diff --git a/drivers/input/touchscreen/auo-pixcir-ts.c b/drivers/input/touchscreen/auo-pixcir-ts.c index 8e9f3b7b8180..c33e63ca6142 100644 --- a/drivers/input/touchscreen/auo-pixcir-ts.c +++ b/drivers/input/touchscreen/auo-pixcir-ts.c @@ -414,7 +414,7 @@ static int __maybe_unused auo_pixcir_suspend(struct device *dev) */ if (device_may_wakeup(&client->dev)) { /* need to start device if not open, to be wakeup source */ - if (!input->users) { + if (!input_device_enabled(input)) { ret = auo_pixcir_start(ts); if (ret) goto unlock; @@ -422,7 +422,7 @@ static int __maybe_unused auo_pixcir_suspend(struct device *dev) enable_irq_wake(client->irq); ret = auo_pixcir_power_mode(ts, AUO_PIXCIR_POWER_SLEEP); - } else if (input->users) { + } else if (input_device_enabled(input)) { ret = auo_pixcir_stop(ts); } @@ -445,14 +445,14 @@ static int __maybe_unused auo_pixcir_resume(struct device *dev) disable_irq_wake(client->irq); /* need to stop device if it was not open on suspend */ - if (!input->users) { + if (!input_device_enabled(input)) { ret = auo_pixcir_stop(ts); if (ret) goto unlock; } /* device wakes automatically from SLEEP */ - } else if (input->users) { + } else if (input_device_enabled(input)) { ret = auo_pixcir_start(ts); } diff --git a/drivers/input/touchscreen/bu21029_ts.c b/drivers/input/touchscreen/bu21029_ts.c index 49a8d4bbca3a..341925edb8e6 100644 --- a/drivers/input/touchscreen/bu21029_ts.c +++ b/drivers/input/touchscreen/bu21029_ts.c @@ -430,7 +430,7 @@ static int __maybe_unused bu21029_suspend(struct device *dev) if (!device_may_wakeup(dev)) { mutex_lock(&bu21029->in_dev->mutex); - if (bu21029->in_dev->users) + if (input_device_enabled(bu21029->in_dev)) bu21029_stop_chip(bu21029->in_dev); mutex_unlock(&bu21029->in_dev->mutex); } @@ -445,7 +445,7 @@ static int __maybe_unused bu21029_resume(struct device *dev) if (!device_may_wakeup(dev)) { mutex_lock(&bu21029->in_dev->mutex); - if (bu21029->in_dev->users) + if (input_device_enabled(bu21029->in_dev)) bu21029_start_chip(bu21029->in_dev); mutex_unlock(&bu21029->in_dev->mutex); } diff --git a/drivers/input/touchscreen/chipone_icn8318.c b/drivers/input/touchscreen/chipone_icn8318.c index d91d2fd78649..f2fb41fb031e 100644 --- a/drivers/input/touchscreen/chipone_icn8318.c +++ b/drivers/input/touchscreen/chipone_icn8318.c @@ -154,7 +154,7 @@ static int icn8318_suspend(struct device *dev) struct icn8318_data *data = i2c_get_clientdata(to_i2c_client(dev)); mutex_lock(&data->input->mutex); - if (data->input->users) + if (input_device_enabled(data->input)) icn8318_stop(data->input); mutex_unlock(&data->input->mutex); @@ -166,7 +166,7 @@ static int icn8318_resume(struct device *dev) struct icn8318_data *data = i2c_get_clientdata(to_i2c_client(dev)); mutex_lock(&data->input->mutex); - if (data->input->users) + if (input_device_enabled(data->input)) icn8318_start(data->input); mutex_unlock(&data->input->mutex); diff --git a/drivers/input/touchscreen/cyttsp_core.c b/drivers/input/touchscreen/cyttsp_core.c index 697aa2c158f7..73c854f35f33 100644 --- a/drivers/input/touchscreen/cyttsp_core.c +++ b/drivers/input/touchscreen/cyttsp_core.c @@ -479,7 +479,7 @@ static int __maybe_unused cyttsp_suspend(struct device *dev) mutex_lock(&ts->input->mutex); - if (ts->input->users) { + if (input_device_enabled(ts->input)) { retval = cyttsp_disable(ts); if (retval == 0) ts->suspended = true; @@ -496,7 +496,7 @@ static int __maybe_unused cyttsp_resume(struct device *dev) mutex_lock(&ts->input->mutex); - if (ts->input->users) + if (input_device_enabled(ts->input)) cyttsp_enable(ts); ts->suspended = false; diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c index 2e1404cd09ec..a639ba7e56ea 100644 --- a/drivers/input/touchscreen/eeti_ts.c +++ b/drivers/input/touchscreen/eeti_ts.c @@ -241,7 +241,7 @@ static int __maybe_unused eeti_ts_suspend(struct device *dev) mutex_lock(&input_dev->mutex); - if (input_dev->users) + if (input_device_enabled(input_dev)) eeti_ts_stop(eeti); mutex_unlock(&input_dev->mutex); @@ -263,7 +263,7 @@ static int __maybe_unused eeti_ts_resume(struct device *dev) mutex_lock(&input_dev->mutex); - if (input_dev->users) + if (input_device_enabled(input_dev)) eeti_ts_start(eeti); mutex_unlock(&input_dev->mutex); diff --git a/drivers/input/touchscreen/ektf2127.c b/drivers/input/touchscreen/ektf2127.c index 491de67ddbcd..2d01a8cbfcc6 100644 --- a/drivers/input/touchscreen/ektf2127.c +++ b/drivers/input/touchscreen/ektf2127.c @@ -182,7 +182,7 @@ static int __maybe_unused ektf2127_suspend(struct device *dev) struct ektf2127_ts *ts = i2c_get_clientdata(to_i2c_client(dev)); mutex_lock(&ts->input->mutex); - if (ts->input->users) + if (input_device_enabled(ts->input)) ektf2127_stop(ts->input); mutex_unlock(&ts->input->mutex); @@ -194,7 +194,7 @@ static int __maybe_unused ektf2127_resume(struct device *dev) struct ektf2127_ts *ts = i2c_get_clientdata(to_i2c_client(dev)); mutex_lock(&ts->input->mutex); - if (ts->input->users) + if (input_device_enabled(ts->input)) ektf2127_start(ts->input); mutex_unlock(&ts->input->mutex); diff --git a/drivers/input/touchscreen/imx6ul_tsc.c b/drivers/input/touchscreen/imx6ul_tsc.c index e1852f7d4d31..2d4facf70cdb 100644 --- a/drivers/input/touchscreen/imx6ul_tsc.c +++ b/drivers/input/touchscreen/imx6ul_tsc.c @@ -520,7 +520,7 @@ static int __maybe_unused imx6ul_tsc_suspend(struct device *dev) mutex_lock(&input_dev->mutex); - if (input_dev->users) + if (input_device_enabled(input_dev)) imx6ul_tsc_stop(tsc); mutex_unlock(&input_dev->mutex); @@ -537,7 +537,7 @@ static int __maybe_unused imx6ul_tsc_resume(struct device *dev) mutex_lock(&input_dev->mutex); - if (input_dev->users) + if (input_device_enabled(input_dev)) retval = imx6ul_tsc_start(tsc); mutex_unlock(&input_dev->mutex); diff --git a/drivers/input/touchscreen/ipaq-micro-ts.c b/drivers/input/touchscreen/ipaq-micro-ts.c index 5c3977e1af6f..0eb5689fe65f 100644 --- a/drivers/input/touchscreen/ipaq-micro-ts.c +++ b/drivers/input/touchscreen/ipaq-micro-ts.c @@ -135,7 +135,7 @@ static int __maybe_unused micro_ts_resume(struct device *dev) mutex_lock(&input->mutex); - if (input->users) + if (input_device_enabled(input)) micro_ts_toggle_receive(ts, true); mutex_unlock(&input->mutex); diff --git a/drivers/input/touchscreen/iqs5xx.c b/drivers/input/touchscreen/iqs5xx.c index 3162b68f7374..4fd21bc3ce0f 100644 --- a/drivers/input/touchscreen/iqs5xx.c +++ b/drivers/input/touchscreen/iqs5xx.c @@ -1017,7 +1017,7 @@ static int __maybe_unused iqs5xx_suspend(struct device *dev) mutex_lock(&input->mutex); - if (input->users) + if (input_device_enabled(input)) error = iqs5xx_set_state(iqs5xx->client, IQS5XX_SUSPEND); mutex_unlock(&input->mutex); @@ -1036,7 +1036,7 @@ static int __maybe_unused iqs5xx_resume(struct device *dev) mutex_lock(&input->mutex); - if (input->users) + if (input_device_enabled(input)) error = iqs5xx_set_state(iqs5xx->client, IQS5XX_RESUME); mutex_unlock(&input->mutex); diff --git a/drivers/input/touchscreen/lpc32xx_ts.c b/drivers/input/touchscreen/lpc32xx_ts.c index b2cd9472e2d1..b51450b3d943 100644 --- a/drivers/input/touchscreen/lpc32xx_ts.c +++ b/drivers/input/touchscreen/lpc32xx_ts.c @@ -334,7 +334,7 @@ static int lpc32xx_ts_suspend(struct device *dev) */ mutex_lock(&input->mutex); - if (input->users) { + if (input_device_enabled(input)) { if (device_may_wakeup(dev)) enable_irq_wake(tsc->irq); else @@ -353,7 +353,7 @@ static int lpc32xx_ts_resume(struct device *dev) mutex_lock(&input->mutex); - if (input->users) { + if (input_device_enabled(input)) { if (device_may_wakeup(dev)) disable_irq_wake(tsc->irq); else diff --git a/drivers/input/touchscreen/melfas_mip4.c b/drivers/input/touchscreen/melfas_mip4.c index f67efdd040b2..c0050044a5a9 100644 --- a/drivers/input/touchscreen/melfas_mip4.c +++ b/drivers/input/touchscreen/melfas_mip4.c @@ -1256,7 +1256,7 @@ static int mip4_execute_fw_update(struct mip4_ts *ts, const struct firmware *fw) if (error) return error; - if (ts->input->users) { + if (input_device_enabled(ts->input)) { disable_irq(ts->client->irq); } else { error = mip4_power_on(ts); @@ -1276,7 +1276,7 @@ static int mip4_execute_fw_update(struct mip4_ts *ts, const struct firmware *fw) "Failed to flash firmware: %d\n", error); /* Enable IRQ */ - if (ts->input->users) + if (input_device_enabled(ts->input)) enable_irq(ts->client->irq); else mip4_power_off(ts); @@ -1539,7 +1539,7 @@ static int __maybe_unused mip4_suspend(struct device *dev) if (device_may_wakeup(dev)) ts->wake_irq_enabled = enable_irq_wake(client->irq) == 0; - else if (input->users) + else if (input_device_enabled(input)) mip4_disable(ts); mutex_unlock(&input->mutex); @@ -1557,7 +1557,7 @@ static int __maybe_unused mip4_resume(struct device *dev) if (ts->wake_irq_enabled) disable_irq_wake(client->irq); - else if (input->users) + else if (input_device_enabled(input)) mip4_enable(ts); mutex_unlock(&input->mutex); diff --git a/drivers/input/touchscreen/mms114.c b/drivers/input/touchscreen/mms114.c index 1f96657310b7..16557f51b09d 100644 --- a/drivers/input/touchscreen/mms114.c +++ b/drivers/input/touchscreen/mms114.c @@ -199,7 +199,7 @@ static irqreturn_t mms114_interrupt(int irq, void *dev_id) int error; mutex_lock(&input_dev->mutex); - if (!input_dev->users) { + if (!input_device_enabled(input_dev)) { mutex_unlock(&input_dev->mutex); goto out; } @@ -564,7 +564,7 @@ static int __maybe_unused mms114_suspend(struct device *dev) input_sync(input_dev); mutex_lock(&input_dev->mutex); - if (input_dev->users) + if (input_device_enabled(input_dev)) mms114_stop(data); mutex_unlock(&input_dev->mutex); @@ -579,7 +579,7 @@ static int __maybe_unused mms114_resume(struct device *dev) int error; mutex_lock(&input_dev->mutex); - if (input_dev->users) { + if (input_device_enabled(input_dev)) { error = mms114_start(data); if (error < 0) { mutex_unlock(&input_dev->mutex); diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c index 9aa098577350..dc148b4bed74 100644 --- a/drivers/input/touchscreen/pixcir_i2c_ts.c +++ b/drivers/input/touchscreen/pixcir_i2c_ts.c @@ -415,14 +415,14 @@ static int __maybe_unused pixcir_i2c_ts_suspend(struct device *dev) mutex_lock(&input->mutex); if (device_may_wakeup(&client->dev)) { - if (!input->users) { + if (!input_device_enabled(input)) { ret = pixcir_start(ts); if (ret) { dev_err(dev, "Failed to start\n"); goto unlock; } } - } else if (input->users) { + } else if (input_device_enabled(input)) { ret = pixcir_stop(ts); } @@ -442,14 +442,14 @@ static int __maybe_unused pixcir_i2c_ts_resume(struct device *dev) mutex_lock(&input->mutex); if (device_may_wakeup(&client->dev)) { - if (!input->users) { + if (!input_device_enabled(input)) { ret = pixcir_stop(ts); if (ret) { dev_err(dev, "Failed to stop\n"); goto unlock; } } - } else if (input->users) { + } else if (input_device_enabled(input)) { ret = pixcir_start(ts); } diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c index 807d39e18091..e3f2c940ef3d 100644 --- a/drivers/input/touchscreen/ucb1400_ts.c +++ b/drivers/input/touchscreen/ucb1400_ts.c @@ -410,7 +410,7 @@ static int __maybe_unused ucb1400_ts_suspend(struct device *dev) mutex_lock(&idev->mutex); - if (idev->users) + if (input_device_enabled(idev)) ucb1400_ts_stop(ucb); mutex_unlock(&idev->mutex); @@ -424,7 +424,7 @@ static int __maybe_unused ucb1400_ts_resume(struct device *dev) mutex_lock(&idev->mutex); - if (idev->users) + if (input_device_enabled(idev)) ucb1400_ts_start(ucb); mutex_unlock(&idev->mutex); diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c index 45ce89467c16..78d2ee99f37a 100644 --- a/drivers/input/touchscreen/wm97xx-core.c +++ b/drivers/input/touchscreen/wm97xx-core.c @@ -806,23 +806,25 @@ static int __maybe_unused wm97xx_suspend(struct device *dev) else suspend_mode = 0; - if (wm->input_dev->users) + mutex_lock(&wm->input_dev->mutex); + if (input_device_enabled(wm->input_dev)) cancel_delayed_work_sync(&wm->ts_reader); /* Power down the digitiser (bypassing the cache for resume) */ reg = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER2); reg &= ~WM97XX_PRP_DET_DIG; - if (wm->input_dev->users) + if (input_device_enabled(wm->input_dev)) reg |= suspend_mode; wm->ac97->bus->ops->write(wm->ac97, AC97_WM97XX_DIGITISER2, reg); /* WM9713 has an additional power bit - turn it off if there * are no users or if suspend mode is zero. */ if (wm->id == WM9713_ID2 && - (!wm->input_dev->users || !suspend_mode)) { + (!input_device_enabled(wm->input_dev) || !suspend_mode)) { reg = wm97xx_reg_read(wm, AC97_EXTENDED_MID) | 0x8000; wm97xx_reg_write(wm, AC97_EXTENDED_MID, reg); } + mutex_unlock(&wm->input_dev->mutex); return 0; } @@ -831,11 +833,12 @@ static int __maybe_unused wm97xx_resume(struct device *dev) { struct wm97xx *wm = dev_get_drvdata(dev); + mutex_lock(&wm->input_dev->mutex); /* restore digitiser and gpios */ if (wm->id == WM9713_ID2) { wm97xx_reg_write(wm, AC97_WM9713_DIG1, wm->dig[0]); wm97xx_reg_write(wm, 0x5a, wm->misc); - if (wm->input_dev->users) { + if (input_device_enabled(wm->input_dev)) { u16 reg; reg = wm97xx_reg_read(wm, AC97_EXTENDED_MID) & 0x7fff; wm97xx_reg_write(wm, AC97_EXTENDED_MID, reg); @@ -852,11 +855,12 @@ static int __maybe_unused wm97xx_resume(struct device *dev) wm97xx_reg_write(wm, AC97_GPIO_STATUS, wm->gpio[4]); wm97xx_reg_write(wm, AC97_MISC_AFE, wm->gpio[5]); - if (wm->input_dev->users && !wm->pen_irq) { + if (input_device_enabled(wm->input_dev) && !wm->pen_irq) { wm->ts_reader_interval = wm->ts_reader_min_interval; queue_delayed_work(wm->ts_workq, &wm->ts_reader, wm->ts_reader_interval); } + mutex_unlock(&wm->input_dev->mutex); return 0; } diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c index 5230519b0f74..495629628af6 100644 --- a/drivers/input/touchscreen/zforce_ts.c +++ b/drivers/input/touchscreen/zforce_ts.c @@ -626,14 +626,14 @@ static int __maybe_unused zforce_suspend(struct device *dev) dev_dbg(&client->dev, "suspend while being a wakeup source\n"); /* Need to start device, if not open, to be a wakeup source. */ - if (!input->users) { + if (!input_device_enabled(input)) { ret = zforce_start(ts); if (ret) goto unlock; } enable_irq_wake(client->irq); - } else if (input->users) { + } else if (input_device_enabled(input)) { dev_dbg(&client->dev, "suspend without being a wakeup source\n"); @@ -670,12 +670,12 @@ static int __maybe_unused zforce_resume(struct device *dev) disable_irq_wake(client->irq); /* need to stop device if it was not open on suspend */ - if (!input->users) { + if (!input_device_enabled(input)) { ret = zforce_stop(ts); if (ret) goto unlock; } - } else if (input->users) { + } else if (input_device_enabled(input)) { dev_dbg(&client->dev, "resume without being a wakeup source\n"); enable_irq(client->irq); diff --git a/drivers/input/touchscreen/zinitix.c b/drivers/input/touchscreen/zinitix.c index 1acc2eb2bcb3..a3e3adbabc67 100644 --- a/drivers/input/touchscreen/zinitix.c +++ b/drivers/input/touchscreen/zinitix.c @@ -532,7 +532,7 @@ static int __maybe_unused zinitix_suspend(struct device *dev) mutex_lock(&bt541->input_dev->mutex); - if (bt541->input_dev->users) + if (input_device_enabled(bt541->input_dev)) zinitix_stop(bt541); mutex_unlock(&bt541->input_dev->mutex); @@ -548,7 +548,7 @@ static int __maybe_unused zinitix_resume(struct device *dev) mutex_lock(&bt541->input_dev->mutex); - if (bt541->input_dev->users) + if (input_device_enabled(bt541->input_dev)) ret = zinitix_start(bt541); mutex_unlock(&bt541->input_dev->mutex); -- cgit v1.2.3-59-g8ed1b From 7002932325ef8efff354a70b93a63dcdbca20d81 Mon Sep 17 00:00:00 2001 From: Stephan Gerhold Date: Wed, 9 Dec 2020 19:39:07 -0800 Subject: Input: tm2-touchkey - add vddio regulator The Samsung touchkey controllers are often used with external pull-up for the interrupt line and the I2C lines, so we might need to enable a regulator to bring the lines into usable state. Otherwise, this might cause spurious interrupts and reading from I2C will fail. Implement support for a "vddio-supply" that is enabled by the tm2-touchkey driver so that the regulator gets enabled when needed. Signed-off-by: Stephan Gerhold Reviewed-by: Linus Walleij Link: https://lore.kernel.org/r/20201203131242.44397-3-stephan@gerhold.net Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/tm2-touchkey.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/input/keyboard') diff --git a/drivers/input/keyboard/tm2-touchkey.c b/drivers/input/keyboard/tm2-touchkey.c index fb078e049413..6218b1c682ef 100644 --- a/drivers/input/keyboard/tm2-touchkey.c +++ b/drivers/input/keyboard/tm2-touchkey.c @@ -48,7 +48,7 @@ struct tm2_touchkey_data { struct input_dev *input_dev; struct led_classdev led_dev; struct regulator *vdd; - struct regulator_bulk_data regulators[2]; + struct regulator_bulk_data regulators[3]; const struct touchkey_variant *variant; u32 keycodes[4]; int num_keycodes; @@ -204,6 +204,7 @@ static int tm2_touchkey_probe(struct i2c_client *client, touchkey->regulators[0].supply = "vcc"; touchkey->regulators[1].supply = "vdd"; + touchkey->regulators[2].supply = "vddio"; error = devm_regulator_bulk_get(&client->dev, ARRAY_SIZE(touchkey->regulators), touchkey->regulators); -- cgit v1.2.3-59-g8ed1b From 6a8f9ed23a8e06a3ca823aeb6058202f99e557f2 Mon Sep 17 00:00:00 2001 From: Sergiu Cuciurean Date: Thu, 10 Dec 2020 21:57:36 -0800 Subject: Input: applespi - use new structure for SPI transfer delays MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In a recent change to the SPI subsystem [1], a new `delay` struct was added to replace the `delay_usecs`. This change replaces the current `delay_usecs` with `delay` for this driver. The `spi_transfer_delay_exec()` function [in the SPI framework] makes sure that both `delay_usecs` & `delay` are used (in this order to preserve backwards compatibility). [1] commit bebcfd272df6 ("spi: introduce `delay` field for `spi_transfer` + spi_transfer_delay_exec()") Signed-off-by: Sergiu Cuciurean Tested-by: Ronald Tschalär Reviewed-by: Ronald Tschalär Link: https://lore.kernel.org/r/20200227124534.23399-1-sergiu.cuciurean@analog.com Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/applespi.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'drivers/input/keyboard') diff --git a/drivers/input/keyboard/applespi.c b/drivers/input/keyboard/applespi.c index 8053a3d2ff63..d22223154177 100644 --- a/drivers/input/keyboard/applespi.c +++ b/drivers/input/keyboard/applespi.c @@ -554,7 +554,8 @@ static void applespi_setup_read_txfrs(struct applespi_data *applespi) memset(dl_t, 0, sizeof(*dl_t)); memset(rd_t, 0, sizeof(*rd_t)); - dl_t->delay_usecs = applespi->spi_settings.spi_cs_delay; + dl_t->delay.value = applespi->spi_settings.spi_cs_delay; + dl_t->delay.unit = SPI_DELAY_UNIT_USECS; rd_t->rx_buf = applespi->rx_buffer; rd_t->len = APPLESPI_PACKET_SIZE; @@ -583,14 +584,17 @@ static void applespi_setup_write_txfrs(struct applespi_data *applespi) * end up with an extra unnecessary (but harmless) cs assertion and * deassertion. */ - wt_t->delay_usecs = SPI_RW_CHG_DELAY_US; + wt_t->delay.value = SPI_RW_CHG_DELAY_US; + wt_t->delay.unit = SPI_DELAY_UNIT_USECS; wt_t->cs_change = 1; - dl_t->delay_usecs = applespi->spi_settings.spi_cs_delay; + dl_t->delay.value = applespi->spi_settings.spi_cs_delay; + dl_t->delay.unit = SPI_DELAY_UNIT_USECS; wr_t->tx_buf = applespi->tx_buffer; wr_t->len = APPLESPI_PACKET_SIZE; - wr_t->delay_usecs = SPI_RW_CHG_DELAY_US; + wr_t->delay.value = SPI_RW_CHG_DELAY_US; + wr_t->delay.unit = SPI_DELAY_UNIT_USECS; st_t->rx_buf = applespi->tx_status; st_t->len = APPLESPI_STATUS_SIZE; -- cgit v1.2.3-59-g8ed1b From c8834032ffe249a2a1b9702359ff29a28b8fcf1e Mon Sep 17 00:00:00 2001 From: Anson Huang Date: Thu, 10 Dec 2020 22:01:38 -0800 Subject: Input: imx_keypad - add COMPILE_TEST support Add COMPILE_TEST support to imx_keypad driver for better compile testing coverage. Signed-off-by: Anson Huang Link: https://lore.kernel.org/r/1583137573-16628-1-git-send-email-Anson.Huang@nxp.com Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input/keyboard') diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 793ecbbda32c..2b321c17054a 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig @@ -457,7 +457,7 @@ config KEYBOARD_SNVS_PWRKEY config KEYBOARD_IMX tristate "IMX keypad support" - depends on ARCH_MXC + depends on ARCH_MXC || COMPILE_TEST select INPUT_MATRIXKMAP help Enable support for IMX keypad port. -- cgit v1.2.3-59-g8ed1b From 3e35c1946805b3ecc7967e0df2bd95a7d0e0bff1 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Fri, 11 Dec 2020 13:13:25 -0800 Subject: Input: adp5589-keys - do not unconditionally configure as wakeup source We should not be configuring the controller as a wakeup source in the driver, but rather rely on I2C core to mark it as such by either instantiating as I2C_CLIENT_WAKEUP or specifying "wakeup-source" device property. Link: https://lore.kernel.org/r/20201120073920.3214492-1-dmitry.torokhov@gmail.com Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/adp5589-keys.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/input/keyboard') diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c index e2cdf14d90cd..d76b0e4e67c4 100644 --- a/drivers/input/keyboard/adp5589-keys.c +++ b/drivers/input/keyboard/adp5589-keys.c @@ -930,8 +930,6 @@ static int adp5589_keypad_add(struct adp5589_kpad *kpad, unsigned int revid) return error; } - device_init_wakeup(&client->dev, 1); - return 0; } -- cgit v1.2.3-59-g8ed1b From 51a224eaf8512bc8c355e71a88b4554fda9cdeba Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Fri, 11 Dec 2020 13:14:00 -0800 Subject: Input: adp5589-keys - do not explicitly control IRQ for wakeup If device is set up as a wakeup source, I2C core configures the interrupt line as wake IRQ and PM core automatically configures it for waking up the system on system suspend transition, so we do not have to explicitly call enable_irq_wake() and disable_irq_wake() in suspend/resume. Link: https://lore.kernel.org/r/20201120073920.3214492-2-dmitry.torokhov@gmail.com Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/adp5589-keys.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'drivers/input/keyboard') diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c index d76b0e4e67c4..654e0476406b 100644 --- a/drivers/input/keyboard/adp5589-keys.c +++ b/drivers/input/keyboard/adp5589-keys.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -1017,32 +1018,22 @@ static int adp5589_probe(struct i2c_client *client, static int __maybe_unused adp5589_suspend(struct device *dev) { - struct adp5589_kpad *kpad = dev_get_drvdata(dev); - struct i2c_client *client = kpad->client; - - if (!kpad->input) - return 0; - - disable_irq(client->irq); + struct i2c_client *client = to_i2c_client(dev); + struct adp5589_kpad *kpad = i2c_get_clientdata(client); - if (device_may_wakeup(&client->dev)) - enable_irq_wake(client->irq); + if (kpad->input) + disable_irq(client->irq); return 0; } static int __maybe_unused adp5589_resume(struct device *dev) { - struct adp5589_kpad *kpad = dev_get_drvdata(dev); - struct i2c_client *client = kpad->client; - - if (!kpad->input) - return 0; - - if (device_may_wakeup(&client->dev)) - disable_irq_wake(client->irq); + struct i2c_client *client = to_i2c_client(dev); + struct adp5589_kpad *kpad = i2c_get_clientdata(client); - enable_irq(client->irq); + if (kpad->input) + enable_irq(client->irq); return 0; } -- cgit v1.2.3-59-g8ed1b