Commit d69f0a43 authored by Andrzej Pietrasiewicz's avatar Andrzej Pietrasiewicz Committed by Dmitry Torokhov

Input: use input_device_enabled()

Use the newly added helper in relevant input drivers.
Signed-off-by: default avatarAndrzej Pietrasiewicz <andrzej.p@collabora.com>
Link: https://lore.kernel.org/r/20200608112211.12125-3-andrzej.p@collabora.comSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 39be39ce
...@@ -166,7 +166,7 @@ static ssize_t input_dev_set_poll_interval(struct device *dev, ...@@ -166,7 +166,7 @@ static ssize_t input_dev_set_poll_interval(struct device *dev,
poller->poll_interval = interval; poller->poll_interval = interval;
if (input->users) { if (input_device_enabled(input)) {
cancel_delayed_work_sync(&poller->work); cancel_delayed_work_sync(&poller->work);
if (poller->poll_interval > 0) if (poller->poll_interval > 0)
input_dev_poller_queue_work(poller); input_dev_poller_queue_work(poller);
......
...@@ -1902,7 +1902,7 @@ static int xpad_suspend(struct usb_interface *intf, pm_message_t message) ...@@ -1902,7 +1902,7 @@ static int xpad_suspend(struct usb_interface *intf, pm_message_t message)
xpad360w_poweroff_controller(xpad); xpad360w_poweroff_controller(xpad);
} else { } else {
mutex_lock(&input->mutex); mutex_lock(&input->mutex);
if (input->users) if (input_device_enabled(input))
xpad_stop_input(xpad); xpad_stop_input(xpad);
mutex_unlock(&input->mutex); mutex_unlock(&input->mutex);
} }
...@@ -1922,7 +1922,7 @@ static int xpad_resume(struct usb_interface *intf) ...@@ -1922,7 +1922,7 @@ static int xpad_resume(struct usb_interface *intf)
retval = xpad360w_start_input(xpad); retval = xpad360w_start_input(xpad);
} else { } else {
mutex_lock(&input->mutex); mutex_lock(&input->mutex);
if (input->users) { if (input_device_enabled(input)) {
retval = xpad_start_input(xpad); retval = xpad_start_input(xpad);
} else if (xpad->xtype == XTYPE_XBOXONE) { } else if (xpad->xtype == XTYPE_XBOXONE) {
/* /*
......
...@@ -208,7 +208,7 @@ static int ep93xx_keypad_resume(struct device *dev) ...@@ -208,7 +208,7 @@ static int ep93xx_keypad_resume(struct device *dev)
mutex_lock(&input_dev->mutex); mutex_lock(&input_dev->mutex);
if (input_dev->users) { if (input_device_enabled(input_dev)) {
if (!keypad->enabled) { if (!keypad->enabled) {
ep93xx_keypad_config(keypad); ep93xx_keypad_config(keypad);
clk_enable(keypad->clk); clk_enable(keypad->clk);
......
...@@ -965,7 +965,7 @@ static int __maybe_unused gpio_keys_suspend(struct device *dev) ...@@ -965,7 +965,7 @@ static int __maybe_unused gpio_keys_suspend(struct device *dev)
return error; return error;
} else { } else {
mutex_lock(&input->mutex); mutex_lock(&input->mutex);
if (input->users) if (input_device_enabled(input))
gpio_keys_close(input); gpio_keys_close(input);
mutex_unlock(&input->mutex); mutex_unlock(&input->mutex);
} }
...@@ -983,7 +983,7 @@ static int __maybe_unused gpio_keys_resume(struct device *dev) ...@@ -983,7 +983,7 @@ static int __maybe_unused gpio_keys_resume(struct device *dev)
gpio_keys_disable_wakeup(ddata); gpio_keys_disable_wakeup(ddata);
} else { } else {
mutex_lock(&input->mutex); mutex_lock(&input->mutex);
if (input->users) if (input_device_enabled(input))
error = gpio_keys_open(input); error = gpio_keys_open(input);
mutex_unlock(&input->mutex); mutex_unlock(&input->mutex);
} }
......
...@@ -532,7 +532,7 @@ static int __maybe_unused imx_kbd_noirq_suspend(struct device *dev) ...@@ -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 */ /* imx kbd can wake up system even clock is disabled */
mutex_lock(&input_dev->mutex); mutex_lock(&input_dev->mutex);
if (input_dev->users) if (input_device_enabled(input_dev))
clk_disable_unprepare(kbd->clk); clk_disable_unprepare(kbd->clk);
mutex_unlock(&input_dev->mutex); mutex_unlock(&input_dev->mutex);
...@@ -562,7 +562,7 @@ static int __maybe_unused imx_kbd_noirq_resume(struct device *dev) ...@@ -562,7 +562,7 @@ static int __maybe_unused imx_kbd_noirq_resume(struct device *dev)
mutex_lock(&input_dev->mutex); mutex_lock(&input_dev->mutex);
if (input_dev->users) { if (input_device_enabled(input_dev)) {
ret = clk_prepare_enable(kbd->clk); ret = clk_prepare_enable(kbd->clk);
if (ret) if (ret)
goto err_clk; goto err_clk;
......
...@@ -140,7 +140,7 @@ static int __maybe_unused micro_key_resume(struct device *dev) ...@@ -140,7 +140,7 @@ static int __maybe_unused micro_key_resume(struct device *dev)
mutex_lock(&input->mutex); mutex_lock(&input->mutex);
if (input->users) if (input_device_enabled(input))
micro_key_start(keys); micro_key_start(keys);
mutex_unlock(&input->mutex); mutex_unlock(&input->mutex);
......
...@@ -273,7 +273,7 @@ static int lpc32xx_kscan_suspend(struct device *dev) ...@@ -273,7 +273,7 @@ static int lpc32xx_kscan_suspend(struct device *dev)
mutex_lock(&input->mutex); mutex_lock(&input->mutex);
if (input->users) { if (input_device_enabled(input)) {
/* Clear IRQ and disable clock */ /* Clear IRQ and disable clock */
writel(1, LPC32XX_KS_IRQ(kscandat->kscan_base)); writel(1, LPC32XX_KS_IRQ(kscandat->kscan_base));
clk_disable_unprepare(kscandat->clk); clk_disable_unprepare(kscandat->clk);
...@@ -292,7 +292,7 @@ static int lpc32xx_kscan_resume(struct device *dev) ...@@ -292,7 +292,7 @@ static int lpc32xx_kscan_resume(struct device *dev)
mutex_lock(&input->mutex); mutex_lock(&input->mutex);
if (input->users) { if (input_device_enabled(input)) {
/* Enable clock and clear IRQ */ /* Enable clock and clear IRQ */
retval = clk_prepare_enable(kscandat->clk); retval = clk_prepare_enable(kscandat->clk);
if (retval == 0) if (retval == 0)
......
...@@ -633,7 +633,7 @@ static int pmic8xxx_kp_suspend(struct device *dev) ...@@ -633,7 +633,7 @@ static int pmic8xxx_kp_suspend(struct device *dev)
} else { } else {
mutex_lock(&input_dev->mutex); mutex_lock(&input_dev->mutex);
if (input_dev->users) if (input_device_enabled(input_dev))
pmic8xxx_kp_disable(kp); pmic8xxx_kp_disable(kp);
mutex_unlock(&input_dev->mutex); mutex_unlock(&input_dev->mutex);
...@@ -653,7 +653,7 @@ static int pmic8xxx_kp_resume(struct device *dev) ...@@ -653,7 +653,7 @@ static int pmic8xxx_kp_resume(struct device *dev)
} else { } else {
mutex_lock(&input_dev->mutex); mutex_lock(&input_dev->mutex);
if (input_dev->users) if (input_device_enabled(input_dev))
pmic8xxx_kp_enable(kp); pmic8xxx_kp_enable(kp);
mutex_unlock(&input_dev->mutex); mutex_unlock(&input_dev->mutex);
......
...@@ -694,7 +694,7 @@ static int pxa27x_keypad_resume(struct device *dev) ...@@ -694,7 +694,7 @@ static int pxa27x_keypad_resume(struct device *dev)
} else { } else {
mutex_lock(&input_dev->mutex); mutex_lock(&input_dev->mutex);
if (input_dev->users) { if (input_device_enabled(input_dev)) {
/* Enable unit clock */ /* Enable unit clock */
ret = clk_prepare_enable(keypad->clk); ret = clk_prepare_enable(keypad->clk);
if (!ret) if (!ret)
......
...@@ -536,7 +536,7 @@ static int samsung_keypad_suspend(struct device *dev) ...@@ -536,7 +536,7 @@ static int samsung_keypad_suspend(struct device *dev)
mutex_lock(&input_dev->mutex); mutex_lock(&input_dev->mutex);
if (input_dev->users) if (input_device_enabled(input_dev))
samsung_keypad_stop(keypad); samsung_keypad_stop(keypad);
samsung_keypad_toggle_wakeup(keypad, true); samsung_keypad_toggle_wakeup(keypad, true);
...@@ -556,7 +556,7 @@ static int samsung_keypad_resume(struct device *dev) ...@@ -556,7 +556,7 @@ static int samsung_keypad_resume(struct device *dev)
samsung_keypad_toggle_wakeup(keypad, false); samsung_keypad_toggle_wakeup(keypad, false);
if (input_dev->users) if (input_device_enabled(input_dev))
samsung_keypad_start(keypad); samsung_keypad_start(keypad);
mutex_unlock(&input_dev->mutex); mutex_unlock(&input_dev->mutex);
......
...@@ -318,7 +318,7 @@ static int __maybe_unused spear_kbd_suspend(struct device *dev) ...@@ -318,7 +318,7 @@ static int __maybe_unused spear_kbd_suspend(struct device *dev)
writel_relaxed(val, kbd->io_base + MODE_CTL_REG); writel_relaxed(val, kbd->io_base + MODE_CTL_REG);
} else { } else {
if (input_dev->users) { if (input_device_enabled(input_dev)) {
writel_relaxed(mode_ctl_reg & ~MODE_CTL_START_SCAN, writel_relaxed(mode_ctl_reg & ~MODE_CTL_START_SCAN,
kbd->io_base + MODE_CTL_REG); kbd->io_base + MODE_CTL_REG);
clk_disable(kbd->clk); clk_disable(kbd->clk);
...@@ -326,7 +326,7 @@ static int __maybe_unused spear_kbd_suspend(struct device *dev) ...@@ -326,7 +326,7 @@ static int __maybe_unused spear_kbd_suspend(struct device *dev)
} }
/* store current configuration */ /* store current configuration */
if (input_dev->users) if (input_device_enabled(input_dev))
kbd->mode_ctl_reg = mode_ctl_reg; kbd->mode_ctl_reg = mode_ctl_reg;
/* restore previous clk state */ /* restore previous clk state */
...@@ -351,12 +351,12 @@ static int __maybe_unused spear_kbd_resume(struct device *dev) ...@@ -351,12 +351,12 @@ static int __maybe_unused spear_kbd_resume(struct device *dev)
disable_irq_wake(kbd->irq); disable_irq_wake(kbd->irq);
} }
} else { } else {
if (input_dev->users) if (input_device_enabled(input_dev))
clk_enable(kbd->clk); clk_enable(kbd->clk);
} }
/* restore current configuration */ /* 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); writel_relaxed(kbd->mode_ctl_reg, kbd->io_base + MODE_CTL_REG);
mutex_unlock(&input_dev->mutex); mutex_unlock(&input_dev->mutex);
......
...@@ -221,7 +221,7 @@ static int keyscan_suspend(struct device *dev) ...@@ -221,7 +221,7 @@ static int keyscan_suspend(struct device *dev)
if (device_may_wakeup(dev)) if (device_may_wakeup(dev))
enable_irq_wake(keypad->irq); enable_irq_wake(keypad->irq);
else if (input->users) else if (input_device_enabled(input))
keyscan_stop(keypad); keyscan_stop(keypad);
mutex_unlock(&input->mutex); mutex_unlock(&input->mutex);
...@@ -239,7 +239,7 @@ static int keyscan_resume(struct device *dev) ...@@ -239,7 +239,7 @@ static int keyscan_resume(struct device *dev)
if (device_may_wakeup(dev)) if (device_may_wakeup(dev))
disable_irq_wake(keypad->irq); disable_irq_wake(keypad->irq);
else if (input->users) else if (input_device_enabled(input))
retval = keyscan_start(keypad); retval = keyscan_start(keypad);
mutex_unlock(&input->mutex); mutex_unlock(&input->mutex);
......
...@@ -756,7 +756,7 @@ static int tegra_kbc_suspend(struct device *dev) ...@@ -756,7 +756,7 @@ static int tegra_kbc_suspend(struct device *dev)
enable_irq(kbc->irq); enable_irq(kbc->irq);
enable_irq_wake(kbc->irq); enable_irq_wake(kbc->irq);
} else { } else {
if (kbc->idev->users) if (input_device_enabled(kbc->idev))
tegra_kbc_stop(kbc); tegra_kbc_stop(kbc);
} }
mutex_unlock(&kbc->idev->mutex); mutex_unlock(&kbc->idev->mutex);
...@@ -796,7 +796,7 @@ static int tegra_kbc_resume(struct device *dev) ...@@ -796,7 +796,7 @@ static int tegra_kbc_resume(struct device *dev)
input_sync(kbc->idev); input_sync(kbc->idev);
} }
} else { } else {
if (kbc->idev->users) if (input_device_enabled(kbc->idev))
err = tegra_kbc_start(kbc); err = tegra_kbc_start(kbc);
} }
mutex_unlock(&kbc->idev->mutex); mutex_unlock(&kbc->idev->mutex);
......
...@@ -580,7 +580,7 @@ static int __maybe_unused drv260x_suspend(struct device *dev) ...@@ -580,7 +580,7 @@ static int __maybe_unused drv260x_suspend(struct device *dev)
mutex_lock(&haptics->input_dev->mutex); mutex_lock(&haptics->input_dev->mutex);
if (haptics->input_dev->users) { if (input_device_enabled(haptics->input_dev)) {
ret = regmap_update_bits(haptics->regmap, ret = regmap_update_bits(haptics->regmap,
DRV260X_MODE, DRV260X_MODE,
DRV260X_STANDBY_MASK, DRV260X_STANDBY_MASK,
...@@ -612,7 +612,7 @@ static int __maybe_unused drv260x_resume(struct device *dev) ...@@ -612,7 +612,7 @@ static int __maybe_unused drv260x_resume(struct device *dev)
mutex_lock(&haptics->input_dev->mutex); mutex_lock(&haptics->input_dev->mutex);
if (haptics->input_dev->users) { if (input_device_enabled(haptics->input_dev)) {
ret = regulator_enable(haptics->regulator); ret = regulator_enable(haptics->regulator);
if (ret) { if (ret) {
dev_err(dev, "Failed to enable regulator\n"); dev_err(dev, "Failed to enable regulator\n");
......
...@@ -230,7 +230,7 @@ static int __maybe_unused drv2665_suspend(struct device *dev) ...@@ -230,7 +230,7 @@ static int __maybe_unused drv2665_suspend(struct device *dev)
mutex_lock(&haptics->input_dev->mutex); 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, ret = regmap_update_bits(haptics->regmap, DRV2665_CTRL_2,
DRV2665_STANDBY, DRV2665_STANDBY); DRV2665_STANDBY, DRV2665_STANDBY);
if (ret) { if (ret) {
...@@ -259,7 +259,7 @@ static int __maybe_unused drv2665_resume(struct device *dev) ...@@ -259,7 +259,7 @@ static int __maybe_unused drv2665_resume(struct device *dev)
mutex_lock(&haptics->input_dev->mutex); mutex_lock(&haptics->input_dev->mutex);
if (haptics->input_dev->users) { if (input_device_enabled(haptics->input_dev)) {
ret = regulator_enable(haptics->regulator); ret = regulator_enable(haptics->regulator);
if (ret) { if (ret) {
dev_err(dev, "Failed to enable regulator\n"); dev_err(dev, "Failed to enable regulator\n");
......
...@@ -407,7 +407,7 @@ static int __maybe_unused drv2667_suspend(struct device *dev) ...@@ -407,7 +407,7 @@ static int __maybe_unused drv2667_suspend(struct device *dev)
mutex_lock(&haptics->input_dev->mutex); 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, ret = regmap_update_bits(haptics->regmap, DRV2667_CTRL_2,
DRV2667_STANDBY, DRV2667_STANDBY); DRV2667_STANDBY, DRV2667_STANDBY);
if (ret) { if (ret) {
...@@ -436,7 +436,7 @@ static int __maybe_unused drv2667_resume(struct device *dev) ...@@ -436,7 +436,7 @@ static int __maybe_unused drv2667_resume(struct device *dev)
mutex_lock(&haptics->input_dev->mutex); mutex_lock(&haptics->input_dev->mutex);
if (haptics->input_dev->users) { if (input_device_enabled(haptics->input_dev)) {
ret = regulator_enable(haptics->regulator); ret = regulator_enable(haptics->regulator);
if (ret) { if (ret) {
dev_err(dev, "Failed to enable regulator\n"); dev_err(dev, "Failed to enable regulator\n");
......
...@@ -503,7 +503,7 @@ static int __maybe_unused kxtj9_suspend(struct device *dev) ...@@ -503,7 +503,7 @@ static int __maybe_unused kxtj9_suspend(struct device *dev)
mutex_lock(&input_dev->mutex); mutex_lock(&input_dev->mutex);
if (input_dev->users) if (input_device_enabled(input_dev))
kxtj9_disable(tj9); kxtj9_disable(tj9);
mutex_unlock(&input_dev->mutex); mutex_unlock(&input_dev->mutex);
...@@ -518,7 +518,7 @@ static int __maybe_unused kxtj9_resume(struct device *dev) ...@@ -518,7 +518,7 @@ static int __maybe_unused kxtj9_resume(struct device *dev)
mutex_lock(&input_dev->mutex); mutex_lock(&input_dev->mutex);
if (input_dev->users) if (input_device_enabled(input_dev))
kxtj9_enable(tj9); kxtj9_enable(tj9);
mutex_unlock(&input_dev->mutex); mutex_unlock(&input_dev->mutex);
......
...@@ -181,7 +181,7 @@ static int __maybe_unused sirfsoc_pwrc_resume(struct device *dev) ...@@ -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 * if users touch X_ONKEY_B, see arch/arm/mach-prima2/pm.c
*/ */
mutex_lock(&input->mutex); mutex_lock(&input->mutex);
if (input->users) if (input_device_enabled(input))
sirfsoc_pwrc_toggle_interrupts(pwrcdrv, true); sirfsoc_pwrc_toggle_interrupts(pwrcdrv, true);
mutex_unlock(&input->mutex); mutex_unlock(&input->mutex);
......
...@@ -526,7 +526,7 @@ static void cyapa_enable_irq_for_cmd(struct cyapa *cyapa) ...@@ -526,7 +526,7 @@ static void cyapa_enable_irq_for_cmd(struct cyapa *cyapa)
{ {
struct input_dev *input = cyapa->input; 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. * When input is NULL, TP must be in deep sleep mode.
* In this mode, later non-power I2C command will always failed * 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) ...@@ -546,7 +546,7 @@ static void cyapa_disable_irq_for_cmd(struct cyapa *cyapa)
{ {
struct input_dev *input = cyapa->input; struct input_dev *input = cyapa->input;
if (!input || !input->users) { if (!input || !input_device_enabled(input)) {
if (cyapa->gen >= CYAPA_GEN5) if (cyapa->gen >= CYAPA_GEN5)
disable_irq(cyapa->client->irq); disable_irq(cyapa->client->irq);
if (!input || cyapa->operational) if (!input || cyapa->operational)
...@@ -652,7 +652,7 @@ static int cyapa_reinitialize(struct cyapa *cyapa) ...@@ -652,7 +652,7 @@ static int cyapa_reinitialize(struct cyapa *cyapa)
} }
out: out:
if (!input || !input->users) { if (!input || !input_device_enabled(input)) {
/* Reset to power OFF state to save power when no user open. */ /* Reset to power OFF state to save power when no user open. */
if (cyapa->operational) if (cyapa->operational)
cyapa->ops->set_power_mode(cyapa, cyapa->ops->set_power_mode(cyapa,
......
...@@ -952,7 +952,8 @@ static int cyapa_gen3_set_power_mode(struct cyapa *cyapa, u8 power_mode, ...@@ -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 * doing so before issuing the next command may result in errors
* depending on the command's content. * 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_SUSPEND ||
pm_stage == CYAPA_PM_RUNTIME_RESUME)) { pm_stage == CYAPA_PM_RUNTIME_RESUME)) {
/* Try to polling in 120Hz, read may fail, just ignore it. */ /* Try to polling in 120Hz, read may fail, just ignore it. */
......
...@@ -518,7 +518,8 @@ int cyapa_empty_pip_output_data(struct cyapa *cyapa, ...@@ -518,7 +518,8 @@ int cyapa_empty_pip_output_data(struct cyapa *cyapa,
*len = length; *len = length;
/* Response found, success. */ /* Response found, success. */
return 0; 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_RESUME ||
pm_stage == CYAPA_PM_RUNTIME_SUSPEND)) { pm_stage == CYAPA_PM_RUNTIME_SUSPEND)) {
/* Parse the data and report it if it's valid. */ /* Parse the data and report it if it's valid. */
......
...@@ -322,7 +322,7 @@ static int __maybe_unused navpoint_suspend(struct device *dev) ...@@ -322,7 +322,7 @@ static int __maybe_unused navpoint_suspend(struct device *dev)
struct input_dev *input = navpoint->input; struct input_dev *input = navpoint->input;
mutex_lock(&input->mutex); mutex_lock(&input->mutex);
if (input->users) if (input_device_enabled(input))
navpoint_down(navpoint); navpoint_down(navpoint);
mutex_unlock(&input->mutex); mutex_unlock(&input->mutex);
...@@ -336,7 +336,7 @@ static int __maybe_unused navpoint_resume(struct device *dev) ...@@ -336,7 +336,7 @@ static int __maybe_unused navpoint_resume(struct device *dev)
struct input_dev *input = navpoint->input; struct input_dev *input = navpoint->input;
mutex_lock(&input->mutex); mutex_lock(&input->mutex);
if (input->users) if (input_device_enabled(input))
navpoint_up(navpoint); navpoint_up(navpoint);
mutex_unlock(&input->mutex); mutex_unlock(&input->mutex);
......
...@@ -306,7 +306,7 @@ static int __maybe_unused ad7879_suspend(struct device *dev) ...@@ -306,7 +306,7 @@ static int __maybe_unused ad7879_suspend(struct device *dev)
mutex_lock(&ts->input->mutex); 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); __ad7879_disable(ts);
ts->suspended = true; ts->suspended = true;
...@@ -322,7 +322,7 @@ static int __maybe_unused ad7879_resume(struct device *dev) ...@@ -322,7 +322,7 @@ static int __maybe_unused ad7879_resume(struct device *dev)
mutex_lock(&ts->input->mutex); 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); __ad7879_enable(ts);
ts->suspended = false; ts->suspended = false;
...@@ -339,7 +339,7 @@ static void ad7879_toggle(struct ad7879 *ts, bool disable) ...@@ -339,7 +339,7 @@ static void ad7879_toggle(struct ad7879 *ts, bool disable)
{ {
mutex_lock(&ts->input->mutex); mutex_lock(&ts->input->mutex);
if (!ts->suspended && ts->input->users != 0) { if (!ts->suspended && input_device_enabled(ts->input)) {
if (disable) { if (disable) {
if (ts->disabled) if (ts->disabled)
......
...@@ -3237,7 +3237,7 @@ static int __maybe_unused mxt_suspend(struct device *dev) ...@@ -3237,7 +3237,7 @@ static int __maybe_unused mxt_suspend(struct device *dev)
mutex_lock(&input_dev->mutex); mutex_lock(&input_dev->mutex);
if (input_dev->users) if (input_device_enabled(input_dev))
mxt_stop(data); mxt_stop(data);
mutex_unlock(&input_dev->mutex); mutex_unlock(&input_dev->mutex);
...@@ -3260,7 +3260,7 @@ static int __maybe_unused mxt_resume(struct device *dev) ...@@ -3260,7 +3260,7 @@ static int __maybe_unused mxt_resume(struct device *dev)
mutex_lock(&input_dev->mutex); mutex_lock(&input_dev->mutex);
if (input_dev->users) if (input_device_enabled(input_dev))
mxt_start(data); mxt_start(data);
mutex_unlock(&input_dev->mutex); mutex_unlock(&input_dev->mutex);
......
...@@ -414,7 +414,7 @@ static int __maybe_unused auo_pixcir_suspend(struct device *dev) ...@@ -414,7 +414,7 @@ static int __maybe_unused auo_pixcir_suspend(struct device *dev)
*/ */
if (device_may_wakeup(&client->dev)) { if (device_may_wakeup(&client->dev)) {
/* need to start device if not open, to be wakeup source */ /* need to start device if not open, to be wakeup source */
if (!input->users) { if (!input_device_enabled(input)) {
ret = auo_pixcir_start(ts); ret = auo_pixcir_start(ts);
if (ret) if (ret)
goto unlock; goto unlock;
...@@ -422,7 +422,7 @@ static int __maybe_unused auo_pixcir_suspend(struct device *dev) ...@@ -422,7 +422,7 @@ static int __maybe_unused auo_pixcir_suspend(struct device *dev)
enable_irq_wake(client->irq); enable_irq_wake(client->irq);
ret = auo_pixcir_power_mode(ts, AUO_PIXCIR_POWER_SLEEP); 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); ret = auo_pixcir_stop(ts);
} }
...@@ -445,14 +445,14 @@ static int __maybe_unused auo_pixcir_resume(struct device *dev) ...@@ -445,14 +445,14 @@ static int __maybe_unused auo_pixcir_resume(struct device *dev)
disable_irq_wake(client->irq); disable_irq_wake(client->irq);
/* need to stop device if it was not open on suspend */ /* need to stop device if it was not open on suspend */
if (!input->users) { if (!input_device_enabled(input)) {
ret = auo_pixcir_stop(ts); ret = auo_pixcir_stop(ts);
if (ret) if (ret)
goto unlock; goto unlock;
} }
/* device wakes automatically from SLEEP */ /* device wakes automatically from SLEEP */
} else if (input->users) { } else if (input_device_enabled(input)) {
ret = auo_pixcir_start(ts); ret = auo_pixcir_start(ts);
} }
......
...@@ -430,7 +430,7 @@ static int __maybe_unused bu21029_suspend(struct device *dev) ...@@ -430,7 +430,7 @@ static int __maybe_unused bu21029_suspend(struct device *dev)
if (!device_may_wakeup(dev)) { if (!device_may_wakeup(dev)) {
mutex_lock(&bu21029->in_dev->mutex); mutex_lock(&bu21029->in_dev->mutex);
if (bu21029->in_dev->users) if (input_device_enabled(bu21029->in_dev))
bu21029_stop_chip(bu21029->in_dev); bu21029_stop_chip(bu21029->in_dev);
mutex_unlock(&bu21029->in_dev->mutex); mutex_unlock(&bu21029->in_dev->mutex);
} }
...@@ -445,7 +445,7 @@ static int __maybe_unused bu21029_resume(struct device *dev) ...@@ -445,7 +445,7 @@ static int __maybe_unused bu21029_resume(struct device *dev)
if (!device_may_wakeup(dev)) { if (!device_may_wakeup(dev)) {
mutex_lock(&bu21029->in_dev->mutex); mutex_lock(&bu21029->in_dev->mutex);
if (bu21029->in_dev->users) if (input_device_enabled(bu21029->in_dev))
bu21029_start_chip(bu21029->in_dev); bu21029_start_chip(bu21029->in_dev);
mutex_unlock(&bu21029->in_dev->mutex); mutex_unlock(&bu21029->in_dev->mutex);
} }
......
...@@ -154,7 +154,7 @@ static int icn8318_suspend(struct device *dev) ...@@ -154,7 +154,7 @@ static int icn8318_suspend(struct device *dev)
struct icn8318_data *data = i2c_get_clientdata(to_i2c_client(dev)); struct icn8318_data *data = i2c_get_clientdata(to_i2c_client(dev));
mutex_lock(&data->input->mutex); mutex_lock(&data->input->mutex);
if (data->input->users) if (input_device_enabled(data->input))
icn8318_stop(data->input); icn8318_stop(data->input);
mutex_unlock(&data->input->mutex); mutex_unlock(&data->input->mutex);
...@@ -166,7 +166,7 @@ static int icn8318_resume(struct device *dev) ...@@ -166,7 +166,7 @@ static int icn8318_resume(struct device *dev)
struct icn8318_data *data = i2c_get_clientdata(to_i2c_client(dev)); struct icn8318_data *data = i2c_get_clientdata(to_i2c_client(dev));
mutex_lock(&data->input->mutex); mutex_lock(&data->input->mutex);
if (data->input->users) if (input_device_enabled(data->input))
icn8318_start(data->input); icn8318_start(data->input);
mutex_unlock(&data->input->mutex); mutex_unlock(&data->input->mutex);
......
...@@ -479,7 +479,7 @@ static int __maybe_unused cyttsp_suspend(struct device *dev) ...@@ -479,7 +479,7 @@ static int __maybe_unused cyttsp_suspend(struct device *dev)
mutex_lock(&ts->input->mutex); mutex_lock(&ts->input->mutex);
if (ts->input->users) { if (input_device_enabled(ts->input)) {
retval = cyttsp_disable(ts); retval = cyttsp_disable(ts);
if (retval == 0) if (retval == 0)
ts->suspended = true; ts->suspended = true;
...@@ -496,7 +496,7 @@ static int __maybe_unused cyttsp_resume(struct device *dev) ...@@ -496,7 +496,7 @@ static int __maybe_unused cyttsp_resume(struct device *dev)
mutex_lock(&ts->input->mutex); mutex_lock(&ts->input->mutex);
if (ts->input->users) if (input_device_enabled(ts->input))
cyttsp_enable(ts); cyttsp_enable(ts);
ts->suspended = false; ts->suspended = false;
......
...@@ -241,7 +241,7 @@ static int __maybe_unused eeti_ts_suspend(struct device *dev) ...@@ -241,7 +241,7 @@ static int __maybe_unused eeti_ts_suspend(struct device *dev)
mutex_lock(&input_dev->mutex); mutex_lock(&input_dev->mutex);
if (input_dev->users) if (input_device_enabled(input_dev))
eeti_ts_stop(eeti); eeti_ts_stop(eeti);
mutex_unlock(&input_dev->mutex); mutex_unlock(&input_dev->mutex);
...@@ -263,7 +263,7 @@ static int __maybe_unused eeti_ts_resume(struct device *dev) ...@@ -263,7 +263,7 @@ static int __maybe_unused eeti_ts_resume(struct device *dev)
mutex_lock(&input_dev->mutex); mutex_lock(&input_dev->mutex);
if (input_dev->users) if (input_device_enabled(input_dev))
eeti_ts_start(eeti); eeti_ts_start(eeti);
mutex_unlock(&input_dev->mutex); mutex_unlock(&input_dev->mutex);
......
...@@ -182,7 +182,7 @@ static int __maybe_unused ektf2127_suspend(struct device *dev) ...@@ -182,7 +182,7 @@ static int __maybe_unused ektf2127_suspend(struct device *dev)
struct ektf2127_ts *ts = i2c_get_clientdata(to_i2c_client(dev)); struct ektf2127_ts *ts = i2c_get_clientdata(to_i2c_client(dev));
mutex_lock(&ts->input->mutex); mutex_lock(&ts->input->mutex);
if (ts->input->users) if (input_device_enabled(ts->input))
ektf2127_stop(ts->input); ektf2127_stop(ts->input);
mutex_unlock(&ts->input->mutex); mutex_unlock(&ts->input->mutex);
...@@ -194,7 +194,7 @@ static int __maybe_unused ektf2127_resume(struct device *dev) ...@@ -194,7 +194,7 @@ static int __maybe_unused ektf2127_resume(struct device *dev)
struct ektf2127_ts *ts = i2c_get_clientdata(to_i2c_client(dev)); struct ektf2127_ts *ts = i2c_get_clientdata(to_i2c_client(dev));
mutex_lock(&ts->input->mutex); mutex_lock(&ts->input->mutex);
if (ts->input->users) if (input_device_enabled(ts->input))
ektf2127_start(ts->input); ektf2127_start(ts->input);
mutex_unlock(&ts->input->mutex); mutex_unlock(&ts->input->mutex);
......
...@@ -520,7 +520,7 @@ static int __maybe_unused imx6ul_tsc_suspend(struct device *dev) ...@@ -520,7 +520,7 @@ static int __maybe_unused imx6ul_tsc_suspend(struct device *dev)
mutex_lock(&input_dev->mutex); mutex_lock(&input_dev->mutex);
if (input_dev->users) if (input_device_enabled(input_dev))
imx6ul_tsc_stop(tsc); imx6ul_tsc_stop(tsc);
mutex_unlock(&input_dev->mutex); mutex_unlock(&input_dev->mutex);
...@@ -537,7 +537,7 @@ static int __maybe_unused imx6ul_tsc_resume(struct device *dev) ...@@ -537,7 +537,7 @@ static int __maybe_unused imx6ul_tsc_resume(struct device *dev)
mutex_lock(&input_dev->mutex); mutex_lock(&input_dev->mutex);
if (input_dev->users) if (input_device_enabled(input_dev))
retval = imx6ul_tsc_start(tsc); retval = imx6ul_tsc_start(tsc);
mutex_unlock(&input_dev->mutex); mutex_unlock(&input_dev->mutex);
......
...@@ -135,7 +135,7 @@ static int __maybe_unused micro_ts_resume(struct device *dev) ...@@ -135,7 +135,7 @@ static int __maybe_unused micro_ts_resume(struct device *dev)
mutex_lock(&input->mutex); mutex_lock(&input->mutex);
if (input->users) if (input_device_enabled(input))
micro_ts_toggle_receive(ts, true); micro_ts_toggle_receive(ts, true);
mutex_unlock(&input->mutex); mutex_unlock(&input->mutex);
......
...@@ -1017,7 +1017,7 @@ static int __maybe_unused iqs5xx_suspend(struct device *dev) ...@@ -1017,7 +1017,7 @@ static int __maybe_unused iqs5xx_suspend(struct device *dev)
mutex_lock(&input->mutex); mutex_lock(&input->mutex);
if (input->users) if (input_device_enabled(input))
error = iqs5xx_set_state(iqs5xx->client, IQS5XX_SUSPEND); error = iqs5xx_set_state(iqs5xx->client, IQS5XX_SUSPEND);
mutex_unlock(&input->mutex); mutex_unlock(&input->mutex);
...@@ -1036,7 +1036,7 @@ static int __maybe_unused iqs5xx_resume(struct device *dev) ...@@ -1036,7 +1036,7 @@ static int __maybe_unused iqs5xx_resume(struct device *dev)
mutex_lock(&input->mutex); mutex_lock(&input->mutex);
if (input->users) if (input_device_enabled(input))
error = iqs5xx_set_state(iqs5xx->client, IQS5XX_RESUME); error = iqs5xx_set_state(iqs5xx->client, IQS5XX_RESUME);
mutex_unlock(&input->mutex); mutex_unlock(&input->mutex);
......
...@@ -334,7 +334,7 @@ static int lpc32xx_ts_suspend(struct device *dev) ...@@ -334,7 +334,7 @@ static int lpc32xx_ts_suspend(struct device *dev)
*/ */
mutex_lock(&input->mutex); mutex_lock(&input->mutex);
if (input->users) { if (input_device_enabled(input)) {
if (device_may_wakeup(dev)) if (device_may_wakeup(dev))
enable_irq_wake(tsc->irq); enable_irq_wake(tsc->irq);
else else
...@@ -353,7 +353,7 @@ static int lpc32xx_ts_resume(struct device *dev) ...@@ -353,7 +353,7 @@ static int lpc32xx_ts_resume(struct device *dev)
mutex_lock(&input->mutex); mutex_lock(&input->mutex);
if (input->users) { if (input_device_enabled(input)) {
if (device_may_wakeup(dev)) if (device_may_wakeup(dev))
disable_irq_wake(tsc->irq); disable_irq_wake(tsc->irq);
else else
......
...@@ -1256,7 +1256,7 @@ static int mip4_execute_fw_update(struct mip4_ts *ts, const struct firmware *fw) ...@@ -1256,7 +1256,7 @@ static int mip4_execute_fw_update(struct mip4_ts *ts, const struct firmware *fw)
if (error) if (error)
return error; return error;
if (ts->input->users) { if (input_device_enabled(ts->input)) {
disable_irq(ts->client->irq); disable_irq(ts->client->irq);
} else { } else {
error = mip4_power_on(ts); error = mip4_power_on(ts);
...@@ -1276,7 +1276,7 @@ static int mip4_execute_fw_update(struct mip4_ts *ts, const struct firmware *fw) ...@@ -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); "Failed to flash firmware: %d\n", error);
/* Enable IRQ */ /* Enable IRQ */
if (ts->input->users) if (input_device_enabled(ts->input))
enable_irq(ts->client->irq); enable_irq(ts->client->irq);
else else
mip4_power_off(ts); mip4_power_off(ts);
...@@ -1539,7 +1539,7 @@ static int __maybe_unused mip4_suspend(struct device *dev) ...@@ -1539,7 +1539,7 @@ static int __maybe_unused mip4_suspend(struct device *dev)
if (device_may_wakeup(dev)) if (device_may_wakeup(dev))
ts->wake_irq_enabled = enable_irq_wake(client->irq) == 0; ts->wake_irq_enabled = enable_irq_wake(client->irq) == 0;
else if (input->users) else if (input_device_enabled(input))
mip4_disable(ts); mip4_disable(ts);
mutex_unlock(&input->mutex); mutex_unlock(&input->mutex);
...@@ -1557,7 +1557,7 @@ static int __maybe_unused mip4_resume(struct device *dev) ...@@ -1557,7 +1557,7 @@ static int __maybe_unused mip4_resume(struct device *dev)
if (ts->wake_irq_enabled) if (ts->wake_irq_enabled)
disable_irq_wake(client->irq); disable_irq_wake(client->irq);
else if (input->users) else if (input_device_enabled(input))
mip4_enable(ts); mip4_enable(ts);
mutex_unlock(&input->mutex); mutex_unlock(&input->mutex);
......
...@@ -199,7 +199,7 @@ static irqreturn_t mms114_interrupt(int irq, void *dev_id) ...@@ -199,7 +199,7 @@ static irqreturn_t mms114_interrupt(int irq, void *dev_id)
int error; int error;
mutex_lock(&input_dev->mutex); mutex_lock(&input_dev->mutex);
if (!input_dev->users) { if (!input_device_enabled(input_dev)) {
mutex_unlock(&input_dev->mutex); mutex_unlock(&input_dev->mutex);
goto out; goto out;
} }
...@@ -564,7 +564,7 @@ static int __maybe_unused mms114_suspend(struct device *dev) ...@@ -564,7 +564,7 @@ static int __maybe_unused mms114_suspend(struct device *dev)
input_sync(input_dev); input_sync(input_dev);
mutex_lock(&input_dev->mutex); mutex_lock(&input_dev->mutex);
if (input_dev->users) if (input_device_enabled(input_dev))
mms114_stop(data); mms114_stop(data);
mutex_unlock(&input_dev->mutex); mutex_unlock(&input_dev->mutex);
...@@ -579,7 +579,7 @@ static int __maybe_unused mms114_resume(struct device *dev) ...@@ -579,7 +579,7 @@ static int __maybe_unused mms114_resume(struct device *dev)
int error; int error;
mutex_lock(&input_dev->mutex); mutex_lock(&input_dev->mutex);
if (input_dev->users) { if (input_device_enabled(input_dev)) {
error = mms114_start(data); error = mms114_start(data);
if (error < 0) { if (error < 0) {
mutex_unlock(&input_dev->mutex); mutex_unlock(&input_dev->mutex);
......
...@@ -415,14 +415,14 @@ static int __maybe_unused pixcir_i2c_ts_suspend(struct device *dev) ...@@ -415,14 +415,14 @@ static int __maybe_unused pixcir_i2c_ts_suspend(struct device *dev)
mutex_lock(&input->mutex); mutex_lock(&input->mutex);
if (device_may_wakeup(&client->dev)) { if (device_may_wakeup(&client->dev)) {
if (!input->users) { if (!input_device_enabled(input)) {
ret = pixcir_start(ts); ret = pixcir_start(ts);
if (ret) { if (ret) {
dev_err(dev, "Failed to start\n"); dev_err(dev, "Failed to start\n");
goto unlock; goto unlock;
} }
} }
} else if (input->users) { } else if (input_device_enabled(input)) {
ret = pixcir_stop(ts); ret = pixcir_stop(ts);
} }
...@@ -442,14 +442,14 @@ static int __maybe_unused pixcir_i2c_ts_resume(struct device *dev) ...@@ -442,14 +442,14 @@ static int __maybe_unused pixcir_i2c_ts_resume(struct device *dev)
mutex_lock(&input->mutex); mutex_lock(&input->mutex);
if (device_may_wakeup(&client->dev)) { if (device_may_wakeup(&client->dev)) {
if (!input->users) { if (!input_device_enabled(input)) {
ret = pixcir_stop(ts); ret = pixcir_stop(ts);
if (ret) { if (ret) {
dev_err(dev, "Failed to stop\n"); dev_err(dev, "Failed to stop\n");
goto unlock; goto unlock;
} }
} }
} else if (input->users) { } else if (input_device_enabled(input)) {
ret = pixcir_start(ts); ret = pixcir_start(ts);
} }
......
...@@ -410,7 +410,7 @@ static int __maybe_unused ucb1400_ts_suspend(struct device *dev) ...@@ -410,7 +410,7 @@ static int __maybe_unused ucb1400_ts_suspend(struct device *dev)
mutex_lock(&idev->mutex); mutex_lock(&idev->mutex);
if (idev->users) if (input_device_enabled(idev))
ucb1400_ts_stop(ucb); ucb1400_ts_stop(ucb);
mutex_unlock(&idev->mutex); mutex_unlock(&idev->mutex);
...@@ -424,7 +424,7 @@ static int __maybe_unused ucb1400_ts_resume(struct device *dev) ...@@ -424,7 +424,7 @@ static int __maybe_unused ucb1400_ts_resume(struct device *dev)
mutex_lock(&idev->mutex); mutex_lock(&idev->mutex);
if (idev->users) if (input_device_enabled(idev))
ucb1400_ts_start(ucb); ucb1400_ts_start(ucb);
mutex_unlock(&idev->mutex); mutex_unlock(&idev->mutex);
......
...@@ -806,23 +806,25 @@ static int __maybe_unused wm97xx_suspend(struct device *dev) ...@@ -806,23 +806,25 @@ static int __maybe_unused wm97xx_suspend(struct device *dev)
else else
suspend_mode = 0; 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); cancel_delayed_work_sync(&wm->ts_reader);
/* Power down the digitiser (bypassing the cache for resume) */ /* Power down the digitiser (bypassing the cache for resume) */
reg = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER2); reg = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER2);
reg &= ~WM97XX_PRP_DET_DIG; reg &= ~WM97XX_PRP_DET_DIG;
if (wm->input_dev->users) if (input_device_enabled(wm->input_dev))
reg |= suspend_mode; reg |= suspend_mode;
wm->ac97->bus->ops->write(wm->ac97, AC97_WM97XX_DIGITISER2, reg); wm->ac97->bus->ops->write(wm->ac97, AC97_WM97XX_DIGITISER2, reg);
/* WM9713 has an additional power bit - turn it off if there /* WM9713 has an additional power bit - turn it off if there
* are no users or if suspend mode is zero. */ * are no users or if suspend mode is zero. */
if (wm->id == WM9713_ID2 && 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; reg = wm97xx_reg_read(wm, AC97_EXTENDED_MID) | 0x8000;
wm97xx_reg_write(wm, AC97_EXTENDED_MID, reg); wm97xx_reg_write(wm, AC97_EXTENDED_MID, reg);
} }
mutex_unlock(&wm->input_dev->mutex);
return 0; return 0;
} }
...@@ -831,11 +833,12 @@ static int __maybe_unused wm97xx_resume(struct device *dev) ...@@ -831,11 +833,12 @@ static int __maybe_unused wm97xx_resume(struct device *dev)
{ {
struct wm97xx *wm = dev_get_drvdata(dev); struct wm97xx *wm = dev_get_drvdata(dev);
mutex_lock(&wm->input_dev->mutex);
/* restore digitiser and gpios */ /* restore digitiser and gpios */
if (wm->id == WM9713_ID2) { if (wm->id == WM9713_ID2) {
wm97xx_reg_write(wm, AC97_WM9713_DIG1, wm->dig[0]); wm97xx_reg_write(wm, AC97_WM9713_DIG1, wm->dig[0]);
wm97xx_reg_write(wm, 0x5a, wm->misc); wm97xx_reg_write(wm, 0x5a, wm->misc);
if (wm->input_dev->users) { if (input_device_enabled(wm->input_dev)) {
u16 reg; u16 reg;
reg = wm97xx_reg_read(wm, AC97_EXTENDED_MID) & 0x7fff; reg = wm97xx_reg_read(wm, AC97_EXTENDED_MID) & 0x7fff;
wm97xx_reg_write(wm, AC97_EXTENDED_MID, reg); wm97xx_reg_write(wm, AC97_EXTENDED_MID, reg);
...@@ -852,11 +855,12 @@ static int __maybe_unused wm97xx_resume(struct device *dev) ...@@ -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_GPIO_STATUS, wm->gpio[4]);
wm97xx_reg_write(wm, AC97_MISC_AFE, wm->gpio[5]); 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; wm->ts_reader_interval = wm->ts_reader_min_interval;
queue_delayed_work(wm->ts_workq, &wm->ts_reader, queue_delayed_work(wm->ts_workq, &wm->ts_reader,
wm->ts_reader_interval); wm->ts_reader_interval);
} }
mutex_unlock(&wm->input_dev->mutex);
return 0; return 0;
} }
......
...@@ -626,14 +626,14 @@ static int __maybe_unused zforce_suspend(struct device *dev) ...@@ -626,14 +626,14 @@ static int __maybe_unused zforce_suspend(struct device *dev)
dev_dbg(&client->dev, "suspend while being a wakeup source\n"); dev_dbg(&client->dev, "suspend while being a wakeup source\n");
/* Need to start device, if not open, to be a wakeup source. */ /* Need to start device, if not open, to be a wakeup source. */
if (!input->users) { if (!input_device_enabled(input)) {
ret = zforce_start(ts); ret = zforce_start(ts);
if (ret) if (ret)
goto unlock; goto unlock;
} }
enable_irq_wake(client->irq); enable_irq_wake(client->irq);
} else if (input->users) { } else if (input_device_enabled(input)) {
dev_dbg(&client->dev, dev_dbg(&client->dev,
"suspend without being a wakeup source\n"); "suspend without being a wakeup source\n");
...@@ -670,12 +670,12 @@ static int __maybe_unused zforce_resume(struct device *dev) ...@@ -670,12 +670,12 @@ static int __maybe_unused zforce_resume(struct device *dev)
disable_irq_wake(client->irq); disable_irq_wake(client->irq);
/* need to stop device if it was not open on suspend */ /* need to stop device if it was not open on suspend */
if (!input->users) { if (!input_device_enabled(input)) {
ret = zforce_stop(ts); ret = zforce_stop(ts);
if (ret) if (ret)
goto unlock; goto unlock;
} }
} else if (input->users) { } else if (input_device_enabled(input)) {
dev_dbg(&client->dev, "resume without being a wakeup source\n"); dev_dbg(&client->dev, "resume without being a wakeup source\n");
enable_irq(client->irq); enable_irq(client->irq);
......
...@@ -532,7 +532,7 @@ static int __maybe_unused zinitix_suspend(struct device *dev) ...@@ -532,7 +532,7 @@ static int __maybe_unused zinitix_suspend(struct device *dev)
mutex_lock(&bt541->input_dev->mutex); mutex_lock(&bt541->input_dev->mutex);
if (bt541->input_dev->users) if (input_device_enabled(bt541->input_dev))
zinitix_stop(bt541); zinitix_stop(bt541);
mutex_unlock(&bt541->input_dev->mutex); mutex_unlock(&bt541->input_dev->mutex);
...@@ -548,7 +548,7 @@ static int __maybe_unused zinitix_resume(struct device *dev) ...@@ -548,7 +548,7 @@ static int __maybe_unused zinitix_resume(struct device *dev)
mutex_lock(&bt541->input_dev->mutex); mutex_lock(&bt541->input_dev->mutex);
if (bt541->input_dev->users) if (input_device_enabled(bt541->input_dev))
ret = zinitix_start(bt541); ret = zinitix_start(bt541);
mutex_unlock(&bt541->input_dev->mutex); mutex_unlock(&bt541->input_dev->mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment