tty: const: constify remaining tty_operations
[safe/jmp/linux-2.6] / drivers / char / pcmcia / ipwireless / tty.c
index 42f3815..2bb7874 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/tty_driver.h>
 #include <linux/tty_flip.h>
 #include <linux/uaccess.h>
-#include <linux/version.h>
 
 #include "tty.h"
 #include "network.h"
@@ -259,7 +258,7 @@ static int ipw_write(struct tty_struct *linux_tty,
        }
 
        ret = ipwireless_send_packet(tty->hardware, IPW_CHANNEL_RAS,
-                              (unsigned char *) buf, count,
+                              buf, count,
                               ipw_write_packet_sent_callback, tty);
        if (ret == -1) {
                mutex_unlock(&tty->ipw_tty_mutex);
@@ -277,6 +276,7 @@ static int ipw_write_room(struct tty_struct *linux_tty)
        struct ipw_tty *tty = linux_tty->driver_data;
        int room;
 
+       /* FIXME: Exactly how is the tty object locked here .. */
        if (!tty)
                return -ENODEV;
 
@@ -320,10 +320,10 @@ static int ipw_chars_in_buffer(struct tty_struct *linux_tty)
        struct ipw_tty *tty = linux_tty->driver_data;
 
        if (!tty)
-               return -ENODEV;
+               return 0;
 
        if (!tty->open_count)
-               return -EINVAL;
+               return 0;
 
        return tty->tx_bytes_queued;
 }
@@ -398,6 +398,7 @@ static int set_control_lines(struct ipw_tty *tty, unsigned int set,
 static int ipw_tiocmget(struct tty_struct *linux_tty, struct file *file)
 {
        struct ipw_tty *tty = linux_tty->driver_data;
+       /* FIXME: Exactly how is the tty object locked here .. */
 
        if (!tty)
                return -ENODEV;
@@ -413,6 +414,7 @@ ipw_tiocmset(struct tty_struct *linux_tty, struct file *file,
             unsigned int set, unsigned int clear)
 {
        struct ipw_tty *tty = linux_tty->driver_data;
+       /* FIXME: Exactly how is the tty object locked here .. */
 
        if (!tty)
                return -ENODEV;
@@ -434,6 +436,8 @@ static int ipw_ioctl(struct tty_struct *linux_tty, struct file *file,
        if (!tty->open_count)
                return -EINVAL;
 
+       /* FIXME: Exactly how is the tty object locked here .. */
+
        switch (cmd) {
        case TIOCGSERIAL:
                return ipwireless_get_serial_info(tty, (void __user *) arg);
@@ -468,13 +472,6 @@ static int ipw_ioctl(struct tty_struct *linux_tty, struct file *file,
                        }
                        return 0;
 
-               case TCGETS:
-               case TCGETA:
-                       return n_tty_ioctl(linux_tty, file, cmd, arg);
-
-               case TCFLSH:
-                       return n_tty_ioctl(linux_tty, file, cmd, arg);
-
                case FIONREAD:
                        {
                                int val = 0;
@@ -483,10 +480,11 @@ static int ipw_ioctl(struct tty_struct *linux_tty, struct file *file,
                                        return -EFAULT;
                        }
                        return 0;
+               case TCFLSH:
+                       return tty_perform_flush(linux_tty, arg);
                }
        }
-
-       return -ENOIOCTLCMD;
+       return tty_mode_ioctl(linux_tty, file, cmd , arg);
 }
 
 static int add_tty(dev_node_t *nodesp, int j,
@@ -589,6 +587,8 @@ void ipwireless_tty_free(struct ipw_tty *tty)
                                tty_hangup(ttyj->linux_tty);
                                /* Wait till the tty_hangup has completed */
                                flush_scheduled_work();
+                               /* FIXME: Exactly how is the tty object locked here
+                                  against a parallel ioctl etc */
                                mutex_lock(&ttyj->ipw_tty_mutex);
                        }
                        while (ttyj->open_count)
@@ -603,7 +603,7 @@ void ipwireless_tty_free(struct ipw_tty *tty)
        }
 }
 
-static struct tty_operations tty_ops = {
+static const struct tty_operations tty_ops = {
        .open = ipw_open,
        .close = ipw_close,
        .hangup = ipw_hangup,