aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/ch341.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/ch341.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/ch341.c')
-rw-r--r--drivers/usb/serial/ch341.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
index 1f7c86bd8297..f61e3ca64305 100644
--- a/drivers/usb/serial/ch341.c
+++ b/drivers/usb/serial/ch341.c
@@ -232,7 +232,8 @@ error: kfree(priv);
232} 232}
233 233
234/* open this device, set default parameters */ 234/* open this device, set default parameters */
235static int ch341_open(struct usb_serial_port *port, struct file *filp) 235static int ch341_open(struct tty_struct *tty, struct usb_serial_port *port,
236 struct file *filp)
236{ 237{
237 struct usb_serial *serial = port->serial; 238 struct usb_serial *serial = port->serial;
238 struct ch341_private *priv = usb_get_serial_port_data(serial->port[0]); 239 struct ch341_private *priv = usb_get_serial_port_data(serial->port[0]);
@@ -256,7 +257,7 @@ static int ch341_open(struct usb_serial_port *port, struct file *filp)
256 if (r) 257 if (r)
257 goto out; 258 goto out;
258 259
259 r = usb_serial_generic_open(port, filp); 260 r = usb_serial_generic_open(tty, port, filp);
260 261
261out: return r; 262out: return r;
262} 263}
@@ -264,11 +265,10 @@ out: return r;
264/* Old_termios contains the original termios settings and 265/* Old_termios contains the original termios settings and
265 * tty->termios contains the new setting to be used. 266 * tty->termios contains the new setting to be used.
266 */ 267 */
267static void ch341_set_termios(struct usb_serial_port *port, 268static void ch341_set_termios(struct tty_struct *tty,
268 struct ktermios *old_termios) 269 struct usb_serial_port *port, struct ktermios *old_termios)
269{ 270{
270 struct ch341_private *priv = usb_get_serial_port_data(port); 271 struct ch341_private *priv = usb_get_serial_port_data(port);
271 struct tty_struct *tty = port->tty;
272 unsigned baud_rate; 272 unsigned baud_rate;
273 273
274 dbg("ch341_set_termios()"); 274 dbg("ch341_set_termios()");