Commit bfaafd7184f044c63cd937cb0ffb4334b4ec7635

Authored by Jeff Dike
Committed by Linus Torvalds
1 parent 8ae43ff8aa

[PATCH] uml: remove spinlock wrapper functions

The irq_spinlock is not needed from user code any more, so the irq_lock and
irq_unlock wrappers can go away.  This also changes the name of the lock to
irq_lock.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 2 changed files with 16 additions and 31 deletions Side-by-side Diff

arch/um/include/irq_user.h
... ... @@ -29,8 +29,6 @@
29 29 extern void deactivate_fd(int fd, int irqnum);
30 30 extern int deactivate_all_fds(void);
31 31 extern int activate_ipi(int fd, int pid);
32   -extern unsigned long irq_lock(void);
33   -extern void irq_unlock(unsigned long flags);
34 32  
35 33 #ifdef CONFIG_MODE_TT
36 34 extern void forward_interrupts(int pid);
arch/um/kernel/irq.c
... ... @@ -123,6 +123,8 @@
123 123 }
124 124 }
125 125  
  126 +static DEFINE_SPINLOCK(irq_lock);
  127 +
126 128 int activate_fd(int irq, int fd, int type, void *dev_id)
127 129 {
128 130 struct pollfd *tmp_pfd;
... ... @@ -166,7 +168,7 @@
166 168 * this is called only from process context, and can be locked with
167 169 * a semaphore.
168 170 */
169   - flags = irq_lock();
  171 + spin_lock_irqsave(&irq_lock, flags);
170 172 for (irq_fd = active_fds; irq_fd != NULL; irq_fd = irq_fd->next) {
171 173 if ((irq_fd->fd == fd) && (irq_fd->type == type)) {
172 174 printk("Registering fd %d twice\n", fd);
... ... @@ -199,7 +201,7 @@
199 201 * so we will not be able to put new pollfd struct to pollfds
200 202 * then we free the buffer tmp_fds and try again.
201 203 */
202   - irq_unlock(flags);
  204 + spin_unlock_irqrestore(&irq_lock, flags);
203 205 kfree(tmp_pfd);
204 206 tmp_pfd = NULL;
205 207  
206 208  
... ... @@ -207,14 +209,14 @@
207 209 if (tmp_pfd == NULL)
208 210 goto out_kfree;
209 211  
210   - flags = irq_lock();
  212 + spin_lock_irqsave(&irq_lock, flags);
211 213 }
212 214 /*-------------*/
213 215  
214 216 *last_irq_ptr = new_fd;
215 217 last_irq_ptr = &new_fd->next;
216 218  
217   - irq_unlock(flags);
  219 + spin_unlock_irqrestore(&irq_lock, flags);
218 220  
219 221 /* This calls activate_fd, so it has to be outside the critical
220 222 * section.
... ... @@ -224,7 +226,7 @@
224 226 return(0);
225 227  
226 228 out_unlock:
227   - irq_unlock(flags);
  229 + spin_unlock_irqrestore(&irq_lock, flags);
228 230 out_kfree:
229 231 kfree(new_fd);
230 232 out:
231 233  
... ... @@ -235,9 +237,9 @@
235 237 {
236 238 unsigned long flags;
237 239  
238   - flags = irq_lock();
  240 + spin_lock_irqsave(&irq_lock, flags);
239 241 os_free_irq_by_cb(test, arg, active_fds, &last_irq_ptr);
240   - irq_unlock(flags);
  242 + spin_unlock_irqrestore(&irq_lock, flags);
241 243 }
242 244  
243 245 struct irq_and_dev {
244 246  
245 247  
... ... @@ -304,14 +306,14 @@
304 306 unsigned long flags;
305 307 int i;
306 308  
307   - flags = irq_lock();
  309 + spin_lock_irqsave(&irq_lock, flags);
308 310 irq = find_irq_by_fd(fd, irqnum, &i);
309 311 if (irq == NULL) {
310   - irq_unlock(flags);
  312 + spin_unlock_irqrestore(&irq_lock, flags);
311 313 return;
312 314 }
313 315 os_set_pollfd(i, irq->fd);
314   - irq_unlock(flags);
  316 + spin_unlock_irqrestore(&irq_lock, flags);
315 317  
316 318 /* This calls activate_fd, so it has to be outside the critical
317 319 * section.
318 320  
... ... @@ -325,13 +327,13 @@
325 327 unsigned long flags;
326 328 int i;
327 329  
328   - flags = irq_lock();
  330 + spin_lock_irqsave(&irq_lock, flags);
329 331 irq = find_irq_by_fd(fd, irqnum, &i);
330 332 if (irq == NULL)
331 333 goto out;
332 334 os_set_pollfd(i, -1);
333 335 out:
334   - irq_unlock(flags);
  336 + spin_unlock_irqrestore(&irq_lock, flags);
335 337 }
336 338  
337 339 int deactivate_all_fds(void)
... ... @@ -357,7 +359,7 @@
357 359 unsigned long flags;
358 360 int err;
359 361  
360   - flags = irq_lock();
  362 + spin_lock_irqsave(&irq_lock, flags);
361 363 for (irq = active_fds; irq != NULL; irq = irq->next) {
362 364 err = os_set_owner(irq->fd, pid);
363 365 if (err < 0) {
... ... @@ -370,7 +372,7 @@
370 372  
371 373 irq->pid = pid;
372 374 }
373   - irq_unlock(flags);
  375 + spin_unlock_irqrestore(&irq_lock, flags);
374 376 }
375 377 #endif
376 378  
... ... @@ -404,21 +406,6 @@
404 406 }
405 407 EXPORT_SYMBOL(um_request_irq);
406 408 EXPORT_SYMBOL(reactivate_fd);
407   -
408   -static DEFINE_SPINLOCK(irq_spinlock);
409   -
410   -unsigned long irq_lock(void)
411   -{
412   - unsigned long flags;
413   -
414   - spin_lock_irqsave(&irq_spinlock, flags);
415   - return flags;
416   -}
417   -
418   -void irq_unlock(unsigned long flags)
419   -{
420   - spin_unlock_irqrestore(&irq_spinlock, flags);
421   -}
422 409  
423 410 /* hw_interrupt_type must define (startup || enable) &&
424 411 * (shutdown || disable) && end */