aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/ipw.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/ipw.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/ipw.c')
-rw-r--r--drivers/usb/serial/ipw.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c
index bc85ca5c1c37..a89ebfe9e915 100644
--- a/drivers/usb/serial/ipw.c
+++ b/drivers/usb/serial/ipw.c
@@ -179,7 +179,7 @@ static void ipw_read_bulk_callback(struct urb *urb)
179 179
180 usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); 180 usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data);
181 181
182 tty = port->tty; 182 tty = port->port.tty;
183 if (tty && urb->actual_length) { 183 if (tty && urb->actual_length) {
184 tty_buffer_request_room(tty, urb->actual_length); 184 tty_buffer_request_room(tty, urb->actual_length);
185 tty_insert_flip_string(tty, data, urb->actual_length); 185 tty_insert_flip_string(tty, data, urb->actual_length);
@@ -199,7 +199,8 @@ static void ipw_read_bulk_callback(struct urb *urb)
199 return; 199 return;
200} 200}
201 201
202static int ipw_open(struct usb_serial_port *port, struct file *filp) 202static int ipw_open(struct tty_struct *tty,
203 struct usb_serial_port *port, struct file *filp)
203{ 204{
204 struct usb_device *dev = port->serial->dev; 205 struct usb_device *dev = port->serial->dev;
205 u8 buf_flow_static[16] = IPW_BYTES_FLOWINIT; 206 u8 buf_flow_static[16] = IPW_BYTES_FLOWINIT;
@@ -212,8 +213,8 @@ static int ipw_open(struct usb_serial_port *port, struct file *filp)
212 if (!buf_flow_init) 213 if (!buf_flow_init)
213 return -ENOMEM; 214 return -ENOMEM;
214 215
215 if (port->tty) 216 if (tty)
216 port->tty->low_latency = 1; 217 tty->low_latency = 1;
217 218
218 /* --1: Tell the modem to initialize (we think) From sniffs this is always the 219 /* --1: Tell the modem to initialize (we think) From sniffs this is always the
219 * first thing that gets sent to the modem during opening of the device */ 220 * first thing that gets sent to the modem during opening of the device */
@@ -301,7 +302,8 @@ static int ipw_open(struct usb_serial_port *port, struct file *filp)
301 return 0; 302 return 0;
302} 303}
303 304
304static void ipw_close(struct usb_serial_port *port, struct file * filp) 305static void ipw_close(struct tty_struct *tty,
306 struct usb_serial_port *port, struct file * filp)
305{ 307{
306 struct usb_device *dev = port->serial->dev; 308 struct usb_device *dev = port->serial->dev;
307 int result; 309 int result;
@@ -384,7 +386,8 @@ static void ipw_write_bulk_callback(struct urb *urb)
384 usb_serial_port_softint(port); 386 usb_serial_port_softint(port);
385} 387}
386 388
387static int ipw_write(struct usb_serial_port *port, const unsigned char *buf, int count) 389static int ipw_write(struct tty_struct *tty, struct usb_serial_port *port,
390 const unsigned char *buf, int count)
388{ 391{
389 struct usb_device *dev = port->serial->dev; 392 struct usb_device *dev = port->serial->dev;
390 int ret; 393 int ret;