[PATCH v2] Input: synaptics_i2c - guard polling restart in resume

Minseong Kim posted 1 patch 2 weeks, 3 days ago
drivers/input/mouse/synaptics_i2c.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
[PATCH v2] Input: synaptics_i2c - guard polling restart in resume
Posted by Minseong Kim 2 weeks, 3 days ago
synaptics_i2c_resume() restarts delayed work unconditionally, even when
the input device is not opened. Guard the polling restart by taking the
input device mutex and checking input_device_enabled() before re-queuing
the delayed work.

Fixes: eef3e4cab72ea ("Input: add driver for Synaptics I2C touchpad")
Cc: stable@vger.kernel.org
Signed-off-by: Minseong Kim <ii4gsp@gmail.com>
---
 drivers/input/mouse/synaptics_i2c.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/input/mouse/synaptics_i2c.c b/drivers/input/mouse/synaptics_i2c.c
index a0d707e47d93..fc65e28c1b31 100644
--- a/drivers/input/mouse/synaptics_i2c.c
+++ b/drivers/input/mouse/synaptics_i2c.c
@@ -615,13 +615,17 @@ static int synaptics_i2c_resume(struct device *dev)
 	int ret;
 	struct i2c_client *client = to_i2c_client(dev);
 	struct synaptics_i2c *touch = i2c_get_clientdata(client);
+	struct input_dev *input = touch->input;
 
 	ret = synaptics_i2c_reset_config(client);
 	if (ret)
 		return ret;
 
-	mod_delayed_work(system_wq, &touch->dwork,
+	mutex_lock(&input->mutex);
+	if (input_device_enabled(input))
+		mod_delayed_work(system_wq, &touch->dwork,
 				msecs_to_jiffies(NO_DATA_SLEEP_MSECS));
+	mutex_unlock(&input->mutex);
 
 	return 0;
 }
-- 
2.48.1
Re: [PATCH v2] Input: synaptics_i2c - guard polling restart in resume
Posted by Dmitry Torokhov 2 weeks, 2 days ago
Hi Minseong,

On Wed, Jan 21, 2026 at 03:37:38PM +0900, Minseong Kim wrote:
> synaptics_i2c_resume() restarts delayed work unconditionally, even when
> the input device is not opened. Guard the polling restart by taking the
> input device mutex and checking input_device_enabled() before re-queuing
> the delayed work.
> 
> Fixes: eef3e4cab72ea ("Input: add driver for Synaptics I2C touchpad")
> Cc: stable@vger.kernel.org
> Signed-off-by: Minseong Kim <ii4gsp@gmail.com>
> ---
>  drivers/input/mouse/synaptics_i2c.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/input/mouse/synaptics_i2c.c b/drivers/input/mouse/synaptics_i2c.c
> index a0d707e47d93..fc65e28c1b31 100644
> --- a/drivers/input/mouse/synaptics_i2c.c
> +++ b/drivers/input/mouse/synaptics_i2c.c
> @@ -615,13 +615,17 @@ static int synaptics_i2c_resume(struct device *dev)
>  	int ret;
>  	struct i2c_client *client = to_i2c_client(dev);
>  	struct synaptics_i2c *touch = i2c_get_clientdata(client);
> +	struct input_dev *input = touch->input;
>  
>  	ret = synaptics_i2c_reset_config(client);
>  	if (ret)
>  		return ret;
>  
> -	mod_delayed_work(system_wq, &touch->dwork,
> +	mutex_lock(&input->mutex);

This can be

	guard(mutex)(&input->mutex);

> +	if (input_device_enabled(input))
> +		mod_delayed_work(system_wq, &touch->dwork,
>  				msecs_to_jiffies(NO_DATA_SLEEP_MSECS));
> +	mutex_unlock(&input->mutex);
>  
>  	return 0;
>  }

I made the adjustment and applied.

Thanks.

-- 
Dmitry