]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/usb/serial.h
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394...
[linux-2.6-omap-h63xx.git] / include / linux / usb / serial.h
index 21b4a1c6f5851f9c92998694afd0171602af880b..09a3e6a7518fc2e043fd3568f95b74d822b78af6 100644 (file)
@@ -10,7 +10,6 @@
  *
  */
 
-
 #ifndef __LINUX_USB_SERIAL_H
 #define __LINUX_USB_SERIAL_H
 
@@ -63,7 +62,7 @@
  */
 struct usb_serial_port {
        struct usb_serial       *serial;
-       struct tty_struct       *tty;
+       struct tty_port         port;
        spinlock_t              lock;
        struct mutex            mutex;
        unsigned char           number;
@@ -90,7 +89,6 @@ struct usb_serial_port {
 
        wait_queue_head_t       write_wait;
        struct work_struct      work;
-       int                     open_count;
        char                    throttled;
        char                    throttle_req;
        char                    console;
@@ -146,8 +144,6 @@ struct usb_serial {
 };
 #define to_usb_serial(d) container_of(d, struct usb_serial, kref)
 
-#define NUM_DONT_CARE  99
-
 /* get and set the serial private data pointer helper functions */
 static inline void *usb_get_serial_data(struct usb_serial *serial)
 {
@@ -165,18 +161,6 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
  *     used in the syslog messages when a device is inserted or removed.
  * @id_table: pointer to a list of usb_device_id structures that define all
  *     of the devices this structure can support.
- * @num_interrupt_in: If a device doesn't have this many interrupt-in
- *     endpoints, it won't be sent to the driver's attach() method.
- *     (But it might still be sent to the probe() method.)
- * @num_interrupt_out: If a device doesn't have this many interrupt-out
- *     endpoints, it won't be sent to the driver's attach() method.
- *     (But it might still be sent to the probe() method.)
- * @num_bulk_in: If a device doesn't have this many bulk-in
- *     endpoints, it won't be sent to the driver's attach() method.
- *     (But it might still be sent to the probe() method.)
- * @num_bulk_out: If a device doesn't have this many bulk-out
- *     endpoints, it won't be sent to the driver's attach() method.
- *     (But it might still be sent to the probe() method.)
  * @num_ports: the number of different ports this device will have.
  * @calc_num_ports: pointer to a function to determine how many ports this
  *     device has dynamically.  It will be called after the probe()
@@ -212,10 +196,6 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
 struct usb_serial_driver {
        const char *description;
        const struct usb_device_id *id_table;
-       char    num_interrupt_in;
-       char    num_interrupt_out;
-       char    num_bulk_in;
-       char    num_bulk_out;
        char    num_ports;
 
        struct list_head        driver_list;
@@ -236,22 +216,27 @@ struct usb_serial_driver {
        int (*resume)(struct usb_serial *serial);
 
        /* serial function calls */
-       int  (*open)(struct usb_serial_port *port, struct file *filp);
-       void (*close)(struct usb_serial_port *port, struct file *filp);
-       int  (*write)(struct usb_serial_port *port, const unsigned char *buf,
-                     int count);
-       int  (*write_room)(struct usb_serial_port *port);
-       int  (*ioctl)(struct usb_serial_port *port, struct file *file,
+       /* Called by console with tty = NULL and by tty */
+       int  (*open)(struct tty_struct *tty,
+                       struct usb_serial_port *port, struct file *filp);
+       void (*close)(struct tty_struct *tty,
+                       struct usb_serial_port *port, struct file *filp);
+       int  (*write)(struct tty_struct *tty, struct usb_serial_port *port,
+                       const unsigned char *buf, int count);
+       /* Called only by the tty layer */
+       int  (*write_room)(struct tty_struct *tty);
+       int  (*ioctl)(struct tty_struct *tty, struct file *file,
                      unsigned int cmd, unsigned long arg);
-       void (*set_termios)(struct usb_serial_port *port, struct ktermios *old);
-       void (*break_ctl)(struct usb_serial_port *port, int break_state);
-       int  (*chars_in_buffer)(struct usb_serial_port *port);
-       void (*throttle)(struct usb_serial_port *port);
-       void (*unthrottle)(struct usb_serial_port *port);
-       int  (*tiocmget)(struct usb_serial_port *port, struct file *file);
-       int  (*tiocmset)(struct usb_serial_port *port, struct file *file,
+       void (*set_termios)(struct tty_struct *tty,
+                       struct usb_serial_port *port, struct ktermios *old);
+       void (*break_ctl)(struct tty_struct *tty, int break_state);
+       int  (*chars_in_buffer)(struct tty_struct *tty);
+       void (*throttle)(struct tty_struct *tty);
+       void (*unthrottle)(struct tty_struct *tty);
+       int  (*tiocmget)(struct tty_struct *tty, struct file *file);
+       int  (*tiocmset)(struct tty_struct *tty, struct file *file,
                         unsigned int set, unsigned int clear);
-
+       /* USB events */
        void (*read_int_callback)(struct urb *urb);
        void (*write_int_callback)(struct urb *urb);
        void (*read_bulk_callback)(struct urb *urb);
@@ -289,19 +274,19 @@ static inline void usb_serial_console_disconnect(struct usb_serial *serial) {}
 /* Functions needed by other parts of the usbserial core */
 extern struct usb_serial *usb_serial_get_by_index(unsigned int minor);
 extern void usb_serial_put(struct usb_serial *serial);
-extern int usb_serial_generic_open(struct usb_serial_port *port,
-                                  struct file *filp);
-extern int usb_serial_generic_write(struct usb_serial_port *port,
-                                   const unsigned char *buf, int count);
-extern void usb_serial_generic_close(struct usb_serial_port *port,
-                                    struct file *filp);
+extern int usb_serial_generic_open(struct tty_struct *tty,
+               struct usb_serial_port *port, struct file *filp);
+extern int usb_serial_generic_write(struct tty_struct *tty,
+       struct usb_serial_port *port, const unsigned char *buf, int count);
+extern void usb_serial_generic_close(struct tty_struct *tty,
+                       struct usb_serial_port *port, struct file *filp);
 extern int usb_serial_generic_resume(struct usb_serial *serial);
-extern int usb_serial_generic_write_room(struct usb_serial_port *port);
-extern int usb_serial_generic_chars_in_buffer(struct usb_serial_port *port);
+extern int usb_serial_generic_write_room(struct tty_struct *tty);
+extern int usb_serial_generic_chars_in_buffer(struct tty_struct *tty);
 extern void usb_serial_generic_read_bulk_callback(struct urb *urb);
 extern void usb_serial_generic_write_bulk_callback(struct urb *urb);
-extern void usb_serial_generic_throttle(struct usb_serial_port *port);
-extern void usb_serial_generic_unthrottle(struct usb_serial_port *port);
+extern void usb_serial_generic_throttle(struct tty_struct *tty);
+extern void usb_serial_generic_unthrottle(struct tty_struct *tty);
 extern void usb_serial_generic_shutdown(struct usb_serial *serial);
 extern int usb_serial_generic_register(int debug);
 extern void usb_serial_generic_deregister(void);
@@ -340,5 +325,5 @@ static inline void usb_serial_debug_data(int debug,
 
 
 
-#endif /* ifdef __LINUX_USB_SERIAL_H */
+#endif /* __LINUX_USB_SERIAL_H */