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.

Signed-off-by: Anshul Garg <[email protected]>
---
 drivers/input/evdev.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index b1a52ab..91330e1 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -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;
 }
 
-- 
1.7.9.5


---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to