summaryrefslogtreecommitdiffstats
path: root/arch/um/kernel/sigio.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2006-08-01 10:37:25 +1000
committerPaul Mackerras <paulus@samba.org>2006-08-01 10:37:25 +1000
commit57cad8084e0837e0f2c97da789ec9b3f36809be9 (patch)
treee9c790afb4286f78cb08d9664f58baa7e876fe55 /arch/um/kernel/sigio.c
parentcb18bd40030c879cd93fef02fd579f74dbab473d (diff)
parent49b1e3ea19b1c95c2f012b8331ffb3b169e4c042 (diff)
Merge branch 'merge'
Diffstat (limited to 'arch/um/kernel/sigio.c')
-rw-r--r--arch/um/kernel/sigio.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/arch/um/kernel/sigio.c b/arch/um/kernel/sigio.c
new file mode 100644
index 00000000000..0ad755ceb21
--- /dev/null
+++ b/arch/um/kernel/sigio.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2002 - 2003 Jeff Dike (jdike@addtoit.com)
+ * Licensed under the GPL
+ */
+
+#include "linux/kernel.h"
+#include "linux/list.h"
+#include "linux/slab.h"
+#include "linux/signal.h"
+#include "linux/interrupt.h"
+#include "init.h"
+#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)
+{
+ char c;
+
+ os_read_file(sigio_irq_fd, &c, sizeof(c));
+ reactivate_fd(sigio_irq_fd, SIGIO_WRITE_IRQ);
+ return(IRQ_HANDLED);
+}
+
+int write_sigio_irq(int fd)
+{
+ int err;
+
+ err = um_request_irq(SIGIO_WRITE_IRQ, fd, IRQ_READ, sigio_interrupt,
+ IRQF_DISABLED|IRQF_SAMPLE_RANDOM, "write sigio",
+ NULL);
+ if(err){
+ printk("write_sigio_irq : um_request_irq failed, err = %d\n",
+ err);
+ return(-1);
+ }
+ sigio_irq_fd = fd;
+ return(0);
+}
+
+static DEFINE_SPINLOCK(sigio_spinlock);
+
+void sigio_lock(void)
+{
+ spin_lock(&sigio_spinlock);
+}
+
+void sigio_unlock(void)
+{
+ spin_unlock(&sigio_spinlock);
+}