vserver 2.0 rc7
[linux-2.6.git] / arch / um / drivers / xterm_kern.c
index afce46f..a4fdf35 100644 (file)
@@ -7,7 +7,6 @@
 #include "linux/slab.h"
 #include "linux/signal.h"
 #include "linux/interrupt.h"
-#include "asm/semaphore.h"
 #include "asm/irq.h"
 #include "irq_user.h"
 #include "irq_kern.h"
@@ -16,7 +15,7 @@
 #include "xterm.h"
 
 struct xterm_wait {
-       struct semaphore sem;
+       struct completion ready;
        int fd;
        int pid;
        int new_fd;
@@ -32,7 +31,7 @@ static irqreturn_t xterm_interrupt(int irq, void *data, struct pt_regs *regs)
                return(IRQ_NONE);
 
        xterm->new_fd = fd;
-       up(&xterm->sem);
+       complete(&xterm->ready);
        return(IRQ_HANDLED);
 }
 
@@ -49,10 +48,10 @@ int xterm_fd(int socket, int *pid_out)
 
        /* This is a locked semaphore... */
        *data = ((struct xterm_wait) 
-               { .sem          = __SEMAPHORE_INITIALIZER(data->sem, 0),
-                 .fd           = socket,
+               { .fd           = socket,
                  .pid          = -1,
                  .new_fd       = -1 });
+       init_completion(&data->ready);
 
        err = um_request_irq(XTERM_IRQ, socket, IRQ_READ, xterm_interrupt, 
                             SA_INTERRUPT | SA_SHIRQ | SA_SAMPLE_RANDOM, 
@@ -68,7 +67,7 @@ int xterm_fd(int socket, int *pid_out)
         *
         * XXX Note, if the xterm doesn't work for some reason (eg. DISPLAY
         * isn't set) this will hang... */
-       down(&data->sem);
+       wait_for_completion(&data->ready);
 
        free_irq_by_irq_and_dev(XTERM_IRQ, data);
        free_irq(XTERM_IRQ, data);