Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / arch / um / kernel / sigio_kern.c
index fbffae4..1c1300f 100644 (file)
@@ -1,5 +1,5 @@
-/* 
- * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
+/*
+ * Copyright (C) 2002 - 2003 Jeff Dike (jdike@addtoit.com)
  * Licensed under the GPL
  */
 
 #include "sigio.h"
 #include "irq_user.h"
 #include "irq_kern.h"
+#include "os.h"
 
 /* Protected by sigio_lock() called from write_sigio_workaround */
 static int sigio_irq_fd = -1;
 
 static irqreturn_t sigio_interrupt(int irq, void *data, struct pt_regs *unused)
 {
-       read_sigio_fd(sigio_irq_fd);
+       char c;
+
+       os_read_file(sigio_irq_fd, &c, sizeof(c));
        reactivate_fd(sigio_irq_fd, SIGIO_WRITE_IRQ);
        return(IRQ_HANDLED);
 }
@@ -28,7 +31,7 @@ int write_sigio_irq(int fd)
        int err;
 
        err = um_request_irq(SIGIO_WRITE_IRQ, fd, IRQ_READ, sigio_interrupt,
-                         SA_INTERRUPT | SA_SAMPLE_RANDOM, "write sigio", 
+                            SA_INTERRUPT | SA_SAMPLE_RANDOM, "write sigio",
                             NULL);
        if(err){
                printk("write_sigio_irq : um_request_irq failed, err = %d\n",
@@ -39,7 +42,7 @@ int write_sigio_irq(int fd)
        return(0);
 }
 
-static spinlock_t sigio_spinlock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(sigio_spinlock);
 
 void sigio_lock(void)
 {
@@ -51,6 +54,9 @@ void sigio_unlock(void)
        spin_unlock(&sigio_spinlock);
 }
 
+extern void sigio_cleanup(void);
+__uml_exitcall(sigio_cleanup);
+
 /*
  * Overrides for Emacs so that we follow Linus's tabbing style.
  * Emacs will notice this stuff at the end of the file and automatically