vserver 2.0 rc7
[linux-2.6.git] / drivers / usb / serial / belkin_sa.c
index 4592d7a..abb1b2c 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"
 #include "belkin_sa.h"
 
+static int debug;
+
 /*
  * Version Information
  */
@@ -163,7 +158,7 @@ struct belkin_sa_private {
  * ***************************************************************************
  */
 
-#define WDR_TIMEOUT (HZ * 5 ) /* default urb timeout */
+#define WDR_TIMEOUT 5000 /* default urb timeout */
 
 /* assumes that struct usb_serial *serial is available */
 #define BSA_USB_CMD(c,v) usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), \
@@ -186,8 +181,8 @@ static int belkin_sa_startup (struct usb_serial *serial)
        priv->last_lsr = 0;
        priv->last_msr = 0;
        /* see comments at top of file */
-       priv->bad_flow_control = (dev->descriptor.bcdDevice <= 0x0206) ? 1 : 0;
-       info("bcdDevice: %04x, bfc: %d", dev->descriptor.bcdDevice, priv->bad_flow_control);
+       priv->bad_flow_control = (le16_to_cpu(dev->descriptor.bcdDevice) <= 0x0206) ? 1 : 0;
+       info("bcdDevice: %04x, bfc: %d", le16_to_cpu(dev->descriptor.bcdDevice), priv->bad_flow_control);
 
        init_waitqueue_head(&serial->port[0]->write_wait);
        usb_set_serial_port_data(serial->port[0], priv);
@@ -207,8 +202,7 @@ static void belkin_sa_shutdown (struct usb_serial *serial)
        for (i=0; i < serial->num_ports; ++i) {
                /* My special items, the standard routines free my urbs */
                priv = usb_get_serial_port_data(serial->port[i]);
-               if (priv)
-                       kfree(priv);
+               kfree(priv);
        }
 }
 
@@ -233,7 +227,7 @@ static int  belkin_sa_open (struct usb_serial_port *port, struct file *filp)
        port->interrupt_in_urb->dev = port->serial->dev;
        retval = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
        if (retval) {
-               usb_unlink_urb(port->read_urb);
+               usb_kill_urb(port->read_urb);
                err(" usb_submit_urb(read int) failed");
        }
 
@@ -244,23 +238,12 @@ exit:
 
 static void belkin_sa_close (struct usb_serial_port *port, struct file *filp)
 {
-       struct usb_serial *serial;
-
-       if (port_paranoia_check (port, __FUNCTION__))
-               return;
-
-       serial = get_usb_serial (port, __FUNCTION__);
-       if (!serial)
-               return;
-
        dbg("%s port %d", __FUNCTION__, port->number);
 
-       if (serial->dev) {
-               /* shutdown our bulk reads and writes */
-               usb_unlink_urb (port->write_urb);
-               usb_unlink_urb (port->read_urb);
-               usb_unlink_urb (port->interrupt_in_urb);
-       }
+       /* shutdown our bulk reads and writes */
+       usb_kill_urb(port->write_urb);
+       usb_kill_urb(port->read_urb);
+       usb_kill_urb(port->interrupt_in_urb);
 } /* belkin_sa_close */
 
 
@@ -268,7 +251,6 @@ static void belkin_sa_read_int_callback (struct urb *urb, struct pt_regs *regs)
 {
        struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
        struct belkin_sa_private *priv;
-       struct usb_serial *serial;
        unsigned char *data = urb->transfer_buffer;
        int retval;
        unsigned long flags;
@@ -288,15 +270,7 @@ static void belkin_sa_read_int_callback (struct urb *urb, struct pt_regs *regs)
                goto exit;
        }
 
-       if (port_paranoia_check (port, __FUNCTION__))
-               return;
-
-       serial = port->serial;
-
-       if (serial_paranoia_check (serial, __FUNCTION__))
-               return;
-       
-       usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
+       usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data);
 
        /* Handle known interrupt data */
        /* ignore data[0] and data[1] */
@@ -632,8 +606,8 @@ module_exit (belkin_sa_exit);
 
 MODULE_AUTHOR( DRIVER_AUTHOR );
 MODULE_DESCRIPTION( DRIVER_DESC );
+MODULE_VERSION( DRIVER_VERSION );
 MODULE_LICENSE("GPL");
 
-MODULE_PARM(debug, "i");
+module_param(debug, bool, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(debug, "Debug enabled or not");
-