diff options
Diffstat (limited to 'arch/um/drivers/xterm_kern.c')
-rw-r--r-- | arch/um/drivers/xterm_kern.c | 49 |
1 files changed, 17 insertions, 32 deletions
diff --git a/arch/um/drivers/xterm_kern.c b/arch/um/drivers/xterm_kern.c index a4ce7058e10e..b646bccef37a 100644 --- a/arch/um/drivers/xterm_kern.c +++ b/arch/um/drivers/xterm_kern.c | |||
@@ -1,18 +1,14 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | 2 | * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include "linux/errno.h" | 6 | #include <linux/slab.h> |
7 | #include "linux/slab.h" | 7 | #include <linux/completion.h> |
8 | #include "linux/signal.h" | 8 | #include <linux/irqreturn.h> |
9 | #include "linux/interrupt.h" | 9 | #include <asm/irq.h> |
10 | #include "asm/irq.h" | ||
11 | #include "irq_user.h" | ||
12 | #include "irq_kern.h" | 10 | #include "irq_kern.h" |
13 | #include "kern_util.h" | ||
14 | #include "os.h" | 11 | #include "os.h" |
15 | #include "xterm.h" | ||
16 | 12 | ||
17 | struct xterm_wait { | 13 | struct xterm_wait { |
18 | struct completion ready; | 14 | struct completion ready; |
@@ -27,12 +23,13 @@ static irqreturn_t xterm_interrupt(int irq, void *data) | |||
27 | int fd; | 23 | int fd; |
28 | 24 | ||
29 | fd = os_rcv_fd(xterm->fd, &xterm->pid); | 25 | fd = os_rcv_fd(xterm->fd, &xterm->pid); |
30 | if(fd == -EAGAIN) | 26 | if (fd == -EAGAIN) |
31 | return(IRQ_NONE); | 27 | return IRQ_NONE; |
32 | 28 | ||
33 | xterm->new_fd = fd; | 29 | xterm->new_fd = fd; |
34 | complete(&xterm->ready); | 30 | complete(&xterm->ready); |
35 | return(IRQ_HANDLED); | 31 | |
32 | return IRQ_HANDLED; | ||
36 | } | 33 | } |
37 | 34 | ||
38 | int xterm_fd(int socket, int *pid_out) | 35 | int xterm_fd(int socket, int *pid_out) |
@@ -41,22 +38,21 @@ int xterm_fd(int socket, int *pid_out) | |||
41 | int err, ret; | 38 | int err, ret; |
42 | 39 | ||
43 | data = kmalloc(sizeof(*data), GFP_KERNEL); | 40 | data = kmalloc(sizeof(*data), GFP_KERNEL); |
44 | if(data == NULL){ | 41 | if (data == NULL) { |
45 | printk(KERN_ERR "xterm_fd : failed to allocate xterm_wait\n"); | 42 | printk(KERN_ERR "xterm_fd : failed to allocate xterm_wait\n"); |
46 | return(-ENOMEM); | 43 | return -ENOMEM; |
47 | } | 44 | } |
48 | 45 | ||
49 | /* This is a locked semaphore... */ | 46 | /* This is a locked semaphore... */ |
50 | *data = ((struct xterm_wait) | 47 | *data = ((struct xterm_wait) { .fd = socket, |
51 | { .fd = socket, | 48 | .pid = -1, |
52 | .pid = -1, | 49 | .new_fd = -1 }); |
53 | .new_fd = -1 }); | ||
54 | init_completion(&data->ready); | 50 | init_completion(&data->ready); |
55 | 51 | ||
56 | err = um_request_irq(XTERM_IRQ, socket, IRQ_READ, xterm_interrupt, | 52 | err = um_request_irq(XTERM_IRQ, socket, IRQ_READ, xterm_interrupt, |
57 | IRQF_DISABLED | IRQF_SHARED | IRQF_SAMPLE_RANDOM, | 53 | IRQF_DISABLED | IRQF_SHARED | IRQF_SAMPLE_RANDOM, |
58 | "xterm", data); | 54 | "xterm", data); |
59 | if (err){ | 55 | if (err) { |
60 | printk(KERN_ERR "xterm_fd : failed to get IRQ for xterm, " | 56 | printk(KERN_ERR "xterm_fd : failed to get IRQ for xterm, " |
61 | "err = %d\n", err); | 57 | "err = %d\n", err); |
62 | ret = err; | 58 | ret = err; |
@@ -76,16 +72,5 @@ int xterm_fd(int socket, int *pid_out) | |||
76 | out: | 72 | out: |
77 | kfree(data); | 73 | kfree(data); |
78 | 74 | ||
79 | return(ret); | 75 | return ret; |
80 | } | 76 | } |
81 | |||
82 | /* | ||
83 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
84 | * Emacs will notice this stuff at the end of the file and automatically | ||
85 | * adjust the settings for this buffer only. This must remain at the end | ||
86 | * of the file. | ||
87 | * --------------------------------------------------------------------------- | ||
88 | * Local variables: | ||
89 | * c-file-style: "linux" | ||
90 | * End: | ||
91 | */ | ||