aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/whiteheat.c
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2009-06-11 07:26:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-11 11:50:56 -0400
commit335f8514f200e63d689113d29cb7253a5c282967 (patch)
tree11504d090e8e2cd3c1ada3e6765f69f216065d00 /drivers/usb/serial/whiteheat.c
parent1ec739be75a6cb961a46ba0b1982d0edb7f27558 (diff)
tty: Bring the usb tty port structure into more use
This allows us to clean stuff up, but is probably also going to cause some app breakage with buggy apps as we now implement proper POSIX behaviour for USB ports matching all the other ports. This does also mean other apps that break on USB will now work properly. Signed-off-by: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/usb/serial/whiteheat.c')
-rw-r--r--drivers/usb/serial/whiteheat.c33
1 files changed, 2 insertions, 31 deletions
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
index 5335d3211c07..7c7295d09f34 100644
--- a/drivers/usb/serial/whiteheat.c
+++ b/drivers/usb/serial/whiteheat.c
@@ -147,8 +147,7 @@ static int whiteheat_attach(struct usb_serial *serial);
147static void whiteheat_shutdown(struct usb_serial *serial); 147static void whiteheat_shutdown(struct usb_serial *serial);
148static int whiteheat_open(struct tty_struct *tty, 148static int whiteheat_open(struct tty_struct *tty,
149 struct usb_serial_port *port, struct file *filp); 149 struct usb_serial_port *port, struct file *filp);
150static void whiteheat_close(struct tty_struct *tty, 150static void whiteheat_close(struct usb_serial_port *port);
151 struct usb_serial_port *port, struct file *filp);
152static int whiteheat_write(struct tty_struct *tty, 151static int whiteheat_write(struct tty_struct *tty,
153 struct usb_serial_port *port, 152 struct usb_serial_port *port,
154 const unsigned char *buf, int count); 153 const unsigned char *buf, int count);
@@ -712,8 +711,7 @@ exit:
712} 711}
713 712
714 713
715static void whiteheat_close(struct tty_struct *tty, 714static void whiteheat_close(struct usb_serial_port *port)
716 struct usb_serial_port *port, struct file *filp)
717{ 715{
718 struct whiteheat_private *info = usb_get_serial_port_data(port); 716 struct whiteheat_private *info = usb_get_serial_port_data(port);
719 struct whiteheat_urb_wrap *wrap; 717 struct whiteheat_urb_wrap *wrap;
@@ -723,31 +721,7 @@ static void whiteheat_close(struct tty_struct *tty,
723 721
724 dbg("%s - port %d", __func__, port->number); 722 dbg("%s - port %d", __func__, port->number);
725 723
726 mutex_lock(&port->serial->disc_mutex);
727 /* filp is NULL when called from usb_serial_disconnect */
728 if ((filp && (tty_hung_up_p(filp))) || port->serial->disconnected) {
729 mutex_unlock(&port->serial->disc_mutex);
730 return;
731 }
732 mutex_unlock(&port->serial->disc_mutex);
733
734 tty->closing = 1;
735
736/*
737 * Not currently in use; tty_wait_until_sent() calls
738 * serial_chars_in_buffer() which deadlocks on the second semaphore
739 * acquisition. This should be fixed at some point. Greg's been
740 * notified.
741 if ((filp->f_flags & (O_NDELAY | O_NONBLOCK)) == 0) {
742 tty_wait_until_sent(tty, CLOSING_DELAY);
743 }
744*/
745
746 tty_driver_flush_buffer(tty);
747 tty_ldisc_flush(tty);
748
749 firm_report_tx_done(port); 724 firm_report_tx_done(port);
750
751 firm_close(port); 725 firm_close(port);
752 726
753 /* shutdown our bulk reads and writes */ 727 /* shutdown our bulk reads and writes */
@@ -775,10 +749,7 @@ static void whiteheat_close(struct tty_struct *tty,
775 } 749 }
776 spin_unlock_irq(&info->lock); 750 spin_unlock_irq(&info->lock);
777 mutex_unlock(&info->deathwarrant); 751 mutex_unlock(&info->deathwarrant);
778
779 stop_command_port(port->serial); 752 stop_command_port(port->serial);
780
781 tty->closing = 0;
782} 753}
783 754
784 755