VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / drivers / usb / serial / ir-usb.c
index e2d0d67..cb42cc7 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"
 
 /*
@@ -101,9 +94,11 @@ struct irda_class_desc {
        u8      bMaxUnicastList;
 } __attribute__ ((packed));
 
+static int debug;
+
 /* if overridden by the user, then use their value for the size of the read and
  * write urbs */
-static int buffer_size = 0;
+static int buffer_size;
 /* if overridden by the user, then use the specified number of XBOFs */
 static int xbof = -1;
 
@@ -138,7 +133,7 @@ static struct usb_driver ir_driver = {
 };
 
 
-struct usb_serial_device_type ir_device = {
+static struct usb_serial_device_type ir_device = {
        .owner =                THIS_MODULE,
        .name =                 "IR Dongle",
        .id_table =             id_table,
@@ -279,13 +274,9 @@ static int ir_startup (struct usb_serial *serial)
 
 static int ir_open (struct usb_serial_port *port, struct file *filp)
 {
-       struct usb_serial *serial = port->serial;
        char *buffer;
        int result = 0;
 
-       if (port_paranoia_check (port, __FUNCTION__))
-               return -ENODEV;
-       
        dbg("%s - port %d", __FUNCTION__, port->number);
 
        if (buffer_size) {
@@ -313,8 +304,8 @@ static int ir_open (struct usb_serial_port *port, struct file *filp)
        /* Start reading from the device */
        usb_fill_bulk_urb (
                port->read_urb,
-               serial->dev, 
-               usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress),
+               port->serial->dev, 
+               usb_rcvbulkpipe(port->serial->dev, port->bulk_in_endpointAddress),
                port->read_urb->transfer_buffer,
                port->read_urb->transfer_buffer_length,
                ir_read_bulk_callback,
@@ -328,21 +319,10 @@ static int ir_open (struct usb_serial_port *port, struct file *filp)
 
 static void ir_close (struct usb_serial_port *port, struct file * filp)
 {
-       struct usb_serial *serial;
-
-       if (port_paranoia_check (port, __FUNCTION__))
-               return;
-       
        dbg("%s - port %d", __FUNCTION__, port->number);
                         
-       serial = get_usb_serial (port, __FUNCTION__);
-       if (!serial)
-               return;
-       
-       if (serial->dev) {
-               /* shutdown our bulk read */
-               usb_unlink_urb (port->read_urb);
-       }
+       /* shutdown our bulk read */
+       usb_unlink_urb (port->read_urb);
 }
 
 static int ir_write (struct usb_serial_port *port, int from_user, const unsigned char *buf, int count)
@@ -411,9 +391,6 @@ static void ir_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
 {
        struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
 
-       if (port_paranoia_check (port, __FUNCTION__))
-               return;
-       
        dbg("%s - port %d", __FUNCTION__, port->number);
        
        if (urb->status) {
@@ -422,7 +399,8 @@ static void ir_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
        }
 
        usb_serial_debug_data (
-               __FILE__,
+               debug,
+               &port->dev,
                __FUNCTION__,
                urb->actual_length,
                urb->transfer_buffer);
@@ -433,21 +411,12 @@ static void ir_write_bulk_callback (struct urb *urb, struct pt_regs *regs)
 static void ir_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
 {
        struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
-       struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
        struct tty_struct *tty;
        unsigned char *data = urb->transfer_buffer;
        int result;
 
-       if (port_paranoia_check (port, __FUNCTION__))
-               return;
-
        dbg("%s - port %d", __FUNCTION__, port->number);
 
-       if (!serial) {
-               dbg("%s - bad serial pointer, exiting", __FUNCTION__);
-               return;
-       }
-
        if (!port->open_count) {
                dbg("%s - port closed.", __FUNCTION__);
                return;
@@ -466,7 +435,8 @@ static void ir_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
                                ir_baud = *data & 0x0f;
 
                        usb_serial_debug_data (
-                               __FILE__,
+                               debug,
+                               &port->dev,
                                __FUNCTION__,
                                urb->actual_length,
                                data);
@@ -496,8 +466,8 @@ static void ir_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
                        /* Continue trying to always read */
                        usb_fill_bulk_urb (
                                port->read_urb,
-                               serial->dev, 
-                               usb_rcvbulkpipe(serial->dev,
+                               port->serial->dev, 
+                               usb_rcvbulkpipe(port->serial->dev,
                                        port->bulk_in_endpointAddress),
                                port->read_urb->transfer_buffer,
                                port->read_urb->transfer_buffer_length,
@@ -641,10 +611,10 @@ 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");
-MODULE_PARM(xbof, "i");
+module_param(xbof, int, 0);
 MODULE_PARM_DESC(xbof, "Force specific number of XBOFs");
-MODULE_PARM(buffer_size, "i");
+module_param(buffer_size, int, 0);
 MODULE_PARM_DESC(buffer_size, "Size of the transfer buffers");