diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2007-10-13 21:46:55 +0200 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2007-10-13 21:46:55 +0200 |
commit | 82ba56c273911f7eda79849cfa0fc2d2e5a3b75b (patch) | |
tree | 1b169cbda51caed72440e1ff034780df5a4dda33 /drivers/input/joydev.c | |
parent | Input: remove tsdev interface (diff) | |
download | linux-82ba56c273911f7eda79849cfa0fc2d2e5a3b75b.tar.xz linux-82ba56c273911f7eda79849cfa0fc2d2e5a3b75b.zip |
Input: use full RCU API
RT guys alerted me to the fact that in their tree spinlocks
are preemptible and it is better to use full RCU API
(rcu_read_lock()/rcu_read_unlock()) to be safe.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/joydev.c')
-rw-r--r-- | drivers/input/joydev.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index f306c97f556d..2b201f9aa024 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c @@ -149,8 +149,10 @@ static void joydev_event(struct input_handle *handle, event.time = jiffies_to_msecs(jiffies); + rcu_read_lock(); list_for_each_entry_rcu(client, &joydev->client_list, node) joydev_pass_event(client, &event); + rcu_read_unlock(); wake_up_interruptible(&joydev->wait); } @@ -178,12 +180,7 @@ static void joydev_attach_client(struct joydev *joydev, spin_lock(&joydev->client_lock); list_add_tail_rcu(&client->node, &joydev->client_list); spin_unlock(&joydev->client_lock); - /* - * We don't use synchronize_rcu() here because read-side - * critical section is protected by a spinlock (dev->event_lock) - * instead of rcu_read_lock(). - */ - synchronize_sched(); + synchronize_rcu(); } static void joydev_detach_client(struct joydev *joydev, @@ -192,7 +189,7 @@ static void joydev_detach_client(struct joydev *joydev, spin_lock(&joydev->client_lock); list_del_rcu(&client->node); spin_unlock(&joydev->client_lock); - synchronize_sched(); + synchronize_rcu(); } static int joydev_open_device(struct joydev *joydev) |