aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/navman.c
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2008-07-22 06:09:07 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-22 16:03:22 -0400
commit95da310e66ee8090119596c70ca8432e57f9a97f (patch)
tree7f18c30e9c9ad4d7d53df6453fa338be06f09a85 /drivers/usb/serial/navman.c
parent1aa3692da57c773e5c76de55c5c4a953962d360e (diff)
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/navman.c')
-rw-r--r--drivers/usb/serial/navman.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/usb/serial/navman.c b/drivers/usb/serial/navman.c
index 43c8894353bf..d6736531a0fa 100644
--- a/drivers/usb/serial/navman.c
+++ b/drivers/usb/serial/navman.c
@@ -64,7 +64,7 @@ static void navman_read_int_callback(struct urb *urb)
64 usb_serial_debug_data(debug, &port->dev, __func__, 64 usb_serial_debug_data(debug, &port->dev, __func__,
65 urb->actual_length, data); 65 urb->actual_length, data);
66 66
67 tty = port->tty; 67 tty = port->port.tty;
68 if (tty && urb->actual_length) { 68 if (tty && urb->actual_length) {
69 tty_buffer_request_room(tty, urb->actual_length); 69 tty_buffer_request_room(tty, urb->actual_length);
70 tty_insert_flip_string(tty, data, urb->actual_length); 70 tty_insert_flip_string(tty, data, urb->actual_length);
@@ -79,7 +79,8 @@ exit:
79 __func__, result); 79 __func__, result);
80} 80}
81 81
82static int navman_open(struct usb_serial_port *port, struct file *filp) 82static int navman_open(struct tty_struct *tty,
83 struct usb_serial_port *port, struct file *filp)
83{ 84{
84 int result = 0; 85 int result = 0;
85 86
@@ -96,14 +97,15 @@ static int navman_open(struct usb_serial_port *port, struct file *filp)
96 return result; 97 return result;
97} 98}
98 99
99static void navman_close(struct usb_serial_port *port, struct file *filp) 100static void navman_close(struct tty_struct *tty,
101 struct usb_serial_port *port, struct file *filp)
100{ 102{
101 dbg("%s - port %d", __func__, port->number); 103 dbg("%s - port %d", __func__, port->number);
102 104
103 usb_kill_urb(port->interrupt_in_urb); 105 usb_kill_urb(port->interrupt_in_urb);
104} 106}
105 107
106static int navman_write(struct usb_serial_port *port, 108static int navman_write(struct tty_struct *tty, struct usb_serial_port *port,
107 const unsigned char *buf, int count) 109 const unsigned char *buf, int count)
108{ 110{
109 dbg("%s - port %d", __func__, port->number); 111 dbg("%s - port %d", __func__, port->number);