vserver 2.0 rc7
[linux-2.6.git] / drivers / usb / serial / omninet.c
index 5c4602b..b5f2c06 100644 (file)
 #include <linux/spinlock.h>
 #include <asm/uaccess.h>
 #include <linux/usb.h>
-
-#ifdef CONFIG_USB_SERIAL_DEBUG
-       static int debug = 1;
-#else
-       static int debug;
-#endif
-
 #include "usb-serial.h"
 
+static int debug;
 
 /*
  * Version Information
@@ -73,7 +67,7 @@ static int  omninet_open              (struct usb_serial_port *port, struct file *filp);
 static void omninet_close              (struct usb_serial_port *port, struct file *filp);
 static void omninet_read_bulk_callback (struct urb *urb, struct pt_regs *regs);
 static void omninet_write_bulk_callback        (struct urb *urb, struct pt_regs *regs);
-static int  omninet_write              (struct usb_serial_port *port, int from_user, const unsigned char *buf, int count);
+static int  omninet_write              (struct usb_serial_port *port, const unsigned char *buf, int count);
 static int  omninet_write_room         (struct usb_serial_port *port);
 static void omninet_shutdown           (struct usb_serial *serial);
 
@@ -184,17 +178,14 @@ static void omninet_close (struct usb_serial_port *port, struct file * filp)
 {
        struct usb_serial       *serial = port->serial;
        struct usb_serial_port  *wport;
-       struct omninet_data     *od;
 
        dbg("%s - port %d", __FUNCTION__, port->number);
 
        wport = serial->port[1];
-       usb_unlink_urb(wport->write_urb);
-       usb_unlink_urb(port->read_urb);
+       usb_kill_urb(wport->write_urb);
+       usb_kill_urb(port->read_urb);
 
-       od = usb_get_serial_port_data(port);
-       if (od)
-               kfree(od);
+       kfree(usb_get_serial_port_data(port));
 }
 
 
@@ -247,7 +238,7 @@ static void omninet_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
        return;
 }
 
-static int omninet_write (struct usb_serial_port *port, int from_user, const unsigned char *buf, int count)
+static int omninet_write (struct usb_serial_port *port, const unsigned char *buf, int count)
 {
        struct usb_serial       *serial = port->serial;
        struct usb_serial_port  *wport  = serial->port[1];
@@ -270,17 +261,9 @@ static int omninet_write (struct usb_serial_port *port, int from_user, const uns
 
        count = (count > OMNINET_BULKOUTSIZE) ? OMNINET_BULKOUTSIZE : count;
 
-       if (from_user) {
-               if (copy_from_user(wport->write_urb->transfer_buffer + OMNINET_DATAOFFSET, buf, count) != 0) {
-                       result = -EFAULT;
-                       goto exit;
-               }
-       }
-       else {
-               memcpy (wport->write_urb->transfer_buffer + OMNINET_DATAOFFSET, buf, count);
-       }
+       memcpy (wport->write_urb->transfer_buffer + OMNINET_DATAOFFSET, buf, count);
 
-       usb_serial_debug_data (__FILE__, __FUNCTION__, count, wport->write_urb->transfer_buffer);
+       usb_serial_debug_data(debug, &port->dev, __FUNCTION__, count, wport->write_urb->transfer_buffer);
 
        header->oh_seq  = od->od_outseq++;
        header->oh_len  = count;
@@ -297,7 +280,6 @@ static int omninet_write (struct usb_serial_port *port, int from_user, const uns
        else
                result = count;
 
-exit:  
        return result;
 }
 
@@ -373,6 +355,5 @@ MODULE_AUTHOR( DRIVER_AUTHOR );
 MODULE_DESCRIPTION( DRIVER_DESC );
 MODULE_LICENSE("GPL");
 
-MODULE_PARM(debug, "i");
+module_param(debug, bool, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(debug, "Debug enabled or not");
-