Re: [PATCH] Input:Flush client events after clk_type change

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 06, 2015 at 06:02:33AM -0800, Anshul Garg wrote:
> From: Anshul Garg <aksgarg1989@xxxxxxxxx>
> 
> 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@xxxxxxxxxxx>
> ---
>  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
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux