* [PATCH] Evdev: Fix bug in checking duplicate clock change request @ 2015-10-28 20:08 Aniroop Mathur 2015-10-30 11:15 ` Dmitry Torokhov 0 siblings, 1 reply; 4+ messages in thread From: Aniroop Mathur @ 2015-10-28 20:08 UTC (permalink / raw) To: dmitry.torokhov, linux-input, linux-kernel; +Cc: aniroop.mathur, a.mathur From: Aniroop Mathur <a.mathur@samsung.com> clk_type and clkid stores different predefined clock identification values so they cannot be compared for checking duplicate clock change request. Therefore, lets fix it to avoid unexpected results. Signed-off-by: Aniroop Mathur <a.mathur@samsung.com> Signed-off-by: Aniroop Mathur <aniroop.mathur@gmail.com> --- drivers/input/evdev.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 08d4964..0d40f6f 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c @@ -56,7 +56,7 @@ struct evdev_client { struct fasync_struct *fasync; struct evdev *evdev; struct list_head node; - int clk_type; + unsigned int clk_type; bool revoked; unsigned int bufsize; struct input_event buffer[]; @@ -146,9 +146,7 @@ static void evdev_queue_syn_dropped(struct evdev_client *client) static int evdev_set_clk_type(struct evdev_client *client, unsigned int clkid) { unsigned long flags; - - if (client->clk_type == clkid) - return 0; + unsigned int prev_clk_type = client->clk_type; switch (clkid) { @@ -165,6 +163,10 @@ static int evdev_set_clk_type(struct evdev_client *client, unsigned int clkid) return -EINVAL; } + /* No need to flush if clk_type is same as before */ + if (client->clk_type == prev_clk_type) + return 0; + /* * Flush pending events and queue SYN_DROPPED event, * but only if the queue is not empty. -- 2.6.2 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Evdev: Fix bug in checking duplicate clock change request 2015-10-28 20:08 [PATCH] Evdev: Fix bug in checking duplicate clock change request Aniroop Mathur @ 2015-10-30 11:15 ` Dmitry Torokhov 2015-10-30 13:04 ` Aniroop Mathur 0 siblings, 1 reply; 4+ messages in thread From: Dmitry Torokhov @ 2015-10-30 11:15 UTC (permalink / raw) To: Aniroop Mathur; +Cc: linux-input, linux-kernel, aniroop.mathur Hi Aniroop, On Thu, Oct 29, 2015 at 01:38:32AM +0530, Aniroop Mathur wrote: > From: Aniroop Mathur <a.mathur@samsung.com> > > clk_type and clkid stores different predefined clock identification > values so they cannot be compared for checking duplicate clock change > request. Therefore, lets fix it to avoid unexpected results. Good catch! > > Signed-off-by: Aniroop Mathur <a.mathur@samsung.com> > Signed-off-by: Aniroop Mathur <aniroop.mathur@gmail.com> You only need one signoff, which one should I keep? The Samsung one? > --- > drivers/input/evdev.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c > index 08d4964..0d40f6f 100644 > --- a/drivers/input/evdev.c > +++ b/drivers/input/evdev.c > @@ -56,7 +56,7 @@ struct evdev_client { > struct fasync_struct *fasync; > struct evdev *evdev; > struct list_head node; > - int clk_type; > + unsigned int clk_type; > bool revoked; > unsigned int bufsize; > struct input_event buffer[]; > @@ -146,9 +146,7 @@ static void evdev_queue_syn_dropped(struct evdev_client *client) > static int evdev_set_clk_type(struct evdev_client *client, unsigned int clkid) > { > unsigned long flags; > - > - if (client->clk_type == clkid) > - return 0; > + unsigned int prev_clk_type = client->clk_type; I prefer the other way around: convert to a temp and then compare. I;ll fix it up on my side. > > switch (clkid) { > > @@ -165,6 +163,10 @@ static int evdev_set_clk_type(struct evdev_client *client, unsigned int clkid) > return -EINVAL; > } > > + /* No need to flush if clk_type is same as before */ > + if (client->clk_type == prev_clk_type) > + return 0; > + > /* > * Flush pending events and queue SYN_DROPPED event, > * but only if the queue is not empty. > -- > 2.6.2 > Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Evdev: Fix bug in checking duplicate clock change request 2015-10-30 11:15 ` Dmitry Torokhov @ 2015-10-30 13:04 ` Aniroop Mathur 2015-10-30 17:47 ` Aniroop Mathur 0 siblings, 1 reply; 4+ messages in thread From: Aniroop Mathur @ 2015-10-30 13:04 UTC (permalink / raw) To: Dmitry Torokhov Cc: Aniroop Mathur, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Hello Mr. Torokhov, On Fri, Oct 30, 2015 at 4:45 PM, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote: > Hi Aniroop, > > On Thu, Oct 29, 2015 at 01:38:32AM +0530, Aniroop Mathur wrote: >> From: Aniroop Mathur <a.mathur@samsung.com> >> >> clk_type and clkid stores different predefined clock identification >> values so they cannot be compared for checking duplicate clock change >> request. Therefore, lets fix it to avoid unexpected results. > > Good catch! > Thank you :) >> >> Signed-off-by: Aniroop Mathur <a.mathur@samsung.com> >> Signed-off-by: Aniroop Mathur <aniroop.mathur@gmail.com> > > You only need one signoff, which one should I keep? The Samsung one? > Yes, Samsung one. >> --- >> drivers/input/evdev.c | 10 ++++++---- >> 1 file changed, 6 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c >> index 08d4964..0d40f6f 100644 >> --- a/drivers/input/evdev.c >> +++ b/drivers/input/evdev.c >> @@ -56,7 +56,7 @@ struct evdev_client { >> struct fasync_struct *fasync; >> struct evdev *evdev; >> struct list_head node; >> - int clk_type; >> + unsigned int clk_type; >> bool revoked; >> unsigned int bufsize; >> struct input_event buffer[]; >> @@ -146,9 +146,7 @@ static void evdev_queue_syn_dropped(struct evdev_client *client) >> static int evdev_set_clk_type(struct evdev_client *client, unsigned int clkid) >> { >> unsigned long flags; >> - >> - if (client->clk_type == clkid) >> - return 0; >> + unsigned int prev_clk_type = client->clk_type; > > I prefer the other way around: convert to a temp and then compare. I;ll > fix it up on my side. > I thought that was the only better way of all. I am not sure what exactly you're referring. I guess I need little more elaboration here or anyways, I'll check it up up once you apply it. >> >> switch (clkid) { >> >> @@ -165,6 +163,10 @@ static int evdev_set_clk_type(struct evdev_client *client, unsigned int clkid) >> return -EINVAL; >> } >> >> + /* No need to flush if clk_type is same as before */ >> + if (client->clk_type == prev_clk_type) >> + return 0; >> + >> /* >> * Flush pending events and queue SYN_DROPPED event, >> * but only if the queue is not empty. >> -- >> 2.6.2 >> > > Thanks. > > -- > Dmitry Regards, Aniroop ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Evdev: Fix bug in checking duplicate clock change request 2015-10-30 13:04 ` Aniroop Mathur @ 2015-10-30 17:47 ` Aniroop Mathur 0 siblings, 0 replies; 4+ messages in thread From: Aniroop Mathur @ 2015-10-30 17:47 UTC (permalink / raw) To: Dmitry Torokhov Cc: Aniroop Mathur, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org On Fri, Oct 30, 2015 at 6:34 PM, Aniroop Mathur <aniroop.mathur@gmail.com> wrote: > > Hello Mr. Torokhov, > > On Fri, Oct 30, 2015 at 4:45 PM, Dmitry Torokhov > <dmitry.torokhov@gmail.com> wrote: > > Hi Aniroop, > > > > On Thu, Oct 29, 2015 at 01:38:32AM +0530, Aniroop Mathur wrote: > >> From: Aniroop Mathur <a.mathur@samsung.com> > >> > >> clk_type and clkid stores different predefined clock identification > >> values so they cannot be compared for checking duplicate clock change > >> request. Therefore, lets fix it to avoid unexpected results. > > > > Good catch! > > > > Thank you :) > > >> > >> Signed-off-by: Aniroop Mathur <a.mathur@samsung.com> > >> Signed-off-by: Aniroop Mathur <aniroop.mathur@gmail.com> > > > > You only need one signoff, which one should I keep? The Samsung one? > > > > Yes, Samsung one. > > >> --- > >> drivers/input/evdev.c | 10 ++++++---- > >> 1 file changed, 6 insertions(+), 4 deletions(-) > >> > >> diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c > >> index 08d4964..0d40f6f 100644 > >> --- a/drivers/input/evdev.c > >> +++ b/drivers/input/evdev.c > >> @@ -56,7 +56,7 @@ struct evdev_client { > >> struct fasync_struct *fasync; > >> struct evdev *evdev; > >> struct list_head node; > >> - int clk_type; > >> + unsigned int clk_type; > >> bool revoked; > >> unsigned int bufsize; > >> struct input_event buffer[]; > >> @@ -146,9 +146,7 @@ static void evdev_queue_syn_dropped(struct evdev_client *client) > >> static int evdev_set_clk_type(struct evdev_client *client, unsigned int clkid) > >> { > >> unsigned long flags; > >> - > >> - if (client->clk_type == clkid) > >> - return 0; > >> + unsigned int prev_clk_type = client->clk_type; > > > > I prefer the other way around: convert to a temp and then compare. I;ll > > fix it up on my side. > > > > I thought that was the only better way of all. > I am not sure what exactly you're referring. I guess I need little > more elaboration here or anyways, I'll check it up up once you apply > it. Ahhh okay... I got the other way around. (Filling client->clk_type in the end instead) > > > > >> > >> switch (clkid) { > >> > >> @@ -165,6 +163,10 @@ static int evdev_set_clk_type(struct evdev_client *client, unsigned int clkid) > >> return -EINVAL; > >> } > >> > >> + /* No need to flush if clk_type is same as before */ > >> + if (client->clk_type == prev_clk_type) > >> + return 0; > >> + > >> /* > >> * Flush pending events and queue SYN_DROPPED event, > >> * but only if the queue is not empty. > >> -- > >> 2.6.2 > >> > > > > Thanks. > > > > -- > > Dmitry > > Regards, > Aniroop ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-10-30 17:47 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-10-28 20:08 [PATCH] Evdev: Fix bug in checking duplicate clock change request Aniroop Mathur 2015-10-30 11:15 ` Dmitry Torokhov 2015-10-30 13:04 ` Aniroop Mathur 2015-10-30 17:47 ` Aniroop Mathur
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).