diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2007-10-13 15:46:55 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2007-10-13 15:46:55 -0400 |
commit | 82ba56c273911f7eda79849cfa0fc2d2e5a3b75b (patch) | |
tree | 1b169cbda51caed72440e1ff034780df5a4dda33 /drivers/input/mousedev.c | |
parent | 70093178b6eda34e4a4fb18cc4a48a9eacc01d98 (diff) |
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/mousedev.c')
-rw-r--r-- | drivers/input/mousedev.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index cc36edbb912f..79146d6ed2ab 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c | |||
@@ -265,6 +265,7 @@ static void mousedev_notify_readers(struct mousedev *mousedev, | |||
265 | unsigned int new_head; | 265 | unsigned int new_head; |
266 | int wake_readers = 0; | 266 | int wake_readers = 0; |
267 | 267 | ||
268 | rcu_read_lock(); | ||
268 | list_for_each_entry_rcu(client, &mousedev->client_list, node) { | 269 | list_for_each_entry_rcu(client, &mousedev->client_list, node) { |
269 | 270 | ||
270 | /* Just acquire the lock, interrupts already disabled */ | 271 | /* Just acquire the lock, interrupts already disabled */ |
@@ -309,6 +310,7 @@ static void mousedev_notify_readers(struct mousedev *mousedev, | |||
309 | wake_readers = 1; | 310 | wake_readers = 1; |
310 | } | 311 | } |
311 | } | 312 | } |
313 | rcu_read_unlock(); | ||
312 | 314 | ||
313 | if (wake_readers) | 315 | if (wake_readers) |
314 | wake_up_interruptible(&mousedev->wait); | 316 | wake_up_interruptible(&mousedev->wait); |
@@ -499,12 +501,7 @@ static void mousedev_attach_client(struct mousedev *mousedev, | |||
499 | spin_lock(&mousedev->client_lock); | 501 | spin_lock(&mousedev->client_lock); |
500 | list_add_tail_rcu(&client->node, &mousedev->client_list); | 502 | list_add_tail_rcu(&client->node, &mousedev->client_list); |
501 | spin_unlock(&mousedev->client_lock); | 503 | spin_unlock(&mousedev->client_lock); |
502 | /* | 504 | synchronize_rcu(); |
503 | * We don't use synchronize_rcu() here because read-side | ||
504 | * critical section is protected by a spinlock (dev->event_lock) | ||
505 | * instead of rcu_read_lock(). | ||
506 | */ | ||
507 | synchronize_sched(); | ||
508 | } | 505 | } |
509 | 506 | ||
510 | static void mousedev_detach_client(struct mousedev *mousedev, | 507 | static void mousedev_detach_client(struct mousedev *mousedev, |
@@ -513,7 +510,7 @@ static void mousedev_detach_client(struct mousedev *mousedev, | |||
513 | spin_lock(&mousedev->client_lock); | 510 | spin_lock(&mousedev->client_lock); |
514 | list_del_rcu(&client->node); | 511 | list_del_rcu(&client->node); |
515 | spin_unlock(&mousedev->client_lock); | 512 | spin_unlock(&mousedev->client_lock); |
516 | synchronize_sched(); | 513 | synchronize_rcu(); |
517 | } | 514 | } |
518 | 515 | ||
519 | static int mousedev_release(struct inode *inode, struct file *file) | 516 | static int mousedev_release(struct inode *inode, struct file *file) |