summaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/omninet.c
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2008-07-22 11:09:07 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-22 13:03:22 -0700
commit95da310e66ee8090119596c70ca8432e57f9a97f (patch)
tree7f18c30e9c9ad4d7d53df6453fa338be06f09a85 /drivers/usb/serial/omninet.c
parent1aa3692da57c773e5c76de55c5c4a953962d360e (diff)
downloadlinux-95da310e66ee8090119596c70ca8432e57f9a97f.tar.bz2
usb_serial: API all change
USB serial likes to use port->tty back pointers for the real work it does and to do so without any actual locking. Unfortunately when you consider hangup events, hangup/parallel reopen or even worse hangup followed by parallel close events the tty->port and port->tty pointers are not guaranteed to be the same as port->tty is the active tty while tty->port is the port the tty may or may not still be attached to. So rework the entire API to pass the tty struct. For console cases we need to pass both for now. This shows up multiple drivers that immediately crash with USB console some of which have been fixed in the process. Longer term we need a proper tty as console abstraction Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/usb/serial/omninet.c')
-rw-r--r--drivers/usb/serial/omninet.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
index 7b7422f49478..5a2d045562f0 100644
--- a/drivers/usb/serial/omninet.c
+++ b/drivers/usb/serial/omninet.c
@@ -61,12 +61,12 @@ static int debug;
#define BT_IGNITIONPRO_ID 0x2000 /* This one seems to be a re-branded ZyXEL device */
/* function prototypes */
-static int omninet_open (struct usb_serial_port *port, struct file *filp);
-static void omninet_close (struct usb_serial_port *port, struct file *filp);
+static int omninet_open (struct tty_struct *tty, struct usb_serial_port *port, struct file *filp);
+static void omninet_close (struct tty_struct *tty, struct usb_serial_port *port, struct file *filp);
static void omninet_read_bulk_callback (struct urb *urb);
static void omninet_write_bulk_callback (struct urb *urb);
-static int omninet_write (struct usb_serial_port *port, const unsigned char *buf, int count);
-static int omninet_write_room (struct usb_serial_port *port);
+static int omninet_write (struct tty_struct *tty, struct usb_serial_port *port, const unsigned char *buf, int count);
+static int omninet_write_room (struct tty_struct *tty);
static void omninet_shutdown (struct usb_serial *serial);
static int omninet_attach (struct usb_serial *serial);
@@ -157,7 +157,8 @@ static int omninet_attach (struct usb_serial *serial)
return 0;
}
-static int omninet_open (struct usb_serial_port *port, struct file *filp)
+static int omninet_open(struct tty_struct *tty,
+ struct usb_serial_port *port, struct file *filp)
{
struct usb_serial *serial = port->serial;
struct usb_serial_port *wport;
@@ -166,7 +167,7 @@ static int omninet_open (struct usb_serial_port *port, struct file *filp)
dbg("%s - port %d", __func__, port->number);
wport = serial->port[1];
- wport->tty = port->tty;
+ wport->port.tty = tty; /* FIXME */
/* Start reading from the device */
usb_fill_bulk_urb(port->read_urb, serial->dev,
@@ -181,7 +182,8 @@ static int omninet_open (struct usb_serial_port *port, struct file *filp)
return result;
}
-static void omninet_close (struct usb_serial_port *port, struct file * filp)
+static void omninet_close(struct tty_struct *tty,
+ struct usb_serial_port *port, struct file * filp)
{
dbg("%s - port %d", __func__, port->number);
usb_kill_urb(port->read_urb);
@@ -221,9 +223,9 @@ static void omninet_read_bulk_callback (struct urb *urb)
if (urb->actual_length && header->oh_len) {
for (i = 0; i < header->oh_len; i++) {
- tty_insert_flip_char(port->tty, data[OMNINET_DATAOFFSET + i], 0);
+ tty_insert_flip_char(port->port.tty, data[OMNINET_DATAOFFSET + i], 0);
}
- tty_flip_buffer_push(port->tty);
+ tty_flip_buffer_push(port->port.tty);
}
/* Continue trying to always read */
@@ -238,7 +240,8 @@ static void omninet_read_bulk_callback (struct urb *urb)
return;
}
-static int omninet_write (struct usb_serial_port *port, const unsigned char *buf, int count)
+static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port,
+ const unsigned char *buf, int count)
{
struct usb_serial *serial = port->serial;
struct usb_serial_port *wport = serial->port[1];
@@ -290,8 +293,9 @@ static int omninet_write (struct usb_serial_port *port, const unsigned char *buf
}
-static int omninet_write_room (struct usb_serial_port *port)
+static int omninet_write_room (struct tty_struct *tty)
{
+ struct usb_serial_port *port = tty->driver_data;
struct usb_serial *serial = port->serial;
struct usb_serial_port *wport = serial->port[1];