linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Anshul Garg <aksgarg1989@gmail.com>
Cc: linux-input@vger.kernel.org, anshul.g@samsung.com
Subject: Re: [PATCH] Input:Flush client events after clk_type change
Date: Tue, 6 Jan 2015 16:41:33 -0800	[thread overview]
Message-ID: <20150107004133.GC12798@dtor-ws> (raw)
In-Reply-To: <1420552953-23932-1-git-send-email-aksgarg1989@gmail.com>

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

      reply	other threads:[~2015-01-07  0:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150107004133.GC12798@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=aksgarg1989@gmail.com \
    --cc=anshul.g@samsung.com \
    --cc=linux-input@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).