Input: use input_device_enabled()
Use the newly added helper in relevant input drivers. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> Link: https://lore.kernel.org/r/20200608112211.12125-3-andrzej.p@collabora.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
committed by
Dmitry Torokhov
parent
39be39ceff
commit
d69f0a43c6
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user