usbserial's mutex, open_count and tty_struct pointer in
struct usb_serial_port have been obsolated by the Serial Core port.

 Note that was necessary to change some bits in the generic code to
make it compile.

Signed-off-by: Luiz Fernando N. Capitulino <[EMAIL PROTECTED]>
---
 drivers/usb/serial/generic.c    |    6 +++---
 drivers/usb/serial/usb-serial.c |    6 ------
 drivers/usb/serial/usb-serial.h |    9 ---------
 3 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index c62cc28..9ae4764 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -117,8 +117,8 @@ int usb_serial_generic_open (struct usb_
        /* force low_latency on so that our tty_push actually forces the data 
through, 
           otherwise it is scheduled, and with high data rates (like with OHCI) 
data
           can get lost. */
-       if (port->tty)
-               port->tty->low_latency = 1;
+       if (port->uart_port.info->tty)
+               port->uart_port.info->tty->low_latency = 1;
 
        /* if we have a bulk interrupt, start reading from it */
        if (serial->num_bulk_in) {
@@ -266,7 +266,7 @@ void usb_serial_generic_read_bulk_callba
 
        usb_serial_debug_data(debug, &port->dev, __FUNCTION__, 
urb->actual_length, data);
 
-       tty = port->tty;
+       tty = port->uart_port.info->tty;
        if (tty && urb->actual_length) {
                tty_buffer_request_room(tty, urb->actual_length);
                tty_insert_flip_string(tty, data, urb->actual_length);
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index f4db7a9..fcfc4dc 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -28,7 +28,6 @@ #include <linux/serial_core.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/spinlock.h>
-#include <linux/mutex.h>
 #include <linux/list.h>
 #include <linux/smp_lock.h>
 #include <asm/uaccess.h>
@@ -118,9 +117,6 @@ static void destroy_serial(struct usb_se
        /* return the minor range that this device had */
        return_serial(serial);
 
-       for (i = 0; i < serial->num_ports; ++i)
-               serial->port[i]->open_count = 0;
-
        /* the ports are cleaned up and released in port_release() */
        for (i = 0; i < serial->num_ports; ++i)
                if (serial->port[i]->dev.parent != NULL) {
@@ -390,7 +386,6 @@ static struct usb_serial * create_serial
        serial->dev = usb_get_dev(dev);
        serial->type = driver;
        serial->interface = interface;
-       kref_init(&serial->kref);
 
        return serial;
 }
@@ -627,7 +622,6 @@ #endif
                port->number = i + serial->minor;
                port->serial = serial;
                spin_lock_init(&port->lock);
-               mutex_init(&port->mutex);
                INIT_WORK(&port->work, usb_serial_port_softint, port);
                serial->port[i] = port;
        }
diff --git a/drivers/usb/serial/usb-serial.h b/drivers/usb/serial/usb-serial.h
index b273efa..bc7d5e0 100644
--- a/drivers/usb/serial/usb-serial.h
+++ b/drivers/usb/serial/usb-serial.h
@@ -15,8 +15,6 @@ #ifndef __LINUX_USB_SERIAL_H
 #define __LINUX_USB_SERIAL_H
 
 #include <linux/config.h>
-#include <linux/kref.h>
-#include <linux/mutex.h>
 #include <linux/serial_core.h>
 
 #define SERIAL_TTY_MAJOR       188     /* Nice legal number now */
@@ -35,8 +33,6 @@ #define RELEVANT_IFLAG(iflag) (iflag & (
  * @serial: pointer back to the struct usb_serial owner of this port.
  * @tty: pointer to the corresponding tty for this port.
  * @lock: spinlock to grab when updating portions of this structure.
- * @mutex: mutex used to synchronize serial_open() and serial_close()
- *     access for this port.
  * @number: the number of the port (the minor number).
  * @interrupt_in_buffer: pointer to the interrupt in buffer for this port.
  * @interrupt_in_urb: pointer to the interrupt in struct urb for this port.
@@ -58,7 +54,6 @@ #define RELEVANT_IFLAG(iflag) (iflag & (
  *     port.
  * @write_wait: a wait_queue_head_t used by the port.
  * @work: work queue entry for the line discipline waking up.
- * @open_count: number of times this port has been opened.
  *
  * This structure is used by the usb-serial core and drivers for the specific
  * ports of a device.
@@ -66,9 +61,7 @@ #define RELEVANT_IFLAG(iflag) (iflag & (
 struct usb_serial_port {
        struct uart_port        uart_port;
        struct usb_serial *     serial;
-       struct tty_struct *     tty;
        spinlock_t              lock;
-       struct mutex            mutex;
        unsigned char           number;
 
        unsigned char *         interrupt_in_buffer;
@@ -93,7 +86,6 @@ struct usb_serial_port {
 
        wait_queue_head_t       write_wait;
        struct work_struct      work;
-       int                     open_count;
        struct device           dev;
 };
 #define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev)
@@ -138,7 +130,6 @@ struct usb_serial {
        char                            num_bulk_in;
        char                            num_bulk_out;
        struct usb_serial_port *        port[MAX_NUM_PORTS];
-       struct kref                     kref;
        void *                          private;
 };
 #define to_usb_serial(d) container_of(d, struct usb_serial, kref)
-- 
1.3.3.g0825d



_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to