From 93107bc736f4eb1d57a26c56eda9bb89b86d1ef0 Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Sun, 8 Nov 2020 22:09:03 -0800 Subject: Input: elantech - demote obvious abuse of kernel-doc header Fixes the following W=1 kernel build warning(s): drivers/input/mouse/elantech.c:1837: warning: Function parameter or member 'psmouse' not described in 'elantech_setup_smbus' drivers/input/mouse/elantech.c:1837: warning: Function parameter or member 'info' not described in 'elantech_setup_smbus' drivers/input/mouse/elantech.c:1837: warning: Function parameter or member 'leave_breadcrumbs' not described in 'elantech_setup_smbus' Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20201104162427.2984742-13-lee.jones@linaro.org Signed-off-by: Dmitry Torokhov --- drivers/input/mouse/elantech.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input/mouse') diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index 90f8765f9efc..47cd0e7f79bd 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c @@ -1827,7 +1827,7 @@ static int elantech_create_smbus(struct psmouse *psmouse, leave_breadcrumbs); } -/** +/* * elantech_setup_smbus - called once the PS/2 devices are enumerated * and decides to instantiate a SMBus InterTouch device. */ -- cgit v1.2.3-59-g8ed1b From 6cffd88c2f7d4b552a0bc3ba31af3c113de4d0b5 Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Wed, 4 Nov 2020 11:12:06 -0800 Subject: Input: cyapa - fix misnaming of 'cyapa_i2c_write's 'reg' param Fixes the following W=1 kernel build warning(s): drivers/input/mouse/cyapa.c:130: warning: Function parameter or member 'reg' not described in 'cyapa_i2c_write' drivers/input/mouse/cyapa.c:130: warning: Excess function parameter 'ret' description in 'cyapa_i2c_write' Signed-off-by: Lee Jones Reviewed-by: Benson Leung Link: https://lore.kernel.org/r/20201104162427.2984742-3-lee.jones@linaro.org Signed-off-by: Dmitry Torokhov --- drivers/input/mouse/cyapa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input/mouse') diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c index c675f156948b..dacf7c0e43f9 100644 --- a/drivers/input/mouse/cyapa.c +++ b/drivers/input/mouse/cyapa.c @@ -119,7 +119,7 @@ static ssize_t cyapa_i2c_read(struct cyapa *cyapa, u8 reg, size_t len, /** * cyapa_i2c_write - Execute i2c block data write operation * @cyapa: Handle to this driver - * @ret: Offset of the data to written in the register map + * @reg: Offset of the data to written in the register map * @len: number of bytes to write * @values: Data to be written * -- cgit v1.2.3-59-g8ed1b From a1b5196d988afdcded74e01bc47fb11c80b366cf Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Wed, 4 Nov 2020 11:12:15 -0800 Subject: Input: cyapa_gen5 - fix obvious abuse of kernel-doc format Fixes the following W=1 kernel build warning(s): drivers/input/mouse/cyapa_gen5.c:392: warning: Function parameter or member 'cyapa' not described in 'cyapa_i2c_pip_write' drivers/input/mouse/cyapa_gen5.c:392: warning: Function parameter or member 'buf' not described in 'cyapa_i2c_pip_write' drivers/input/mouse/cyapa_gen5.c:392: warning: Function parameter or member 'size' not described in 'cyapa_i2c_pip_write' drivers/input/mouse/cyapa_gen5.c:444: warning: Function parameter or member 'cyapa' not described in 'cyapa_empty_pip_output_data' drivers/input/mouse/cyapa_gen5.c:444: warning: Function parameter or member 'buf' not described in 'cyapa_empty_pip_output_data' drivers/input/mouse/cyapa_gen5.c:444: warning: Function parameter or member 'len' not described in 'cyapa_empty_pip_output_data' drivers/input/mouse/cyapa_gen5.c:444: warning: Function parameter or member 'func' not described in 'cyapa_empty_pip_output_data' Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20201104162427.2984742-4-lee.jones@linaro.org Signed-off-by: Dmitry Torokhov --- drivers/input/mouse/cyapa_gen5.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/input/mouse') diff --git a/drivers/input/mouse/cyapa_gen5.c b/drivers/input/mouse/cyapa_gen5.c index bb3a63d1268d..5c37af994b5b 100644 --- a/drivers/input/mouse/cyapa_gen5.c +++ b/drivers/input/mouse/cyapa_gen5.c @@ -385,7 +385,7 @@ ssize_t cyapa_i2c_pip_read(struct cyapa *cyapa, u8 *buf, size_t size) return size; } -/** +/* * Return a negative errno code else zero on success. */ ssize_t cyapa_i2c_pip_write(struct cyapa *cyapa, u8 *buf, size_t size) @@ -435,7 +435,7 @@ static enum cyapa_pm_stage cyapa_get_pip_pm_state(struct cyapa *cyapa) return pm_stage; } -/** +/* * This function is aimed to dump all not read data in Gen5 trackpad * before send any command, otherwise, the interrupt line will be blocked. */ -- cgit v1.2.3-59-g8ed1b From c7f0169e3bd274e576f6aaeee86ad2adf7bb14b5 Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Tue, 17 Nov 2020 13:46:18 -0800 Subject: Input: elan_i2c_core - move header inclusion inside MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The same clause as its use. Fixes the following W=1 kernel build warning(s): include/linux/input/elan-i2c-ids.h:26:36: warning: ‘elan_acpi_id’ defined but not used [-Wunused-const-variable=] Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20201112104420.GG1997862@dell Signed-off-by: Dmitry Torokhov --- drivers/input/mouse/elan_i2c_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input/mouse') diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index c599e21a8478..65d21a050cea 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -34,7 +34,6 @@ #include #include #include -#include #include #include @@ -1413,6 +1412,7 @@ static const struct i2c_device_id elan_id[] = { MODULE_DEVICE_TABLE(i2c, elan_id); #ifdef CONFIG_ACPI +#include MODULE_DEVICE_TABLE(acpi, elan_acpi_id); #endif -- cgit v1.2.3-59-g8ed1b From 58e5183ac869b98f3b17aa91fea11df3b718b3f2 Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Thu, 19 Nov 2020 19:15:44 -0800 Subject: Input: synaptics - demote non-conformant kernel-doc header Fixes the following W=1 kernel build warning(s): drivers/input/mouse/synaptics.c:1781: warning: Function parameter or member 'psmouse' not described in 'synaptics_setup_intertouch' drivers/input/mouse/synaptics.c:1781: warning: Function parameter or member 'info' not described in 'synaptics_setup_intertouch' drivers/input/mouse/synaptics.c:1781: warning: Function parameter or member 'leave_breadcrumbs' not described in 'synaptics_setup_intertouch' Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20201112110204.2083435-13-lee.jones@linaro.org Signed-off-by: Dmitry Torokhov --- drivers/input/mouse/synaptics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input/mouse') diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 82577095e175..8fb7b4385ded 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c @@ -1770,7 +1770,7 @@ static int synaptics_create_intertouch(struct psmouse *psmouse, leave_breadcrumbs); } -/** +/* * synaptics_setup_intertouch - called once the PS/2 devices are enumerated * and decides to instantiate a SMBus InterTouch device. */ -- cgit v1.2.3-59-g8ed1b From 3aa40a1ad36717114d9a267b08d884a387489fab Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Thu, 19 Nov 2020 19:20:33 -0800 Subject: Input: vmmouse - demote obvious abuse of kernel-doc header Fixes the following W=1 kernel build warning(s): drivers/input/mouse/vmmouse.c:99: warning: Function parameter or member 'cmd' not described in 'VMMOUSE_CMD' drivers/input/mouse/vmmouse.c:99: warning: Function parameter or member 'in1' not described in 'VMMOUSE_CMD' drivers/input/mouse/vmmouse.c:99: warning: Function parameter or member 'out1' not described in 'VMMOUSE_CMD' drivers/input/mouse/vmmouse.c:99: warning: Function parameter or member 'out2' not described in 'VMMOUSE_CMD' drivers/input/mouse/vmmouse.c:99: warning: Function parameter or member 'out3' not described in 'VMMOUSE_CMD' drivers/input/mouse/vmmouse.c:99: warning: Function parameter or member 'out4' not described in 'VMMOUSE_CMD' Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20201112110204.2083435-16-lee.jones@linaro.org Signed-off-by: Dmitry Torokhov --- drivers/input/mouse/vmmouse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input/mouse') diff --git a/drivers/input/mouse/vmmouse.c b/drivers/input/mouse/vmmouse.c index 148245c69be7..42443ffba7c4 100644 --- a/drivers/input/mouse/vmmouse.c +++ b/drivers/input/mouse/vmmouse.c @@ -76,7 +76,7 @@ struct vmmouse_data { char dev_name[128]; }; -/** +/* * Hypervisor-specific bi-directional communication channel * implementing the vmmouse protocol. Should never execute on * bare metal hardware. -- 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/mouse') 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 7ce8d91b8a849c4b9a010a8b773e3838a8e3d030 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Fri, 4 Dec 2020 12:13:17 -0800 Subject: Input: vsxxxaa - fix Kconfig spelling mistake There is a spelling mistake in the Kconfig help text. Fix it by replacing "theses" with "these". Signed-off-by: Colin Ian King Link: https://lore.kernel.org/r/20201204193635.1152241-1-colin.king@canonical.com Signed-off-by: Dmitry Torokhov --- drivers/input/mouse/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input/mouse') diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig index d8b6a5dab190..63c9cda555c3 100644 --- a/drivers/input/mouse/Kconfig +++ b/drivers/input/mouse/Kconfig @@ -372,7 +372,7 @@ config MOUSE_VSXXXAA select SERIO help Say Y (or M) if you want to use a DEC VSXXX-AA (hockey - puck) or a VSXXX-GA (rectangular) mouse. Theses mice are + puck) or a VSXXX-GA (rectangular) mouse. These mice are typically used on DECstations or VAXstations, but can also be used on any box capable of RS232 (with some adaptor described in the source file). This driver also works with the -- cgit v1.2.3-59-g8ed1b From 8edcd98be1b237965b54bee7e17f89a790a107fd Mon Sep 17 00:00:00 2001 From: Fuqian Huang Date: Sat, 13 Jul 2019 01:04:12 -0700 Subject: Input: cyapa - switch to using devm_add_action_or_reset() devm_add_action_or_reset() is introduced as a helper function which internally calls devm_add_action(). If devm_add_action() fails then it will execute the action mentioned and return the error code. This reduce source code size (avoid writing the action twice) and reduce the likelyhood of bugs. Signed-off-by: Fuqian Huang Link: https://lore.kernel.org/linux-input/20190708123323.11943-1-huangfq.daxian@gmail.com Signed-off-by: Dmitry Torokhov --- drivers/input/mouse/cyapa.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'drivers/input/mouse') diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c index 3f4069511b13..77cc653edca2 100644 --- a/drivers/input/mouse/cyapa.c +++ b/drivers/input/mouse/cyapa.c @@ -840,10 +840,9 @@ static int cyapa_prepare_wakeup_controls(struct cyapa *cyapa) return error; } - error = devm_add_action(dev, + error = devm_add_action_or_reset(dev, cyapa_remove_power_wakeup_group, cyapa); if (error) { - cyapa_remove_power_wakeup_group(cyapa); dev_err(dev, "failed to add power cleanup action: %d\n", error); return error; @@ -957,9 +956,9 @@ static int cyapa_start_runtime(struct cyapa *cyapa) return error; } - error = devm_add_action(dev, cyapa_remove_power_runtime_group, cyapa); + error = devm_add_action_or_reset(dev, cyapa_remove_power_runtime_group, + cyapa); if (error) { - cyapa_remove_power_runtime_group(cyapa); dev_err(dev, "failed to add power runtime cleanup action: %d\n", error); @@ -1291,9 +1290,8 @@ static int cyapa_probe(struct i2c_client *client, return error; } - error = devm_add_action(dev, cyapa_disable_regulator, cyapa); + error = devm_add_action_or_reset(dev, cyapa_disable_regulator, cyapa); if (error) { - cyapa_disable_regulator(cyapa); dev_err(dev, "failed to add disable regulator action: %d\n", error); return error; -- cgit v1.2.3-59-g8ed1b From 056115daede8d01f71732bc7d778fb85acee8eb6 Mon Sep 17 00:00:00 2001 From: Jingle Wu Date: Thu, 10 Dec 2020 23:40:09 -0800 Subject: Input: elan_i2c - add new trackpoint report type 0x5F The 0x5F is a new trackpoint report type used by some modules. Signed-off-by: Jingle Wu Link: https://lore.kernel.org/r/20201211071511.32349-1-jingle.wu@emc.com.tw Signed-off-by: Dmitry Torokhov --- drivers/input/mouse/elan_i2c.h | 16 ++++++++++++++++ drivers/input/mouse/elan_i2c_core.c | 13 +------------ drivers/input/mouse/elan_i2c_smbus.c | 8 ++++++-- 3 files changed, 23 insertions(+), 14 deletions(-) (limited to 'drivers/input/mouse') diff --git a/drivers/input/mouse/elan_i2c.h b/drivers/input/mouse/elan_i2c.h index c75b00c45d75..84bb386e97fe 100644 --- a/drivers/input/mouse/elan_i2c.h +++ b/drivers/input/mouse/elan_i2c.h @@ -28,6 +28,22 @@ #define ETP_FEATURE_REPORT_MK BIT(0) +#define ETP_REPORT_ID 0x5D +#define ETP_TP_REPORT_ID 0x5E +#define ETP_TP_REPORT_ID2 0x5F +#define ETP_REPORT_ID2 0x60 /* High precision report */ + +#define ETP_REPORT_ID_OFFSET 2 +#define ETP_TOUCH_INFO_OFFSET 3 +#define ETP_FINGER_DATA_OFFSET 4 +#define ETP_HOVER_INFO_OFFSET 30 +#define ETP_MK_DATA_OFFSET 33 /* For high precision reports */ + +#define ETP_MAX_REPORT_LEN 39 + +#define ETP_MAX_FINGERS 5 +#define ETP_FINGER_DATA_LEN 5 + /* IAP Firmware handling */ #define ETP_PRODUCT_ID_FORMAT_STRING "%d.0" #define ETP_FW_NAME "elan_i2c_" ETP_PRODUCT_ID_FORMAT_STRING ".bin" diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index 65d21a050cea..3a8b9e890010 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -46,18 +46,6 @@ #define ETP_FINGER_WIDTH 15 #define ETP_RETRY_COUNT 3 -#define ETP_MAX_FINGERS 5 -#define ETP_FINGER_DATA_LEN 5 -#define ETP_REPORT_ID 0x5D -#define ETP_REPORT_ID2 0x60 /* High precision report */ -#define ETP_TP_REPORT_ID 0x5E -#define ETP_REPORT_ID_OFFSET 2 -#define ETP_TOUCH_INFO_OFFSET 3 -#define ETP_FINGER_DATA_OFFSET 4 -#define ETP_HOVER_INFO_OFFSET 30 -#define ETP_MK_DATA_OFFSET 33 /* For high precision reports */ -#define ETP_MAX_REPORT_LEN 39 - /* The main device structure */ struct elan_tp_data { struct i2c_client *client; @@ -1074,6 +1062,7 @@ static irqreturn_t elan_isr(int irq, void *dev_id) elan_report_absolute(data, report, true); break; case ETP_TP_REPORT_ID: + case ETP_TP_REPORT_ID2: elan_report_trackpoint(data, report); break; default: diff --git a/drivers/input/mouse/elan_i2c_smbus.c b/drivers/input/mouse/elan_i2c_smbus.c index 8ff823751f3b..1f38fab1825a 100644 --- a/drivers/input/mouse/elan_i2c_smbus.c +++ b/drivers/input/mouse/elan_i2c_smbus.c @@ -45,6 +45,7 @@ #define ETP_SMBUS_CALIBRATE_QUERY 0xC5 #define ETP_SMBUS_REPORT_LEN 32 +#define ETP_SMBUS_REPORT_LEN2 7 #define ETP_SMBUS_REPORT_OFFSET 2 #define ETP_SMBUS_HELLOPACKET_LEN 5 #define ETP_SMBUS_IAP_PASSWORD 0x1234 @@ -497,10 +498,13 @@ static int elan_smbus_get_report(struct i2c_client *client, return len; } - if (len != ETP_SMBUS_REPORT_LEN) { + if (report[ETP_REPORT_ID_OFFSET] == ETP_TP_REPORT_ID2) + report_len = ETP_SMBUS_REPORT_LEN2; + + if (len != report_len) { dev_err(&client->dev, "wrong report length (%d vs %d expected)\n", - len, ETP_SMBUS_REPORT_LEN); + len, report_len); return -EIO; } -- cgit v1.2.3-59-g8ed1b From e4c9062717feda88900b566463228d1c4910af6d Mon Sep 17 00:00:00 2001 From: "jingle.wu" Date: Thu, 10 Dec 2020 23:49:16 -0800 Subject: Input: elantech - fix protocol errors for some trackpoints in SMBus mode There are some version of Elan trackpads that send incorrect data when in SMbus mode, unless they are switched to use 0x5f reports instead of standard 0x5e. This patch implements querying device to retrieve chips identifying data, and switching it, when needed to the alternative report. Signed-off-by: Jingle Wu Link: https://lore.kernel.org/r/20201211071531.32413-1-jingle.wu@emc.com.tw Signed-off-by: Dmitry Torokhov --- drivers/input/mouse/elantech.c | 99 +++++++++++++++++++++++++++++++++++++++++- drivers/input/mouse/elantech.h | 4 ++ 2 files changed, 101 insertions(+), 2 deletions(-) (limited to 'drivers/input/mouse') diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index 47cd0e7f79bd..97381e2e03ba 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c @@ -89,6 +89,47 @@ static int elantech_ps2_command(struct psmouse *psmouse, return rc; } +/* + * Send an Elantech style special command to read 3 bytes from a register + */ +static int elantech_read_reg_params(struct psmouse *psmouse, u8 reg, u8 *param) +{ + if (elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || + elantech_ps2_command(psmouse, NULL, ETP_REGISTER_READWRITE) || + elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || + elantech_ps2_command(psmouse, NULL, reg) || + elantech_ps2_command(psmouse, param, PSMOUSE_CMD_GETINFO)) { + psmouse_err(psmouse, + "failed to read register %#02x\n", reg); + return -EIO; + } + + return 0; +} + +/* + * Send an Elantech style special command to write a register with a parameter + */ +static int elantech_write_reg_params(struct psmouse *psmouse, u8 reg, u8 *param) +{ + if (elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || + elantech_ps2_command(psmouse, NULL, ETP_REGISTER_READWRITE) || + elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || + elantech_ps2_command(psmouse, NULL, reg) || + elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || + elantech_ps2_command(psmouse, NULL, param[0]) || + elantech_ps2_command(psmouse, NULL, ETP_PS2_CUSTOM_COMMAND) || + elantech_ps2_command(psmouse, NULL, param[1]) || + elantech_ps2_command(psmouse, NULL, PSMOUSE_CMD_SETSCALE11)) { + psmouse_err(psmouse, + "failed to write register %#02x with value %#02x%#02x\n", + reg, param[0], param[1]); + return -EIO; + } + + return 0; +} + /* * Send an Elantech style special command to read a value from a register */ @@ -1529,19 +1570,35 @@ static const struct dmi_system_id no_hw_res_dmi_table[] = { { } }; +/* + * Change Report id 0x5E to 0x5F. + */ +static int elantech_change_report_id(struct psmouse *psmouse) +{ + unsigned char param[2] = { 0x10, 0x03 }; + + if (elantech_write_reg_params(psmouse, 0x7, param) || + elantech_read_reg_params(psmouse, 0x7, param) || + param[0] != 0x10 || param[1] != 0x03) { + psmouse_err(psmouse, "Unable to change report ID to 0x5f.\n"); + return -EIO; + } + + return 0; +} /* * determine hardware version and set some properties according to it. */ static int elantech_set_properties(struct elantech_device_info *info) { /* This represents the version of IC body. */ - int ver = (info->fw_version & 0x0f0000) >> 16; + info->ic_version = (info->fw_version & 0x0f0000) >> 16; /* Early version of Elan touchpads doesn't obey the rule. */ if (info->fw_version < 0x020030 || info->fw_version == 0x020600) info->hw_version = 1; else { - switch (ver) { + switch (info->ic_version) { case 2: case 4: info->hw_version = 2; @@ -1557,6 +1614,11 @@ static int elantech_set_properties(struct elantech_device_info *info) } } + /* Get information pattern for hw_version 4 */ + info->pattern = 0x00; + if (info->ic_version == 0x0f && (info->fw_version & 0xff) <= 0x02) + info->pattern = info->fw_version & 0xff; + /* decide which send_cmd we're gonna use early */ info->send_cmd = info->hw_version >= 3 ? elantech_send_cmd : synaptics_send_cmd; @@ -1598,6 +1660,7 @@ static int elantech_query_info(struct psmouse *psmouse, { unsigned char param[3]; unsigned char traces; + unsigned char ic_body[3]; memset(info, 0, sizeof(*info)); @@ -1640,6 +1703,21 @@ static int elantech_query_info(struct psmouse *psmouse, info->samples[2]); } + if (info->pattern > 0x00 && info->ic_version == 0xf) { + if (info->send_cmd(psmouse, ETP_ICBODY_QUERY, ic_body)) { + psmouse_err(psmouse, "failed to query ic body\n"); + return -EINVAL; + } + info->ic_version = be16_to_cpup((__be16 *)ic_body); + psmouse_info(psmouse, + "Elan ic body: %#04x, current fw version: %#02x\n", + info->ic_version, ic_body[2]); + } + + info->product_id = be16_to_cpup((__be16 *)info->samples); + if (info->pattern == 0x00) + info->product_id &= 0xff; + if (info->samples[1] == 0x74 && info->hw_version == 0x03) { /* * This module has a bug which makes absolute mode @@ -1654,6 +1732,23 @@ static int elantech_query_info(struct psmouse *psmouse, /* The MSB indicates the presence of the trackpoint */ info->has_trackpoint = (info->capabilities[0] & 0x80) == 0x80; + if (info->has_trackpoint && info->ic_version == 0x0011 && + (info->product_id == 0x08 || info->product_id == 0x09 || + info->product_id == 0x0d || info->product_id == 0x0e)) { + /* + * This module has a bug which makes trackpoint in SMBus + * mode return invalid data unless trackpoint is switched + * from using 0x5e reports to 0x5f. If we are not able to + * make the switch, let's abort initialization so we'll be + * using standard PS/2 protocol. + */ + if (elantech_change_report_id(psmouse)) { + psmouse_info(psmouse, + "Trackpoint report is broken, forcing standard PS/2 protocol\n"); + return -ENODEV; + } + } + info->x_res = 31; info->y_res = 31; if (info->hw_version == 4) { diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h index e0a3e59d4f1b..571e6ca11d33 100644 --- a/drivers/input/mouse/elantech.h +++ b/drivers/input/mouse/elantech.h @@ -18,6 +18,7 @@ #define ETP_CAPABILITIES_QUERY 0x02 #define ETP_SAMPLE_QUERY 0x03 #define ETP_RESOLUTION_QUERY 0x04 +#define ETP_ICBODY_QUERY 0x05 /* * Command values for register reading or writing @@ -140,7 +141,10 @@ struct elantech_device_info { unsigned char samples[3]; unsigned char debug; unsigned char hw_version; + unsigned char pattern; unsigned int fw_version; + unsigned int ic_version; + unsigned int product_id; unsigned int x_min; unsigned int y_min; unsigned int x_max; -- cgit v1.2.3-59-g8ed1b From f051ae4f6c732c231046945b36234e977f8467c6 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 14 Dec 2020 13:37:46 -0800 Subject: Input: cyapa_gen6 - fix out-of-bounds stack access gcc -Warray-bounds warns about a serious bug in cyapa_pip_retrieve_data_structure: drivers/input/mouse/cyapa_gen6.c: In function 'cyapa_pip_retrieve_data_structure.constprop': include/linux/unaligned/access_ok.h:40:17: warning: array subscript -1 is outside array bounds of 'struct retrieve_data_struct_cmd[1]' [-Warray-bounds] 40 | *((__le16 *)p) = cpu_to_le16(val); drivers/input/mouse/cyapa_gen6.c:569:13: note: while referencing 'cmd' 569 | } __packed cmd; | ^~~ Apparently the '-2' was added to the pointer instead of the value, writing garbage into the stack next to this variable. Fixes: c2c06c41f700 ("Input: cyapa - add gen6 device module support") Signed-off-by: Arnd Bergmann Link: https://lore.kernel.org/r/20201026161332.3708389-1-arnd@kernel.org Cc: stable@vger.kernel.org Signed-off-by: Dmitry Torokhov --- drivers/input/mouse/cyapa_gen6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input/mouse') diff --git a/drivers/input/mouse/cyapa_gen6.c b/drivers/input/mouse/cyapa_gen6.c index 7eba66fbef58..812edfced86e 100644 --- a/drivers/input/mouse/cyapa_gen6.c +++ b/drivers/input/mouse/cyapa_gen6.c @@ -573,7 +573,7 @@ static int cyapa_pip_retrieve_data_structure(struct cyapa *cyapa, memset(&cmd, 0, sizeof(cmd)); put_unaligned_le16(PIP_OUTPUT_REPORT_ADDR, &cmd.head.addr); - put_unaligned_le16(sizeof(cmd), &cmd.head.length - 2); + put_unaligned_le16(sizeof(cmd) - 2, &cmd.head.length); cmd.head.report_id = PIP_APP_CMD_REPORT_ID; cmd.head.cmd_code = PIP_RETRIEVE_DATA_STRUCTURE; put_unaligned_le16(read_offset, &cmd.read_offset); -- cgit v1.2.3-59-g8ed1b