aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mousedev.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2007-10-13 15:46:55 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2007-10-13 15:46:55 -0400
commit82ba56c273911f7eda79849cfa0fc2d2e5a3b75b (patch)
tree1b169cbda51caed72440e1ff034780df5a4dda33 /drivers/input/mousedev.c
parentInput: remove tsdev interface (diff)
downloadlinux-dev-82ba56c273911f7eda79849cfa0fc2d2e5a3b75b.tar.xz
linux-dev-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/mousedev.c')
-rw-r--r--drivers/input/mousedev.c11
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,
unsigned int new_head;
int wake_readers = 0;
+ rcu_read_lock();
list_for_each_entry_rcu(client, &mousedev->client_list, node) {
/* Just acquire the lock, interrupts already disabled */
@@ -309,6 +310,7 @@ static void mousedev_notify_readers(struct mousedev *mousedev,
wake_readers = 1;
}
}
+ rcu_read_unlock();
if (wake_readers)
wake_up_interruptible(&mousedev->wait);
@@ -499,12 +501,7 @@ static void mousedev_attach_client(struct mousedev *mousedev,
spin_lock(&mousedev->client_lock);
list_add_tail_rcu(&client->node, &mousedev->client_list);
spin_unlock(&mousedev->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 mousedev_detach_client(struct mousedev *mousedev,
@@ -513,7 +510,7 @@ static void mousedev_detach_client(struct mousedev *mousedev,
spin_lock(&mousedev->client_lock);
list_del_rcu(&client->node);
spin_unlock(&mousedev->client_lock);
- synchronize_sched();
+ synchronize_rcu();
}
static int mousedev_release(struct inode *inode, struct file *file)