aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/u_serial.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2012-04-02 07:54:48 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-09 15:04:30 -0400
commit35f95fd7f234d2b58803bab6f6ebd6bb988050a2 (patch)
treeae84aaaf59915f81b1456ec2a80ee5478a387ecb /drivers/usb/gadget/u_serial.c
parent266e37efbc28b051c1ffb1cdcf0a949973e660e3 (diff)
TTY: usb/u_serial, use tty from tty_port
Signed-off-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/gadget/u_serial.c')
-rw-r--r--drivers/usb/gadget/u_serial.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c
index a6212ff5a2e5..d038a9032214 100644
--- a/drivers/usb/gadget/u_serial.c
+++ b/drivers/usb/gadget/u_serial.c
@@ -98,7 +98,6 @@ struct gs_port {
98 spinlock_t port_lock; /* guard port_* access */ 98 spinlock_t port_lock; /* guard port_* access */
99 99
100 struct gserial *port_usb; 100 struct gserial *port_usb;
101 struct tty_struct *port_tty;
102 101
103 bool openclose; /* open/close in progress */ 102 bool openclose; /* open/close in progress */
104 u8 port_num; 103 u8 port_num;
@@ -412,8 +411,8 @@ __acquires(&port->port_lock)
412 break; 411 break;
413 } 412 }
414 413
415 if (do_tty_wake && port->port_tty) 414 if (do_tty_wake && port->port.tty)
416 tty_wakeup(port->port_tty); 415 tty_wakeup(port->port.tty);
417 return status; 416 return status;
418} 417}
419 418
@@ -435,7 +434,7 @@ __acquires(&port->port_lock)
435 struct tty_struct *tty; 434 struct tty_struct *tty;
436 435
437 /* no more rx if closed */ 436 /* no more rx if closed */
438 tty = port->port_tty; 437 tty = port->port.tty;
439 if (!tty) 438 if (!tty)
440 break; 439 break;
441 440
@@ -488,7 +487,7 @@ static void gs_rx_push(unsigned long _port)
488 487
489 /* hand any queued data to the tty */ 488 /* hand any queued data to the tty */
490 spin_lock_irq(&port->port_lock); 489 spin_lock_irq(&port->port_lock);
491 tty = port->port_tty; 490 tty = port->port.tty;
492 while (!list_empty(queue)) { 491 while (!list_empty(queue)) {
493 struct usb_request *req; 492 struct usb_request *req;
494 493
@@ -699,7 +698,7 @@ static int gs_start_io(struct gs_port *port)
699 698
700 /* unblock any pending writes into our circular buffer */ 699 /* unblock any pending writes into our circular buffer */
701 if (started) { 700 if (started) {
702 tty_wakeup(port->port_tty); 701 tty_wakeup(port->port.tty);
703 } else { 702 } else {
704 gs_free_requests(ep, head, &port->read_allocated); 703 gs_free_requests(ep, head, &port->read_allocated);
705 gs_free_requests(port->port_usb->in, &port->write_pool, 704 gs_free_requests(port->port_usb->in, &port->write_pool,
@@ -793,7 +792,7 @@ static int gs_open(struct tty_struct *tty, struct file *file)
793 /* REVISIT maybe wait for "carrier detect" */ 792 /* REVISIT maybe wait for "carrier detect" */
794 793
795 tty->driver_data = port; 794 tty->driver_data = port;
796 port->port_tty = tty; 795 port->port.tty = tty;
797 796
798 port->port.count = 1; 797 port->port.count = 1;
799 port->openclose = false; 798 port->openclose = false;
@@ -879,7 +878,7 @@ static void gs_close(struct tty_struct *tty, struct file *file)
879 gs_buf_clear(&port->port_write_buf); 878 gs_buf_clear(&port->port_write_buf);
880 879
881 tty->driver_data = NULL; 880 tty->driver_data = NULL;
882 port->port_tty = NULL; 881 port->port.tty = NULL;
883 882
884 port->openclose = false; 883 port->openclose = false;
885 884
@@ -1318,8 +1317,8 @@ void gserial_disconnect(struct gserial *gser)
1318 gser->ioport = NULL; 1317 gser->ioport = NULL;
1319 if (port->port.count > 0 || port->openclose) { 1318 if (port->port.count > 0 || port->openclose) {
1320 wake_up_interruptible(&port->drain_wait); 1319 wake_up_interruptible(&port->drain_wait);
1321 if (port->port_tty) 1320 if (port->port.tty)
1322 tty_hangup(port->port_tty); 1321 tty_hangup(port->port.tty);
1323 } 1322 }
1324 spin_unlock_irqrestore(&port->port_lock, flags); 1323 spin_unlock_irqrestore(&port->port_lock, flags);
1325 1324