* [PATCH] Input:Flush client events after clk_type change [not found] <anshul.g> @ 2015-01-06 14:02 ` Anshul Garg 2015-01-07 0:41 ` Dmitry Torokhov 0 siblings, 1 reply; 2+ messages in thread From: Anshul Garg @ 2015-01-06 14:02 UTC (permalink / raw) To: dmitry.torokhov, dtor, linux-input; +Cc: aksgarg1989, anshul.g From: Anshul Garg <aksgarg1989@gmail.com> 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 <anshul.g@samsung.com> --- 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 ^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Input:Flush client events after clk_type change 2015-01-06 14:02 ` [PATCH] Input:Flush client events after clk_type change Anshul Garg @ 2015-01-07 0:41 ` Dmitry Torokhov 0 siblings, 0 replies; 2+ messages in thread From: Dmitry Torokhov @ 2015-01-07 0:41 UTC (permalink / raw) To: Anshul Garg; +Cc: linux-input, anshul.g On Tue, Jan 06, 2015 at 06:02:33AM -0800, Anshul Garg wrote: > From: Anshul Garg <aksgarg1989@gmail.com> > > 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 <anshul.g@samsung.com> > --- > 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); I am fairly certain this is racy wrt the new events coming from the device. Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-07 0:41 UTC | newest] Thread overview: 2+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <anshul.g> 2015-01-06 14:02 ` [PATCH] Input:Flush client events after clk_type change Anshul Garg 2015-01-07 0:41 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).