fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / usb / serial / io_ti.c
index ebf9967..980285c 100644 (file)
@@ -24,7 +24,6 @@
  *
  */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/jiffies.h>
 #include <linux/errno.h>
@@ -40,8 +39,8 @@
 #include <asm/uaccess.h>
 #include <asm/semaphore.h>
 #include <linux/usb.h>
+#include <linux/usb/serial.h>
 
-#include "usb-serial.h"
 #include "io_16654.h"
 #include "io_usbvend.h"
 #include "io_ti.h"
@@ -216,11 +215,11 @@ static struct usb_device_id id_table_combined [] = {
 MODULE_DEVICE_TABLE (usb, id_table_combined);
 
 static struct usb_driver io_driver = {
-       .owner =        THIS_MODULE,
        .name =         "io_ti",
        .probe =        usb_serial_probe,
        .disconnect =   usb_serial_disconnect,
        .id_table =     id_table_combined,
+       .no_dynamic_id =        1,
 };
 
 
@@ -239,7 +238,7 @@ static void edge_tty_recv(struct device *dev, struct tty_struct *tty, unsigned c
 static void stop_read(struct edgeport_port *edge_port);
 static int restart_read(struct edgeport_port *edge_port);
 
-static void edge_set_termios (struct usb_serial_port *port, struct termios *old_termios);
+static void edge_set_termios (struct usb_serial_port *port, struct ktermios *old_termios);
 static void edge_send(struct usb_serial_port *port);
 
 /* circular buffer */
@@ -1698,7 +1697,7 @@ static void handle_new_lsr (struct edgeport_port *edge_port, int lsr_data, __u8
 }
 
 
-static void edge_interrupt_callback (struct urb *urb, struct pt_regs *regs)
+static void edge_interrupt_callback (struct urb *urb)
 {
        struct edgeport_serial *edge_serial = (struct edgeport_serial *)urb->context;
        struct usb_serial_port *port;
@@ -1788,7 +1787,7 @@ exit:
                         __FUNCTION__, status);
 }
 
-static void edge_bulk_in_callback (struct urb *urb, struct pt_regs *regs)
+static void edge_bulk_in_callback (struct urb *urb)
 {
        struct edgeport_port *edge_port = (struct edgeport_port *)urb->context;
        unsigned char *data = urb->transfer_buffer;
@@ -1865,20 +1864,14 @@ static void edge_tty_recv(struct device *dev, struct tty_struct *tty, unsigned c
        int cnt;
 
        do {
-               if (tty->flip.count >= TTY_FLIPBUF_SIZE) {
-                       tty_flip_buffer_push(tty);
-                       if (tty->flip.count >= TTY_FLIPBUF_SIZE) {
-                               dev_err(dev, "%s - dropping data, %d bytes lost\n",
-                                       __FUNCTION__, length);
-                               return;
-                       }
+               cnt = tty_buffer_request_room(tty, length);
+               if (cnt < length) {
+                       dev_err(dev, "%s - dropping data, %d bytes lost\n",
+                               __FUNCTION__, length - cnt);
+                       if(cnt == 0)
+                               break;
                }
-               cnt = min(length, TTY_FLIPBUF_SIZE - tty->flip.count);
-               memcpy(tty->flip.char_buf_ptr, data, cnt);
-               memset(tty->flip.flag_buf_ptr, 0, cnt);
-               tty->flip.char_buf_ptr += cnt;
-               tty->flip.flag_buf_ptr += cnt;
-               tty->flip.count += cnt;
+               tty_insert_flip_string(tty, data, cnt);
                data += cnt;
                length -= cnt;
        } while (length > 0);
@@ -1886,7 +1879,7 @@ static void edge_tty_recv(struct device *dev, struct tty_struct *tty, unsigned c
        tty_flip_buffer_push(tty);
 }
 
-static void edge_bulk_out_callback (struct urb *urb, struct pt_regs *regs)
+static void edge_bulk_out_callback (struct urb *urb)
 {
        struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
        struct edgeport_port *edge_port = usb_get_serial_port_data(port);
@@ -2368,7 +2361,7 @@ static int restart_read(struct edgeport_port *edge_port)
        return status;
 }
 
-static void change_port_settings (struct edgeport_port *edge_port, struct termios *old_termios)
+static void change_port_settings (struct edgeport_port *edge_port, struct ktermios *old_termios)
 {
        struct ump_uart_config *config;
        struct tty_struct *tty;
@@ -2519,7 +2512,7 @@ static void change_port_settings (struct edgeport_port *edge_port, struct termio
        return;
 }
 
-static void edge_set_termios (struct usb_serial_port *port, struct termios *old_termios)
+static void edge_set_termios (struct usb_serial_port *port, struct ktermios *old_termios)
 {
        struct edgeport_port *edge_port = usb_get_serial_port_data(port);
        struct tty_struct *tty = port->tty;
@@ -2733,12 +2726,11 @@ static int edge_startup (struct usb_serial *serial)
        dev = serial->dev;
 
        /* create our private serial structure */
-       edge_serial = kmalloc (sizeof(struct edgeport_serial), GFP_KERNEL);
+       edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL);
        if (edge_serial == NULL) {
                dev_err(&serial->dev->dev, "%s - Out of memory\n", __FUNCTION__);
                return -ENOMEM;
        }
-       memset (edge_serial, 0, sizeof(struct edgeport_serial));
        sema_init(&edge_serial->es_sem, 1);
        edge_serial->serial = serial;
        usb_set_serial_data(serial, edge_serial);
@@ -2751,12 +2743,11 @@ static int edge_startup (struct usb_serial *serial)
 
        /* set up our port private structures */
        for (i = 0; i < serial->num_ports; ++i) {
-               edge_port = kmalloc (sizeof(struct edgeport_port), GFP_KERNEL);
+               edge_port = kzalloc(sizeof(struct edgeport_port), GFP_KERNEL);
                if (edge_port == NULL) {
                        dev_err(&serial->dev->dev, "%s - Out of memory\n", __FUNCTION__);
                        goto cleanup;
                }
-               memset (edge_port, 0, sizeof(struct edgeport_port));
                spin_lock_init(&edge_port->ep_lock);
                edge_port->ep_out_buf = edge_buf_alloc(EDGE_OUT_BUF_SIZE);
                if (edge_port->ep_out_buf == NULL) {
@@ -2820,7 +2811,7 @@ static struct edge_buf *edge_buf_alloc(unsigned int size)
        if (size == 0)
                return NULL;
 
-       eb = (struct edge_buf *)kmalloc(sizeof(struct edge_buf), GFP_KERNEL);
+       eb = kmalloc(sizeof(struct edge_buf), GFP_KERNEL);
        if (eb == NULL)
                return NULL;
 
@@ -2843,7 +2834,7 @@ static struct edge_buf *edge_buf_alloc(unsigned int size)
  * Free the buffer and all associated memory.
  */
 
-void edge_buf_free(struct edge_buf *eb)
+static void edge_buf_free(struct edge_buf *eb)
 {
        if (eb) {
                kfree(eb->buf_buf);
@@ -2982,10 +2973,12 @@ static unsigned int edge_buf_get(struct edge_buf *eb, char *buf,
 }
 
 
-static struct usb_serial_device_type edgeport_1port_device = {
-       .owner                  = THIS_MODULE,
-       .name                   = "Edgeport TI 1 port adapter",
-       .short_name             = "edgeport_ti_1",
+static struct usb_serial_driver edgeport_1port_device = {
+       .driver = {
+               .owner          = THIS_MODULE,
+               .name           = "edgeport_ti_1",
+       },
+       .description            = "Edgeport TI 1 port adapter",
        .id_table               = edgeport_1port_id_table,
        .num_interrupt_in       = 1,
        .num_bulk_in            = 1,
@@ -3010,10 +3003,12 @@ static struct usb_serial_device_type edgeport_1port_device = {
        .write_bulk_callback    = edge_bulk_out_callback,
 };
 
-static struct usb_serial_device_type edgeport_2port_device = {
-       .owner                  = THIS_MODULE,
-       .name                   = "Edgeport TI 2 port adapter",
-       .short_name             = "edgeport_ti_2",
+static struct usb_serial_driver edgeport_2port_device = {
+       .driver = {
+               .owner          = THIS_MODULE,
+               .name           = "edgeport_ti_2",
+       },
+       .description            = "Edgeport TI 2 port adapter",
        .id_table               = edgeport_2port_id_table,
        .num_interrupt_in       = 1,
        .num_bulk_in            = 2,