Input: evdev - fix bug in checking duplicate clock change request
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: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
parent
5523662edd
commit
bf5f18d708
1 changed files with 19 additions and 17 deletions
|
@ -56,7 +56,7 @@ struct evdev_client {
|
||||||
struct fasync_struct *fasync;
|
struct fasync_struct *fasync;
|
||||||
struct evdev *evdev;
|
struct evdev *evdev;
|
||||||
struct list_head node;
|
struct list_head node;
|
||||||
int clk_type;
|
unsigned int clk_type;
|
||||||
bool revoked;
|
bool revoked;
|
||||||
unsigned long *evmasks[EV_CNT];
|
unsigned long *evmasks[EV_CNT];
|
||||||
unsigned int bufsize;
|
unsigned int bufsize;
|
||||||
|
@ -191,25 +191,26 @@ static void evdev_queue_syn_dropped(struct evdev_client *client)
|
||||||
static int evdev_set_clk_type(struct evdev_client *client, unsigned int clkid)
|
static int evdev_set_clk_type(struct evdev_client *client, unsigned int clkid)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
unsigned int clk_type;
|
||||||
if (client->clk_type == clkid)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
switch (clkid) {
|
switch (clkid) {
|
||||||
|
|
||||||
case CLOCK_REALTIME:
|
case CLOCK_REALTIME:
|
||||||
client->clk_type = EV_CLK_REAL;
|
clk_type = EV_CLK_REAL;
|
||||||
break;
|
break;
|
||||||
case CLOCK_MONOTONIC:
|
case CLOCK_MONOTONIC:
|
||||||
client->clk_type = EV_CLK_MONO;
|
clk_type = EV_CLK_MONO;
|
||||||
break;
|
break;
|
||||||
case CLOCK_BOOTTIME:
|
case CLOCK_BOOTTIME:
|
||||||
client->clk_type = EV_CLK_BOOT;
|
clk_type = EV_CLK_BOOT;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (client->clk_type != clk_type) {
|
||||||
|
client->clk_type = clk_type;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Flush pending events and queue SYN_DROPPED event,
|
* Flush pending events and queue SYN_DROPPED event,
|
||||||
* but only if the queue is not empty.
|
* but only if the queue is not empty.
|
||||||
|
@ -222,6 +223,7 @@ static int evdev_set_clk_type(struct evdev_client *client, unsigned int clkid)
|
||||||
}
|
}
|
||||||
|
|
||||||
spin_unlock_irqrestore(&client->buffer_lock, flags);
|
spin_unlock_irqrestore(&client->buffer_lock, flags);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue