aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/drivers/xterm.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/drivers/xterm.c')
-rw-r--r--arch/um/drivers/xterm.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c
index fd817e541543..87e18bf2c667 100644
--- a/arch/um/drivers/xterm.c
+++ b/arch/um/drivers/xterm.c
@@ -3,18 +3,19 @@
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <stddef.h>
6#include <stdlib.h> 7#include <stdlib.h>
7#include <stdio.h> 8#include <stdio.h>
8#include <unistd.h> 9#include <unistd.h>
9#include <string.h>
10#include <errno.h> 10#include <errno.h>
11#include <string.h>
11#include <termios.h> 12#include <termios.h>
12#include "chan_user.h" 13#include "chan_user.h"
14#include "kern_constants.h"
13#include "os.h" 15#include "os.h"
14#include "init.h" 16#include "um_malloc.h"
15#include "user.h" 17#include "user.h"
16#include "xterm.h" 18#include "xterm.h"
17#include "kern_constants.h"
18 19
19struct xterm_chan { 20struct xterm_chan {
20 int pid; 21 int pid;
@@ -29,7 +30,7 @@ static void *xterm_init(char *str, int device, const struct chan_opts *opts)
29{ 30{
30 struct xterm_chan *data; 31 struct xterm_chan *data;
31 32
32 data = malloc(sizeof(*data)); 33 data = kmalloc(sizeof(*data), UM_GFP_KERNEL);
33 if (data == NULL) 34 if (data == NULL)
34 return NULL; 35 return NULL;
35 *data = ((struct xterm_chan) { .pid = -1, 36 *data = ((struct xterm_chan) { .pid = -1,
@@ -207,11 +208,6 @@ static void xterm_close(int fd, void *d)
207 os_close_file(fd); 208 os_close_file(fd);
208} 209}
209 210
210static void xterm_free(void *d)
211{
212 free(d);
213}
214
215const struct chan_ops xterm_ops = { 211const struct chan_ops xterm_ops = {
216 .type = "xterm", 212 .type = "xterm",
217 .init = xterm_init, 213 .init = xterm_init,
@@ -221,6 +217,6 @@ const struct chan_ops xterm_ops = {
221 .write = generic_write, 217 .write = generic_write,
222 .console_write = generic_console_write, 218 .console_write = generic_console_write,
223 .window_size = generic_window_size, 219 .window_size = generic_window_size,
224 .free = xterm_free, 220 .free = generic_free,
225 .winch = 1, 221 .winch = 1,
226}; 222};