Merge to kernel-2.6.20-1.2949.fc6.vs2.2.0.1
[linux-2.6.git] / arch / um / drivers / port_user.c
index 92a6d4e..bc6afaf 100644 (file)
@@ -18,8 +18,8 @@
 #include "user.h"
 #include "chan_user.h"
 #include "port.h"
-#include "helper.h"
 #include "os.h"
+#include "um_malloc.h"
 
 struct port_chan {
        int raw;
@@ -28,7 +28,7 @@ struct port_chan {
        char dev[sizeof("32768\0")];
 };
 
-void *port_init(char *str, int device, struct chan_opts *opts)
+static void *port_init(char *str, int device, const struct chan_opts *opts)
 {
        struct port_chan *data;
        void *kern_data;
@@ -48,11 +48,11 @@ void *port_init(char *str, int device, struct chan_opts *opts)
        }
 
        kern_data = port_data(port);
-       if(kern_data == NULL) 
+       if(kern_data == NULL)
                return(NULL);
 
        data = um_kmalloc(sizeof(*data));
-       if(data == NULL) 
+       if(data == NULL)
                goto err;
 
        *data = ((struct port_chan) { .raw              = opts->raw,
@@ -65,7 +65,7 @@ void *port_init(char *str, int device, struct chan_opts *opts)
        return(NULL);
 }
 
-void port_free(void *d)
+static void port_free(void *d)
 {
        struct port_chan *data = d;
 
@@ -73,7 +73,8 @@ void port_free(void *d)
        kfree(data);
 }
 
-int port_open(int input, int output, int primary, void *d, char **dev_out)
+static int port_open(int input, int output, int primary, void *d,
+                    char **dev_out)
 {
        struct port_chan *data = d;
        int fd, err;
@@ -92,7 +93,7 @@ int port_open(int input, int output, int primary, void *d, char **dev_out)
        return(fd);
 }
 
-void port_close(int fd, void *d)
+static void port_close(int fd, void *d)
 {
        struct port_chan *data = d;
 
@@ -100,21 +101,14 @@ void port_close(int fd, void *d)
        os_close_file(fd);
 }
 
-int port_console_write(int fd, const char *buf, int n, void *d)
-{
-       struct port_chan *data = d;
-
-       return(generic_console_write(fd, buf, n, &data->tt));
-}
-
-struct chan_ops port_ops = {
+const struct chan_ops port_ops = {
        .type           = "port",
        .init           = port_init,
        .open           = port_open,
        .close          = port_close,
        .read           = generic_read,
        .write          = generic_write,
-       .console_write  = port_console_write,
+       .console_write  = generic_console_write,
        .window_size    = generic_window_size,
        .free           = port_free,
        .winch          = 1,
@@ -188,7 +182,7 @@ int port_connection(int fd, int *socket, int *pid_out)
                return(new);
 
        err = os_pipe(socket, 0, 0);
-       if(err < 0) 
+       if(err < 0)
                goto out_close;
 
        data = ((struct port_pre_exec_data)