Skip to contentSkip to conversation

Input:Flush client events after clk_type change

PATCH In review Anshul Garg 2 participants 2 messages Jan 6, 2015 – Jan 7, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Input:Flush client events after clk_type change

From: Anshul Garg <[email protected]>

Since the client clk_type is changed , flush pending events from client buffer and queue SYN_DROPPED event. Added check for duplicate clk_type change request.

---
 drivers/input/evdev.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/input/evdev.c +8 -1
index b1a52ab..91330e1 100644
@@ -64,6 +64,9 @@ struct evdev_client {
 
 static int evdev_set_clk_type(struct evdev_client *client, unsigned int clkid)
 {
+	if (client->clk_type == clkid)
+		return 0;
+
 	switch (clkid) {
 
 	case CLOCK_REALTIME:
@@ -78,7 +81,11 @@ static int evdev_set_clk_type(struct evdev_client *client, unsigned int clkid)
 	default:
 		return -EINVAL;
 	}
-
+
+	/* Flush clients events after clk_type is changed
+	 * and queue SYN_DROPPED event.*/
+	client->packet_head = client->head = client->tail;
+	evdev_queue_syn_dropped(client);
 	return 0;
 }
 
Signature · 6 lines
1.7.9.5


---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com
maintainer
#1 lore raw
Quoted 26 lines · Anshul Garg

From: Anshul Garg <[email protected]>

Since the client clk_type is changed , flush pending events from client buffer and queue SYN_DROPPED event. Added check for duplicate clk_type change request.

---
 drivers/input/evdev.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/input/evdev.c +3 -0
index b1a52ab..91330e1 100644
@@ -64,6 +64,9 @@ struct evdev_client {
 
 static int evdev_set_clk_type(struct evdev_client *client, unsigned int clkid)
 {
+	if (client->clk_type == clkid)
+		return 0;
+
 	switch (clkid) {
 
 	case CLOCK_REALTIME:

drivers/input/evdev.c static int evdev_set_clk_type(struct evdev_client *client, unsigned int clkid) · line 88

Quoted 9 lines
drivers/input/evdev.c +5 -1
@@ -78,7 +81,11 @@ static int evdev_set_clk_type(struct evdev_client *client, unsigned int clkid)
 	default:
 		return -EINVAL;
 	}
-
+
+	/* Flush clients events after clk_type is changed
+	 * and queue SYN_DROPPED event.*/
+	client->packet_head = client->head = client->tail;
+	evdev_queue_syn_dropped(client);

I am fairly certain this is racy wrt the new events coming from the device.

Thanks.

Signature · 1 line
Dmitry