USB: AT91 UDC updates, mostly power management
[powerpc.git] / drivers / usb / gadget / serial.c
index b58f015..e762aa1 100644 (file)
@@ -17,7 +17,6 @@
  *
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/delay.h>
@@ -45,7 +44,7 @@
 #include <asm/uaccess.h>
 
 #include <linux/usb_ch9.h>
-#include <linux/usb_cdc.h>
+#include <linux/usb/cdc.h>
 #include <linux/usb_gadget.h>
 
 #include "gadget_chips.h"
@@ -53,8 +52,8 @@
 
 /* Defines */
 
-#define GS_VERSION_STR                 "v2.1"
-#define GS_VERSION_NUM                 0x0201
+#define GS_VERSION_STR                 "v2.2"
+#define GS_VERSION_NUM                 0x0202
 
 #define GS_LONG_NAME                   "Gadget Serial"
 #define GS_SHORT_NAME                  "g_serial"
@@ -588,12 +587,11 @@ static int __init gs_module_init(void)
        gs_tty_driver->owner = THIS_MODULE;
        gs_tty_driver->driver_name = GS_SHORT_NAME;
        gs_tty_driver->name = "ttygs";
-       gs_tty_driver->devfs_name = "usb/ttygs/";
        gs_tty_driver->major = GS_MAJOR;
        gs_tty_driver->minor_start = GS_MINOR_START;
        gs_tty_driver->type = TTY_DRIVER_TYPE_SERIAL;
        gs_tty_driver->subtype = SERIAL_TYPE_NORMAL;
-       gs_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS;
+       gs_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
        gs_tty_driver->init_termios = tty_std_termios;
        gs_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
        tty_set_operations(gs_tty_driver, &gs_tty_ops);
@@ -774,18 +772,16 @@ exit_unlock_dev:
 
 #define GS_WRITE_FINISHED_EVENT_SAFELY(p)                      \
 ({                                                             \
-       unsigned long flags;                                    \
        int cond;                                               \
                                                                \
-       spin_lock_irqsave(&(p)->port_lock, flags);              \
+       spin_lock_irq(&(p)->port_lock);                         \
        cond = !(p)->port_dev || !gs_buf_data_avail((p)->port_write_buf); \
-       spin_unlock_irqrestore(&(p)->port_lock, flags);         \
+       spin_unlock_irq(&(p)->port_lock);                       \
        cond;                                                   \
 })
 
 static void gs_close(struct tty_struct *tty, struct file *file)
 {
-       unsigned long flags;
        struct gs_port *port = tty->driver_data;
        struct semaphore *sem;
 
@@ -799,7 +795,7 @@ static void gs_close(struct tty_struct *tty, struct file *file)
        sem = &gs_open_close_sem[port->port_num];
        down(sem);
 
-       spin_lock_irqsave(&port->port_lock, flags);
+       spin_lock_irq(&port->port_lock);
 
        if (port->port_open_count == 0) {
                printk(KERN_ERR
@@ -827,11 +823,11 @@ static void gs_close(struct tty_struct *tty, struct file *file)
        /* wait for write buffer to drain, or */
        /* at most GS_CLOSE_TIMEOUT seconds */
        if (gs_buf_data_avail(port->port_write_buf) > 0) {
-               spin_unlock_irqrestore(&port->port_lock, flags);
+               spin_unlock_irq(&port->port_lock);
                wait_event_interruptible_timeout(port->port_write_wait,
                                        GS_WRITE_FINISHED_EVENT_SAFELY(port),
                                        GS_CLOSE_TIMEOUT * HZ);
-               spin_lock_irqsave(&port->port_lock, flags);
+               spin_lock_irq(&port->port_lock);
        }
 
        /* free disconnected port on final close */
@@ -851,7 +847,7 @@ static void gs_close(struct tty_struct *tty, struct file *file)
                port->port_num, tty, file);
 
 exit:
-       spin_unlock_irqrestore(&port->port_lock, flags);
+       spin_unlock_irq(&port->port_lock);
        up(sem);
 }
 
@@ -1477,7 +1473,7 @@ autoconf_fail:
  * Called on module unload.  Frees the control request and device
  * structure.
  */
-static void __exit gs_unbind(struct usb_gadget *gadget)
+static void /* __init_or_exit */ gs_unbind(struct usb_gadget *gadget)
 {
        struct gs_dev *dev = get_gadget_data(gadget);