Commit bfaafd71 authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds

[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: default avatarJeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8ae43ff8
...@@ -29,8 +29,6 @@ extern void reactivate_fd(int fd, int irqnum); ...@@ -29,8 +29,6 @@ extern void reactivate_fd(int fd, int irqnum);
extern void deactivate_fd(int fd, int irqnum); extern void deactivate_fd(int fd, int irqnum);
extern int deactivate_all_fds(void); extern int deactivate_all_fds(void);
extern int activate_ipi(int fd, int pid); extern int activate_ipi(int fd, int pid);
extern unsigned long irq_lock(void);
extern void irq_unlock(unsigned long flags);
#ifdef CONFIG_MODE_TT #ifdef CONFIG_MODE_TT
extern void forward_interrupts(int pid); extern void forward_interrupts(int pid);
......
...@@ -123,6 +123,8 @@ static void maybe_sigio_broken(int fd, int type) ...@@ -123,6 +123,8 @@ static void maybe_sigio_broken(int fd, int type)
} }
} }
static DEFINE_SPINLOCK(irq_lock);
int activate_fd(int irq, int fd, int type, void *dev_id) int activate_fd(int irq, int fd, int type, void *dev_id)
{ {
struct pollfd *tmp_pfd; struct pollfd *tmp_pfd;
...@@ -166,7 +168,7 @@ int activate_fd(int irq, int fd, int type, void *dev_id) ...@@ -166,7 +168,7 @@ int activate_fd(int irq, int fd, int type, void *dev_id)
* this is called only from process context, and can be locked with * this is called only from process context, and can be locked with
* a semaphore. * a semaphore.
*/ */
flags = irq_lock(); spin_lock_irqsave(&irq_lock, flags);
for (irq_fd = active_fds; irq_fd != NULL; irq_fd = irq_fd->next) { for (irq_fd = active_fds; irq_fd != NULL; irq_fd = irq_fd->next) {
if ((irq_fd->fd == fd) && (irq_fd->type == type)) { if ((irq_fd->fd == fd) && (irq_fd->type == type)) {
printk("Registering fd %d twice\n", fd); printk("Registering fd %d twice\n", fd);
...@@ -199,7 +201,7 @@ int activate_fd(int irq, int fd, int type, void *dev_id) ...@@ -199,7 +201,7 @@ int activate_fd(int irq, int fd, int type, void *dev_id)
* so we will not be able to put new pollfd struct to pollfds * so we will not be able to put new pollfd struct to pollfds
* then we free the buffer tmp_fds and try again. * then we free the buffer tmp_fds and try again.
*/ */
irq_unlock(flags); spin_unlock_irqrestore(&irq_lock, flags);
kfree(tmp_pfd); kfree(tmp_pfd);
tmp_pfd = NULL; tmp_pfd = NULL;
...@@ -207,14 +209,14 @@ int activate_fd(int irq, int fd, int type, void *dev_id) ...@@ -207,14 +209,14 @@ int activate_fd(int irq, int fd, int type, void *dev_id)
if (tmp_pfd == NULL) if (tmp_pfd == NULL)
goto out_kfree; goto out_kfree;
flags = irq_lock(); spin_lock_irqsave(&irq_lock, flags);
} }
/*-------------*/ /*-------------*/
*last_irq_ptr = new_fd; *last_irq_ptr = new_fd;
last_irq_ptr = &new_fd->next; last_irq_ptr = &new_fd->next;
irq_unlock(flags); spin_unlock_irqrestore(&irq_lock, flags);
/* This calls activate_fd, so it has to be outside the critical /* This calls activate_fd, so it has to be outside the critical
* section. * section.
...@@ -224,7 +226,7 @@ int activate_fd(int irq, int fd, int type, void *dev_id) ...@@ -224,7 +226,7 @@ int activate_fd(int irq, int fd, int type, void *dev_id)
return(0); return(0);
out_unlock: out_unlock:
irq_unlock(flags); spin_unlock_irqrestore(&irq_lock, flags);
out_kfree: out_kfree:
kfree(new_fd); kfree(new_fd);
out: out:
...@@ -235,9 +237,9 @@ static void free_irq_by_cb(int (*test)(struct irq_fd *, void *), void *arg) ...@@ -235,9 +237,9 @@ static void free_irq_by_cb(int (*test)(struct irq_fd *, void *), void *arg)
{ {
unsigned long flags; unsigned long flags;
flags = irq_lock(); spin_lock_irqsave(&irq_lock, flags);
os_free_irq_by_cb(test, arg, active_fds, &last_irq_ptr); os_free_irq_by_cb(test, arg, active_fds, &last_irq_ptr);
irq_unlock(flags); spin_unlock_irqrestore(&irq_lock, flags);
} }
struct irq_and_dev { struct irq_and_dev {
...@@ -304,14 +306,14 @@ void reactivate_fd(int fd, int irqnum) ...@@ -304,14 +306,14 @@ void reactivate_fd(int fd, int irqnum)
unsigned long flags; unsigned long flags;
int i; int i;
flags = irq_lock(); spin_lock_irqsave(&irq_lock, flags);
irq = find_irq_by_fd(fd, irqnum, &i); irq = find_irq_by_fd(fd, irqnum, &i);
if (irq == NULL) { if (irq == NULL) {
irq_unlock(flags); spin_unlock_irqrestore(&irq_lock, flags);
return; return;
} }
os_set_pollfd(i, irq->fd); os_set_pollfd(i, irq->fd);
irq_unlock(flags); spin_unlock_irqrestore(&irq_lock, flags);
/* This calls activate_fd, so it has to be outside the critical /* This calls activate_fd, so it has to be outside the critical
* section. * section.
...@@ -325,13 +327,13 @@ void deactivate_fd(int fd, int irqnum) ...@@ -325,13 +327,13 @@ void deactivate_fd(int fd, int irqnum)
unsigned long flags; unsigned long flags;
int i; int i;
flags = irq_lock(); spin_lock_irqsave(&irq_lock, flags);
irq = find_irq_by_fd(fd, irqnum, &i); irq = find_irq_by_fd(fd, irqnum, &i);
if (irq == NULL) if (irq == NULL)
goto out; goto out;
os_set_pollfd(i, -1); os_set_pollfd(i, -1);
out: out:
irq_unlock(flags); spin_unlock_irqrestore(&irq_lock, flags);
} }
int deactivate_all_fds(void) int deactivate_all_fds(void)
...@@ -357,7 +359,7 @@ void forward_interrupts(int pid) ...@@ -357,7 +359,7 @@ void forward_interrupts(int pid)
unsigned long flags; unsigned long flags;
int err; int err;
flags = irq_lock(); spin_lock_irqsave(&irq_lock, flags);
for (irq = active_fds; irq != NULL; irq = irq->next) { for (irq = active_fds; irq != NULL; irq = irq->next) {
err = os_set_owner(irq->fd, pid); err = os_set_owner(irq->fd, pid);
if (err < 0) { if (err < 0) {
...@@ -370,7 +372,7 @@ void forward_interrupts(int pid) ...@@ -370,7 +372,7 @@ void forward_interrupts(int pid)
irq->pid = pid; irq->pid = pid;
} }
irq_unlock(flags); spin_unlock_irqrestore(&irq_lock, flags);
} }
#endif #endif
...@@ -405,21 +407,6 @@ int um_request_irq(unsigned int irq, int fd, int type, ...@@ -405,21 +407,6 @@ int um_request_irq(unsigned int irq, int fd, int type,
EXPORT_SYMBOL(um_request_irq); EXPORT_SYMBOL(um_request_irq);
EXPORT_SYMBOL(reactivate_fd); EXPORT_SYMBOL(reactivate_fd);
static DEFINE_SPINLOCK(irq_spinlock);
unsigned long irq_lock(void)
{
unsigned long flags;
spin_lock_irqsave(&irq_spinlock, flags);
return flags;
}
void irq_unlock(unsigned long flags)
{
spin_unlock_irqrestore(&irq_spinlock, flags);
}
/* hw_interrupt_type must define (startup || enable) && /* hw_interrupt_type must define (startup || enable) &&
* (shutdown || disable) && end */ * (shutdown || disable) && end */
static void dummy(unsigned int irq) static void dummy(unsigned int irq)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment