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/joydev.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/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, | |||
149 | 149 | ||
150 | event.time = jiffies_to_msecs(jiffies); | 150 | event.time = jiffies_to_msecs(jiffies); |
151 | 151 | ||
152 | rcu_read_lock(); | ||
152 | list_for_each_entry_rcu(client, &joydev->client_list, node) | 153 | list_for_each_entry_rcu(client, &joydev->client_list, node) |
153 | joydev_pass_event(client, &event); | 154 | joydev_pass_event(client, &event); |
155 | rcu_read_unlock(); | ||
154 | 156 | ||
155 | wake_up_interruptible(&joydev->wait); | 157 | wake_up_interruptible(&joydev->wait); |
156 | } | 158 | } |
@@ -178,12 +180,7 @@ static void joydev_attach_client(struct joydev *joydev, | |||
178 | spin_lock(&joydev->client_lock); | 180 | spin_lock(&joydev->client_lock); |
179 | list_add_tail_rcu(&client->node, &joydev->client_list); | 181 | list_add_tail_rcu(&client->node, &joydev->client_list); |
180 | spin_unlock(&joydev->client_lock); | 182 | spin_unlock(&joydev->client_lock); |
181 | /* | 183 | synchronize_rcu(); |
182 | * We don't use synchronize_rcu() here because read-side | ||
183 | * critical section is protected by a spinlock (dev->event_lock) | ||
184 | * instead of rcu_read_lock(). | ||
185 | */ | ||
186 | synchronize_sched(); | ||
187 | } | 184 | } |
188 | 185 | ||
189 | static void joydev_detach_client(struct joydev *joydev, | 186 | static void joydev_detach_client(struct joydev *joydev, |
@@ -192,7 +189,7 @@ static void joydev_detach_client(struct joydev *joydev, | |||
192 | spin_lock(&joydev->client_lock); | 189 | spin_lock(&joydev->client_lock); |
193 | list_del_rcu(&client->node); | 190 | list_del_rcu(&client->node); |
194 | spin_unlock(&joydev->client_lock); | 191 | spin_unlock(&joydev->client_lock); |
195 | synchronize_sched(); | 192 | synchronize_rcu(); |
196 | } | 193 | } |
197 | 194 | ||
198 | static int joydev_open_device(struct joydev *joydev) | 195 | static int joydev_open_device(struct joydev *joydev) |