Skip to contentSkip to conversation

Input: synaptics_i2c - remove redundant spinlock

PATCH Superseded [email protected] 2 participants 2 messages Feb 12, 2019 – Feb 17, 2019

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Input: synaptics_i2c - remove redundant spinlock

From: Sven Van Asbroeck <[email protected]>

Remove a leftover spinlock.

This was required back when mod_delayed_work() did not exist, and had to be implemented with a cancel + schedule. See commit e7c2f967445d ("workqueue: use mod_delayed_work() instead of __cancel + queue")

schedule_delayed_work() and mod_delayed_work() can now be used concurrently. So the spinlock is no longer needed.

---
 drivers/input/mouse/synaptics_i2c.c | 8 --------
 1 file changed, 8 deletions(-)
drivers/input/mouse/synaptics_i2c.c +0 -8
index 8538318d332c..2b2230984ad5 100644
@@ -219,7 +219,6 @@ struct synaptics_i2c {
 	struct i2c_client	*client;
 	struct input_dev	*input;
 	struct delayed_work	dwork;
-	spinlock_t		lock;
 	int			no_data_count;
 	int			no_decel_param;
 	int			reduce_report_param;
@@ -372,13 +371,7 @@ static bool synaptics_i2c_get_input(struct synaptics_i2c *touch)
 static void synaptics_i2c_reschedule_work(struct synaptics_i2c *touch,
 					  unsigned long delay)
 {
-	unsigned long flags;
-
-	spin_lock_irqsave(&touch->lock, flags);
-
 	mod_delayed_work(system_wq, &touch->dwork, delay);
-
-	spin_unlock_irqrestore(&touch->lock, flags);
 }
 
 static irqreturn_t synaptics_i2c_irq(int irq, void *dev_id)
@@ -530,7 +523,6 @@ static struct synaptics_i2c *synaptics_i2c_touch_create(struct i2c_client *clien
 	touch->scan_rate_param = scan_rate;
 	set_scan_rate(touch, scan_rate);
 	INIT_DELAYED_WORK(&touch->dwork, synaptics_i2c_work_handler);
-	spin_lock_init(&touch->lock);
 
 	return touch;
 }
Signature · 1 line
2.17.1
maintainer
#1 lore raw

Hi Sven,

drivers/input/mouse/synaptics_i2c.c static bool synaptics_i2c_get_input(struct synaptics_i2c *touch) · line 375

Quoted 12 lines · On Mon, Feb 11, 2019 at 08:34:42PM -0500, [email protected] wrote:
drivers/input/mouse/synaptics_i2c.c +0 -6
@@ -372,13 +371,7 @@ static bool synaptics_i2c_get_input(struct synaptics_i2c *touch)
 static void synaptics_i2c_reschedule_work(struct synaptics_i2c *touch,
 					  unsigned long delay)
 {
-	unsigned long flags;
-
-	spin_lock_irqsave(&touch->lock, flags);
-
 	mod_delayed_work(system_wq, &touch->dwork, delay);
-
-	spin_unlock_irqrestore(&touch->lock, flags);
 }

This makes synaptics_i2c_reschedule_work() a useless wrapper for mod_delayed_work(). Can we get rid of it?

Thanks.

Signature · 1 line
Dmitry