aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/keyspan.h
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/keyspan.h
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/keyspan.h')
-rw-r--r--drivers/usb/serial/keyspan.h39
1 files changed, 12 insertions, 27 deletions
diff --git a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h
index 8bf72639b148..38b4582e0734 100644
--- a/drivers/usb/serial/keyspan.h
+++ b/drivers/usb/serial/keyspan.h
@@ -35,17 +35,18 @@
35 35
36 36
37/* Function prototypes for Keyspan serial converter */ 37/* Function prototypes for Keyspan serial converter */
38static int keyspan_open (struct usb_serial_port *port, 38static int keyspan_open (struct tty_struct *tty,
39 struct usb_serial_port *port,
39 struct file *filp); 40 struct file *filp);
40static void keyspan_close (struct usb_serial_port *port, 41static void keyspan_close (struct tty_struct *tty,
42 struct usb_serial_port *port,
41 struct file *filp); 43 struct file *filp);
42static int keyspan_startup (struct usb_serial *serial); 44static int keyspan_startup (struct usb_serial *serial);
43static void keyspan_shutdown (struct usb_serial *serial); 45static void keyspan_shutdown (struct usb_serial *serial);
44static void keyspan_rx_throttle (struct usb_serial_port *port); 46static int keyspan_write_room (struct tty_struct *tty);
45static void keyspan_rx_unthrottle (struct usb_serial_port *port);
46static int keyspan_write_room (struct usb_serial_port *port);
47 47
48static int keyspan_write (struct usb_serial_port *port, 48static int keyspan_write (struct tty_struct *tty,
49 struct usb_serial_port *port,
49 const unsigned char *buf, 50 const unsigned char *buf,
50 int count); 51 int count);
51 52
@@ -53,18 +54,14 @@ static void keyspan_send_setup (struct usb_serial_port *port,
53 int reset_port); 54 int reset_port);
54 55
55 56
56static int keyspan_chars_in_buffer (struct usb_serial_port *port); 57static void keyspan_set_termios (struct tty_struct *tty,
57static int keyspan_ioctl (struct usb_serial_port *port, 58 struct usb_serial_port *port,
58 struct file *file,
59 unsigned int cmd,
60 unsigned long arg);
61static void keyspan_set_termios (struct usb_serial_port *port,
62 struct ktermios *old); 59 struct ktermios *old);
63static void keyspan_break_ctl (struct usb_serial_port *port, 60static void keyspan_break_ctl (struct tty_struct *tty,
64 int break_state); 61 int break_state);
65static int keyspan_tiocmget (struct usb_serial_port *port, 62static int keyspan_tiocmget (struct tty_struct *tty,
66 struct file *file); 63 struct file *file);
67static int keyspan_tiocmset (struct usb_serial_port *port, 64static int keyspan_tiocmset (struct tty_struct *tty,
68 struct file *file, unsigned int set, 65 struct file *file, unsigned int set,
69 unsigned int clear); 66 unsigned int clear);
70static int keyspan_fake_startup (struct usb_serial *serial); 67static int keyspan_fake_startup (struct usb_serial *serial);
@@ -567,10 +564,6 @@ static struct usb_serial_driver keyspan_1port_device = {
567 .close = keyspan_close, 564 .close = keyspan_close,
568 .write = keyspan_write, 565 .write = keyspan_write,
569 .write_room = keyspan_write_room, 566 .write_room = keyspan_write_room,
570 .chars_in_buffer = keyspan_chars_in_buffer,
571 .throttle = keyspan_rx_throttle,
572 .unthrottle = keyspan_rx_unthrottle,
573 .ioctl = keyspan_ioctl,
574 .set_termios = keyspan_set_termios, 567 .set_termios = keyspan_set_termios,
575 .break_ctl = keyspan_break_ctl, 568 .break_ctl = keyspan_break_ctl,
576 .tiocmget = keyspan_tiocmget, 569 .tiocmget = keyspan_tiocmget,
@@ -591,10 +584,6 @@ static struct usb_serial_driver keyspan_2port_device = {
591 .close = keyspan_close, 584 .close = keyspan_close,
592 .write = keyspan_write, 585 .write = keyspan_write,
593 .write_room = keyspan_write_room, 586 .write_room = keyspan_write_room,
594 .chars_in_buffer = keyspan_chars_in_buffer,
595 .throttle = keyspan_rx_throttle,
596 .unthrottle = keyspan_rx_unthrottle,
597 .ioctl = keyspan_ioctl,
598 .set_termios = keyspan_set_termios, 587 .set_termios = keyspan_set_termios,
599 .break_ctl = keyspan_break_ctl, 588 .break_ctl = keyspan_break_ctl,
600 .tiocmget = keyspan_tiocmget, 589 .tiocmget = keyspan_tiocmget,
@@ -615,10 +604,6 @@ static struct usb_serial_driver keyspan_4port_device = {
615 .close = keyspan_close, 604 .close = keyspan_close,
616 .write = keyspan_write, 605 .write = keyspan_write,
617 .write_room = keyspan_write_room, 606 .write_room = keyspan_write_room,
618 .chars_in_buffer = keyspan_chars_in_buffer,
619 .throttle = keyspan_rx_throttle,
620 .unthrottle = keyspan_rx_unthrottle,
621 .ioctl = keyspan_ioctl,
622 .set_termios = keyspan_set_termios, 607 .set_termios = keyspan_set_termios,
623 .break_ctl = keyspan_break_ctl, 608 .break_ctl = keyspan_break_ctl,
624 .tiocmget = keyspan_tiocmget, 609 .tiocmget = keyspan_tiocmget,