diff options
author | Jiri Slaby <jslaby@suse.cz> | 2013-03-07 07:12:29 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-03-18 19:19:45 -0400 |
commit | 6aad04f21374633bd8cecf25024553d1e11a9522 (patch) | |
tree | 9e3351e53b68d158b436a737049cbe2ee01ff126 /drivers | |
parent | 6982a398426a22166eaf049b79544536fdd6429f (diff) |
TTY: add tty_port_tty_wakeup helper
It allows for cleaning up on a considerable amount of places. They did
port_get, wakeup, kref_put. Now the only thing needed is to call
tty_port_tty_wakeup which does exactly that.
One exception is ifx6x60 where tty_wakeup was open-coded. We now call
tty_wakeup properly there.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/isdn/capi/capi.c | 7 | ||||
-rw-r--r-- | drivers/isdn/gigaset/interface.c | 6 | ||||
-rw-r--r-- | drivers/net/usb/hso.c | 13 | ||||
-rw-r--r-- | drivers/s390/char/sclp_tty.c | 9 | ||||
-rw-r--r-- | drivers/s390/char/sclp_vt220.c | 8 | ||||
-rw-r--r-- | drivers/staging/fwserial/fwserial.c | 10 | ||||
-rw-r--r-- | drivers/staging/serqt_usb2/serqt_usb2.c | 7 | ||||
-rw-r--r-- | drivers/tty/ehv_bytechan.c | 6 | ||||
-rw-r--r-- | drivers/tty/hvc/hvsi.c | 7 | ||||
-rw-r--r-- | drivers/tty/nozomi.c | 6 | ||||
-rw-r--r-- | drivers/tty/serial/ifx6x60.c | 33 | ||||
-rw-r--r-- | drivers/tty/tty_port.c | 16 | ||||
-rw-r--r-- | drivers/usb/class/cdc-acm.c | 7 | ||||
-rw-r--r-- | drivers/usb/serial/digi_acceleport.c | 17 | ||||
-rw-r--r-- | drivers/usb/serial/io_edgeport.c | 28 | ||||
-rw-r--r-- | drivers/usb/serial/keyspan_pda.c | 6 | ||||
-rw-r--r-- | drivers/usb/serial/mos7720.c | 8 | ||||
-rw-r--r-- | drivers/usb/serial/mos7840.c | 7 | ||||
-rw-r--r-- | drivers/usb/serial/ti_usb_3410_5052.c | 7 | ||||
-rw-r--r-- | drivers/usb/serial/usb-serial.c | 10 |
20 files changed, 49 insertions, 169 deletions
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index 89562a845f6a..ac6f72b455d1 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c | |||
@@ -569,7 +569,6 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb) | |||
569 | { | 569 | { |
570 | struct capidev *cdev = ap->private; | 570 | struct capidev *cdev = ap->private; |
571 | #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE | 571 | #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE |
572 | struct tty_struct *tty; | ||
573 | struct capiminor *mp; | 572 | struct capiminor *mp; |
574 | u16 datahandle; | 573 | u16 datahandle; |
575 | struct capincci *np; | 574 | struct capincci *np; |
@@ -627,11 +626,7 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb) | |||
627 | CAPIMSG_U16(skb->data, CAPIMSG_BASELEN + 4 + 2)); | 626 | CAPIMSG_U16(skb->data, CAPIMSG_BASELEN + 4 + 2)); |
628 | kfree_skb(skb); | 627 | kfree_skb(skb); |
629 | capiminor_del_ack(mp, datahandle); | 628 | capiminor_del_ack(mp, datahandle); |
630 | tty = tty_port_tty_get(&mp->port); | 629 | tty_port_tty_wakeup(&mp->port); |
631 | if (tty) { | ||
632 | tty_wakeup(tty); | ||
633 | tty_kref_put(tty); | ||
634 | } | ||
635 | handle_minor_send(mp); | 630 | handle_minor_send(mp); |
636 | 631 | ||
637 | } else { | 632 | } else { |
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c index e2b539675b66..600c79b030cd 100644 --- a/drivers/isdn/gigaset/interface.c +++ b/drivers/isdn/gigaset/interface.c | |||
@@ -487,12 +487,8 @@ static const struct tty_operations if_ops = { | |||
487 | static void if_wake(unsigned long data) | 487 | static void if_wake(unsigned long data) |
488 | { | 488 | { |
489 | struct cardstate *cs = (struct cardstate *)data; | 489 | struct cardstate *cs = (struct cardstate *)data; |
490 | struct tty_struct *tty = tty_port_tty_get(&cs->port); | ||
491 | 490 | ||
492 | if (tty) { | 491 | tty_port_tty_wakeup(&cs->port); |
493 | tty_wakeup(tty); | ||
494 | tty_kref_put(tty); | ||
495 | } | ||
496 | } | 492 | } |
497 | 493 | ||
498 | /*** interface to common ***/ | 494 | /*** interface to common ***/ |
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index e2dd3249b6bd..a7714b4f29ad 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
@@ -1925,7 +1925,6 @@ static void hso_std_serial_write_bulk_callback(struct urb *urb) | |||
1925 | { | 1925 | { |
1926 | struct hso_serial *serial = urb->context; | 1926 | struct hso_serial *serial = urb->context; |
1927 | int status = urb->status; | 1927 | int status = urb->status; |
1928 | struct tty_struct *tty; | ||
1929 | 1928 | ||
1930 | /* sanity check */ | 1929 | /* sanity check */ |
1931 | if (!serial) { | 1930 | if (!serial) { |
@@ -1941,11 +1940,7 @@ static void hso_std_serial_write_bulk_callback(struct urb *urb) | |||
1941 | return; | 1940 | return; |
1942 | } | 1941 | } |
1943 | hso_put_activity(serial->parent); | 1942 | hso_put_activity(serial->parent); |
1944 | tty = tty_port_tty_get(&serial->port); | 1943 | tty_port_tty_wakeup(&serial->port); |
1945 | if (tty) { | ||
1946 | tty_wakeup(tty); | ||
1947 | tty_kref_put(tty); | ||
1948 | } | ||
1949 | hso_kick_transmit(serial); | 1944 | hso_kick_transmit(serial); |
1950 | 1945 | ||
1951 | D1(" "); | 1946 | D1(" "); |
@@ -2008,12 +2003,8 @@ static void ctrl_callback(struct urb *urb) | |||
2008 | put_rxbuf_data_and_resubmit_ctrl_urb(serial); | 2003 | put_rxbuf_data_and_resubmit_ctrl_urb(serial); |
2009 | spin_unlock(&serial->serial_lock); | 2004 | spin_unlock(&serial->serial_lock); |
2010 | } else { | 2005 | } else { |
2011 | struct tty_struct *tty = tty_port_tty_get(&serial->port); | ||
2012 | hso_put_activity(serial->parent); | 2006 | hso_put_activity(serial->parent); |
2013 | if (tty) { | 2007 | tty_port_tty_wakeup(&serial->port); |
2014 | tty_wakeup(tty); | ||
2015 | tty_kref_put(tty); | ||
2016 | } | ||
2017 | /* response to a write command */ | 2008 | /* response to a write command */ |
2018 | hso_kick_transmit(serial); | 2009 | hso_kick_transmit(serial); |
2019 | } | 2010 | } |
diff --git a/drivers/s390/char/sclp_tty.c b/drivers/s390/char/sclp_tty.c index 14b4cb8abcc8..7ed7a5987816 100644 --- a/drivers/s390/char/sclp_tty.c +++ b/drivers/s390/char/sclp_tty.c | |||
@@ -107,7 +107,6 @@ sclp_tty_write_room (struct tty_struct *tty) | |||
107 | static void | 107 | static void |
108 | sclp_ttybuf_callback(struct sclp_buffer *buffer, int rc) | 108 | sclp_ttybuf_callback(struct sclp_buffer *buffer, int rc) |
109 | { | 109 | { |
110 | struct tty_struct *tty; | ||
111 | unsigned long flags; | 110 | unsigned long flags; |
112 | void *page; | 111 | void *page; |
113 | 112 | ||
@@ -125,12 +124,8 @@ sclp_ttybuf_callback(struct sclp_buffer *buffer, int rc) | |||
125 | struct sclp_buffer, list); | 124 | struct sclp_buffer, list); |
126 | spin_unlock_irqrestore(&sclp_tty_lock, flags); | 125 | spin_unlock_irqrestore(&sclp_tty_lock, flags); |
127 | } while (buffer && sclp_emit_buffer(buffer, sclp_ttybuf_callback)); | 126 | } while (buffer && sclp_emit_buffer(buffer, sclp_ttybuf_callback)); |
128 | /* check if the tty needs a wake up call */ | 127 | |
129 | tty = tty_port_tty_get(&sclp_port); | 128 | tty_port_tty_wakeup(&sclp_port); |
130 | if (tty != NULL) { | ||
131 | tty_wakeup(tty); | ||
132 | tty_kref_put(tty); | ||
133 | } | ||
134 | } | 129 | } |
135 | 130 | ||
136 | static inline void | 131 | static inline void |
diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c index 6c92f62623be..5aaaa2ec8df4 100644 --- a/drivers/s390/char/sclp_vt220.c +++ b/drivers/s390/char/sclp_vt220.c | |||
@@ -114,7 +114,6 @@ static struct sclp_register sclp_vt220_register = { | |||
114 | static void | 114 | static void |
115 | sclp_vt220_process_queue(struct sclp_vt220_request *request) | 115 | sclp_vt220_process_queue(struct sclp_vt220_request *request) |
116 | { | 116 | { |
117 | struct tty_struct *tty; | ||
118 | unsigned long flags; | 117 | unsigned long flags; |
119 | void *page; | 118 | void *page; |
120 | 119 | ||
@@ -139,12 +138,7 @@ sclp_vt220_process_queue(struct sclp_vt220_request *request) | |||
139 | } while (__sclp_vt220_emit(request)); | 138 | } while (__sclp_vt220_emit(request)); |
140 | if (request == NULL && sclp_vt220_flush_later) | 139 | if (request == NULL && sclp_vt220_flush_later) |
141 | sclp_vt220_emit_current(); | 140 | sclp_vt220_emit_current(); |
142 | /* Check if the tty needs a wake up call */ | 141 | tty_port_tty_wakeup(&sclp_vt220_port); |
143 | tty = tty_port_tty_get(&sclp_vt220_port); | ||
144 | if (tty) { | ||
145 | tty_wakeup(tty); | ||
146 | tty_kref_put(tty); | ||
147 | } | ||
148 | } | 142 | } |
149 | 143 | ||
150 | #define SCLP_BUFFER_MAX_RETRY 1 | 144 | #define SCLP_BUFFER_MAX_RETRY 1 |
diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c index 5a6fb44f38a8..5c64e3a35b28 100644 --- a/drivers/staging/fwserial/fwserial.c +++ b/drivers/staging/fwserial/fwserial.c | |||
@@ -744,7 +744,6 @@ static void fwtty_tx_complete(struct fw_card *card, int rcode, | |||
744 | struct fwtty_transaction *txn) | 744 | struct fwtty_transaction *txn) |
745 | { | 745 | { |
746 | struct fwtty_port *port = txn->port; | 746 | struct fwtty_port *port = txn->port; |
747 | struct tty_struct *tty; | ||
748 | int len; | 747 | int len; |
749 | 748 | ||
750 | fwtty_dbg(port, "rcode: %d", rcode); | 749 | fwtty_dbg(port, "rcode: %d", rcode); |
@@ -769,13 +768,8 @@ static void fwtty_tx_complete(struct fw_card *card, int rcode, | |||
769 | port->stats.dropped += txn->dma_pended.len; | 768 | port->stats.dropped += txn->dma_pended.len; |
770 | } | 769 | } |
771 | 770 | ||
772 | if (len < WAKEUP_CHARS) { | 771 | if (len < WAKEUP_CHARS) |
773 | tty = tty_port_tty_get(&port->port); | 772 | tty_port_tty_wakeup(&port->port); |
774 | if (tty) { | ||
775 | tty_wakeup(tty); | ||
776 | tty_kref_put(tty); | ||
777 | } | ||
778 | } | ||
779 | } | 773 | } |
780 | 774 | ||
781 | static int fwtty_tx(struct fwtty_port *port, bool drain) | 775 | static int fwtty_tx(struct fwtty_port *port, bool drain) |
diff --git a/drivers/staging/serqt_usb2/serqt_usb2.c b/drivers/staging/serqt_usb2/serqt_usb2.c index b1bb1a6abe81..8a6e5ea476e1 100644 --- a/drivers/staging/serqt_usb2/serqt_usb2.c +++ b/drivers/staging/serqt_usb2/serqt_usb2.c | |||
@@ -264,7 +264,6 @@ static void ProcessRxChar(struct usb_serial_port *port, unsigned char data) | |||
264 | 264 | ||
265 | static void qt_write_bulk_callback(struct urb *urb) | 265 | static void qt_write_bulk_callback(struct urb *urb) |
266 | { | 266 | { |
267 | struct tty_struct *tty; | ||
268 | int status; | 267 | int status; |
269 | struct quatech_port *quatech_port; | 268 | struct quatech_port *quatech_port; |
270 | 269 | ||
@@ -278,11 +277,7 @@ static void qt_write_bulk_callback(struct urb *urb) | |||
278 | 277 | ||
279 | quatech_port = urb->context; | 278 | quatech_port = urb->context; |
280 | 279 | ||
281 | tty = tty_port_tty_get(&quatech_port->port->port); | 280 | tty_port_tty_wakeup(&quatech_port->port->port); |
282 | |||
283 | if (tty) | ||
284 | tty_wakeup(tty); | ||
285 | tty_kref_put(tty); | ||
286 | } | 281 | } |
287 | 282 | ||
288 | static void qt_interrupt_callback(struct urb *urb) | 283 | static void qt_interrupt_callback(struct urb *urb) |
diff --git a/drivers/tty/ehv_bytechan.c b/drivers/tty/ehv_bytechan.c index ed92622b8949..6d0c27cd03da 100644 --- a/drivers/tty/ehv_bytechan.c +++ b/drivers/tty/ehv_bytechan.c | |||
@@ -472,13 +472,9 @@ static void ehv_bc_tx_dequeue(struct ehv_bc_data *bc) | |||
472 | static irqreturn_t ehv_bc_tty_tx_isr(int irq, void *data) | 472 | static irqreturn_t ehv_bc_tty_tx_isr(int irq, void *data) |
473 | { | 473 | { |
474 | struct ehv_bc_data *bc = data; | 474 | struct ehv_bc_data *bc = data; |
475 | struct tty_struct *ttys = tty_port_tty_get(&bc->port); | ||
476 | 475 | ||
477 | ehv_bc_tx_dequeue(bc); | 476 | ehv_bc_tx_dequeue(bc); |
478 | if (ttys) { | 477 | tty_port_tty_wakeup(&bc->port); |
479 | tty_wakeup(ttys); | ||
480 | tty_kref_put(ttys); | ||
481 | } | ||
482 | 478 | ||
483 | return IRQ_HANDLED; | 479 | return IRQ_HANDLED; |
484 | } | 480 | } |
diff --git a/drivers/tty/hvc/hvsi.c b/drivers/tty/hvc/hvsi.c index ef95a154854a..41901997c0d6 100644 --- a/drivers/tty/hvc/hvsi.c +++ b/drivers/tty/hvc/hvsi.c | |||
@@ -861,7 +861,6 @@ static void hvsi_write_worker(struct work_struct *work) | |||
861 | { | 861 | { |
862 | struct hvsi_struct *hp = | 862 | struct hvsi_struct *hp = |
863 | container_of(work, struct hvsi_struct, writer.work); | 863 | container_of(work, struct hvsi_struct, writer.work); |
864 | struct tty_struct *tty; | ||
865 | unsigned long flags; | 864 | unsigned long flags; |
866 | #ifdef DEBUG | 865 | #ifdef DEBUG |
867 | static long start_j = 0; | 866 | static long start_j = 0; |
@@ -895,11 +894,7 @@ static void hvsi_write_worker(struct work_struct *work) | |||
895 | start_j = 0; | 894 | start_j = 0; |
896 | #endif /* DEBUG */ | 895 | #endif /* DEBUG */ |
897 | wake_up_all(&hp->emptyq); | 896 | wake_up_all(&hp->emptyq); |
898 | tty = tty_port_tty_get(&hp->port); | 897 | tty_port_tty_wakeup(&hp->port); |
899 | if (tty) { | ||
900 | tty_wakeup(tty); | ||
901 | tty_kref_put(tty); | ||
902 | } | ||
903 | } | 898 | } |
904 | 899 | ||
905 | out: | 900 | out: |
diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c index 2dff19796157..2e5bbdc09e1c 100644 --- a/drivers/tty/nozomi.c +++ b/drivers/tty/nozomi.c | |||
@@ -791,7 +791,6 @@ static int send_data(enum port_type index, struct nozomi *dc) | |||
791 | const u8 toggle = port->toggle_ul; | 791 | const u8 toggle = port->toggle_ul; |
792 | void __iomem *addr = port->ul_addr[toggle]; | 792 | void __iomem *addr = port->ul_addr[toggle]; |
793 | const u32 ul_size = port->ul_size[toggle]; | 793 | const u32 ul_size = port->ul_size[toggle]; |
794 | struct tty_struct *tty = tty_port_tty_get(&port->port); | ||
795 | 794 | ||
796 | /* Get data from tty and place in buf for now */ | 795 | /* Get data from tty and place in buf for now */ |
797 | size = kfifo_out(&port->fifo_ul, dc->send_buf, | 796 | size = kfifo_out(&port->fifo_ul, dc->send_buf, |
@@ -799,7 +798,6 @@ static int send_data(enum port_type index, struct nozomi *dc) | |||
799 | 798 | ||
800 | if (size == 0) { | 799 | if (size == 0) { |
801 | DBG4("No more data to send, disable link:"); | 800 | DBG4("No more data to send, disable link:"); |
802 | tty_kref_put(tty); | ||
803 | return 0; | 801 | return 0; |
804 | } | 802 | } |
805 | 803 | ||
@@ -809,10 +807,8 @@ static int send_data(enum port_type index, struct nozomi *dc) | |||
809 | write_mem32(addr, (u32 *) &size, 4); | 807 | write_mem32(addr, (u32 *) &size, 4); |
810 | write_mem32(addr + 4, (u32 *) dc->send_buf, size); | 808 | write_mem32(addr + 4, (u32 *) dc->send_buf, size); |
811 | 809 | ||
812 | if (tty) | 810 | tty_port_tty_wakeup(&port->port); |
813 | tty_wakeup(tty); | ||
814 | 811 | ||
815 | tty_kref_put(tty); | ||
816 | return 1; | 812 | return 1; |
817 | } | 813 | } |
818 | 814 | ||
diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c index 68d7ce997ede..d723d4193b90 100644 --- a/drivers/tty/serial/ifx6x60.c +++ b/drivers/tty/serial/ifx6x60.c | |||
@@ -443,25 +443,6 @@ static void ifx_spi_setup_spi_header(unsigned char *txbuffer, int tx_count, | |||
443 | } | 443 | } |
444 | 444 | ||
445 | /** | 445 | /** |
446 | * ifx_spi_wakeup_serial - SPI space made | ||
447 | * @port_data: our SPI device | ||
448 | * | ||
449 | * We have emptied the FIFO enough that we want to get more data | ||
450 | * queued into it. Poke the line discipline via tty_wakeup so that | ||
451 | * it will feed us more bits | ||
452 | */ | ||
453 | static void ifx_spi_wakeup_serial(struct ifx_spi_device *ifx_dev) | ||
454 | { | ||
455 | struct tty_struct *tty; | ||
456 | |||
457 | tty = tty_port_tty_get(&ifx_dev->tty_port); | ||
458 | if (!tty) | ||
459 | return; | ||
460 | tty_wakeup(tty); | ||
461 | tty_kref_put(tty); | ||
462 | } | ||
463 | |||
464 | /** | ||
465 | * ifx_spi_prepare_tx_buffer - prepare transmit frame | 446 | * ifx_spi_prepare_tx_buffer - prepare transmit frame |
466 | * @ifx_dev: our SPI device | 447 | * @ifx_dev: our SPI device |
467 | * | 448 | * |
@@ -506,7 +487,7 @@ static int ifx_spi_prepare_tx_buffer(struct ifx_spi_device *ifx_dev) | |||
506 | tx_count += temp_count; | 487 | tx_count += temp_count; |
507 | if (temp_count == queue_length) | 488 | if (temp_count == queue_length) |
508 | /* poke port to get more data */ | 489 | /* poke port to get more data */ |
509 | ifx_spi_wakeup_serial(ifx_dev); | 490 | tty_port_tty_wakeup(&ifx_dev->tty_port); |
510 | else /* more data in port, use next SPI message */ | 491 | else /* more data in port, use next SPI message */ |
511 | ifx_dev->spi_more = 1; | 492 | ifx_dev->spi_more = 1; |
512 | } | 493 | } |
@@ -683,8 +664,6 @@ static void ifx_spi_insert_flip_string(struct ifx_spi_device *ifx_dev, | |||
683 | static void ifx_spi_complete(void *ctx) | 664 | static void ifx_spi_complete(void *ctx) |
684 | { | 665 | { |
685 | struct ifx_spi_device *ifx_dev = ctx; | 666 | struct ifx_spi_device *ifx_dev = ctx; |
686 | struct tty_struct *tty; | ||
687 | struct tty_ldisc *ldisc = NULL; | ||
688 | int length; | 667 | int length; |
689 | int actual_length; | 668 | int actual_length; |
690 | unsigned char more; | 669 | unsigned char more; |
@@ -762,15 +741,7 @@ complete_exit: | |||
762 | */ | 741 | */ |
763 | ifx_spi_power_state_clear(ifx_dev, | 742 | ifx_spi_power_state_clear(ifx_dev, |
764 | IFX_SPI_POWER_DATA_PENDING); | 743 | IFX_SPI_POWER_DATA_PENDING); |
765 | tty = tty_port_tty_get(&ifx_dev->tty_port); | 744 | tty_port_tty_wakeup(&ifx_dev->tty_port); |
766 | if (tty) { | ||
767 | ldisc = tty_ldisc_ref(tty); | ||
768 | if (ldisc) { | ||
769 | ldisc->ops->write_wakeup(tty); | ||
770 | tty_ldisc_deref(ldisc); | ||
771 | } | ||
772 | tty_kref_put(tty); | ||
773 | } | ||
774 | } | 745 | } |
775 | } | 746 | } |
776 | } | 747 | } |
diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c index b7ff59d3db88..8bb757c62ee2 100644 --- a/drivers/tty/tty_port.c +++ b/drivers/tty/tty_port.c | |||
@@ -233,6 +233,22 @@ void tty_port_hangup(struct tty_port *port) | |||
233 | EXPORT_SYMBOL(tty_port_hangup); | 233 | EXPORT_SYMBOL(tty_port_hangup); |
234 | 234 | ||
235 | /** | 235 | /** |
236 | * tty_port_tty_wakeup - helper to wake up a tty | ||
237 | * | ||
238 | * @port: tty port | ||
239 | */ | ||
240 | void tty_port_tty_wakeup(struct tty_port *port) | ||
241 | { | ||
242 | struct tty_struct *tty = tty_port_tty_get(port); | ||
243 | |||
244 | if (tty) { | ||
245 | tty_wakeup(tty); | ||
246 | tty_kref_put(tty); | ||
247 | } | ||
248 | } | ||
249 | EXPORT_SYMBOL_GPL(tty_port_tty_wakeup); | ||
250 | |||
251 | /** | ||
236 | * tty_port_carrier_raised - carrier raised check | 252 | * tty_port_carrier_raised - carrier raised check |
237 | * @port: tty port | 253 | * @port: tty port |
238 | * | 254 | * |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 8ac25adf31b4..755766e4b756 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -475,15 +475,10 @@ static void acm_write_bulk(struct urb *urb) | |||
475 | static void acm_softint(struct work_struct *work) | 475 | static void acm_softint(struct work_struct *work) |
476 | { | 476 | { |
477 | struct acm *acm = container_of(work, struct acm, work); | 477 | struct acm *acm = container_of(work, struct acm, work); |
478 | struct tty_struct *tty; | ||
479 | 478 | ||
480 | dev_vdbg(&acm->data->dev, "%s\n", __func__); | 479 | dev_vdbg(&acm->data->dev, "%s\n", __func__); |
481 | 480 | ||
482 | tty = tty_port_tty_get(&acm->port); | 481 | tty_port_tty_wakeup(&acm->port); |
483 | if (!tty) | ||
484 | return; | ||
485 | tty_wakeup(tty); | ||
486 | tty_kref_put(tty); | ||
487 | } | 482 | } |
488 | 483 | ||
489 | /* | 484 | /* |
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index ebe45fa0ed50..31191581060c 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c | |||
@@ -210,7 +210,6 @@ struct digi_port { | |||
210 | 210 | ||
211 | /* Local Function Declarations */ | 211 | /* Local Function Declarations */ |
212 | 212 | ||
213 | static void digi_wakeup_write(struct usb_serial_port *port); | ||
214 | static void digi_wakeup_write_lock(struct work_struct *work); | 213 | static void digi_wakeup_write_lock(struct work_struct *work); |
215 | static int digi_write_oob_command(struct usb_serial_port *port, | 214 | static int digi_write_oob_command(struct usb_serial_port *port, |
216 | unsigned char *buf, int count, int interruptible); | 215 | unsigned char *buf, int count, int interruptible); |
@@ -374,20 +373,10 @@ static void digi_wakeup_write_lock(struct work_struct *work) | |||
374 | unsigned long flags; | 373 | unsigned long flags; |
375 | 374 | ||
376 | spin_lock_irqsave(&priv->dp_port_lock, flags); | 375 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
377 | digi_wakeup_write(port); | 376 | tty_port_tty_wakeup(&port->port); |
378 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); | 377 | spin_unlock_irqrestore(&priv->dp_port_lock, flags); |
379 | } | 378 | } |
380 | 379 | ||
381 | static void digi_wakeup_write(struct usb_serial_port *port) | ||
382 | { | ||
383 | struct tty_struct *tty = tty_port_tty_get(&port->port); | ||
384 | if (tty) { | ||
385 | tty_wakeup(tty); | ||
386 | tty_kref_put(tty); | ||
387 | } | ||
388 | } | ||
389 | |||
390 | |||
391 | /* | 380 | /* |
392 | * Digi Write OOB Command | 381 | * Digi Write OOB Command |
393 | * | 382 | * |
@@ -1044,7 +1033,7 @@ static void digi_write_bulk_callback(struct urb *urb) | |||
1044 | } | 1033 | } |
1045 | } | 1034 | } |
1046 | /* wake up processes sleeping on writes immediately */ | 1035 | /* wake up processes sleeping on writes immediately */ |
1047 | digi_wakeup_write(port); | 1036 | tty_port_tty_wakeup(&port->port); |
1048 | /* also queue up a wakeup at scheduler time, in case we */ | 1037 | /* also queue up a wakeup at scheduler time, in case we */ |
1049 | /* lost the race in write_chan(). */ | 1038 | /* lost the race in write_chan(). */ |
1050 | schedule_work(&priv->dp_wakeup_work); | 1039 | schedule_work(&priv->dp_wakeup_work); |
@@ -1522,7 +1511,7 @@ static int digi_read_oob_callback(struct urb *urb) | |||
1522 | /* port must be open to use tty struct */ | 1511 | /* port must be open to use tty struct */ |
1523 | if (rts) { | 1512 | if (rts) { |
1524 | tty->hw_stopped = 0; | 1513 | tty->hw_stopped = 0; |
1525 | digi_wakeup_write(port); | 1514 | tty_port_tty_wakeup(&port->port); |
1526 | } | 1515 | } |
1527 | } else { | 1516 | } else { |
1528 | priv->dp_modem_signals &= ~TIOCM_CTS; | 1517 | priv->dp_modem_signals &= ~TIOCM_CTS; |
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index b00e5cbf741f..44e5208f7c61 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -565,7 +565,6 @@ static void edge_interrupt_callback(struct urb *urb) | |||
565 | struct device *dev; | 565 | struct device *dev; |
566 | struct edgeport_port *edge_port; | 566 | struct edgeport_port *edge_port; |
567 | struct usb_serial_port *port; | 567 | struct usb_serial_port *port; |
568 | struct tty_struct *tty; | ||
569 | unsigned char *data = urb->transfer_buffer; | 568 | unsigned char *data = urb->transfer_buffer; |
570 | int length = urb->actual_length; | 569 | int length = urb->actual_length; |
571 | int bytes_avail; | 570 | int bytes_avail; |
@@ -644,12 +643,7 @@ static void edge_interrupt_callback(struct urb *urb) | |||
644 | 643 | ||
645 | /* tell the tty driver that something | 644 | /* tell the tty driver that something |
646 | has changed */ | 645 | has changed */ |
647 | tty = tty_port_tty_get( | 646 | tty_port_tty_wakeup(&edge_port->port->port); |
648 | &edge_port->port->port); | ||
649 | if (tty) { | ||
650 | tty_wakeup(tty); | ||
651 | tty_kref_put(tty); | ||
652 | } | ||
653 | /* Since we have more credit, check | 647 | /* Since we have more credit, check |
654 | if more data can be sent */ | 648 | if more data can be sent */ |
655 | send_more_port_data(edge_serial, | 649 | send_more_port_data(edge_serial, |
@@ -738,7 +732,6 @@ static void edge_bulk_in_callback(struct urb *urb) | |||
738 | static void edge_bulk_out_data_callback(struct urb *urb) | 732 | static void edge_bulk_out_data_callback(struct urb *urb) |
739 | { | 733 | { |
740 | struct edgeport_port *edge_port = urb->context; | 734 | struct edgeport_port *edge_port = urb->context; |
741 | struct tty_struct *tty; | ||
742 | int status = urb->status; | 735 | int status = urb->status; |
743 | 736 | ||
744 | if (status) { | 737 | if (status) { |
@@ -747,14 +740,8 @@ static void edge_bulk_out_data_callback(struct urb *urb) | |||
747 | __func__, status); | 740 | __func__, status); |
748 | } | 741 | } |
749 | 742 | ||
750 | tty = tty_port_tty_get(&edge_port->port->port); | 743 | if (edge_port->open) |
751 | 744 | tty_port_tty_wakeup(&edge_port->port->port); | |
752 | if (tty && edge_port->open) { | ||
753 | /* let the tty driver wakeup if it has a special | ||
754 | write_wakeup function */ | ||
755 | tty_wakeup(tty); | ||
756 | } | ||
757 | tty_kref_put(tty); | ||
758 | 745 | ||
759 | /* Release the Write URB */ | 746 | /* Release the Write URB */ |
760 | edge_port->write_in_progress = false; | 747 | edge_port->write_in_progress = false; |
@@ -773,7 +760,6 @@ static void edge_bulk_out_data_callback(struct urb *urb) | |||
773 | static void edge_bulk_out_cmd_callback(struct urb *urb) | 760 | static void edge_bulk_out_cmd_callback(struct urb *urb) |
774 | { | 761 | { |
775 | struct edgeport_port *edge_port = urb->context; | 762 | struct edgeport_port *edge_port = urb->context; |
776 | struct tty_struct *tty; | ||
777 | int status = urb->status; | 763 | int status = urb->status; |
778 | 764 | ||
779 | atomic_dec(&CmdUrbs); | 765 | atomic_dec(&CmdUrbs); |
@@ -794,13 +780,9 @@ static void edge_bulk_out_cmd_callback(struct urb *urb) | |||
794 | return; | 780 | return; |
795 | } | 781 | } |
796 | 782 | ||
797 | /* Get pointer to tty */ | ||
798 | tty = tty_port_tty_get(&edge_port->port->port); | ||
799 | |||
800 | /* tell the tty driver that something has changed */ | 783 | /* tell the tty driver that something has changed */ |
801 | if (tty && edge_port->open) | 784 | if (edge_port->open) |
802 | tty_wakeup(tty); | 785 | tty_port_tty_wakeup(&edge_port->port->port); |
803 | tty_kref_put(tty); | ||
804 | 786 | ||
805 | /* we have completed the command */ | 787 | /* we have completed the command */ |
806 | edge_port->commandPending = false; | 788 | edge_port->commandPending = false; |
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index 3b17d5d13dc8..2230223978ca 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c | |||
@@ -104,10 +104,8 @@ static void keyspan_pda_wakeup_write(struct work_struct *work) | |||
104 | struct keyspan_pda_private *priv = | 104 | struct keyspan_pda_private *priv = |
105 | container_of(work, struct keyspan_pda_private, wakeup_work); | 105 | container_of(work, struct keyspan_pda_private, wakeup_work); |
106 | struct usb_serial_port *port = priv->port; | 106 | struct usb_serial_port *port = priv->port; |
107 | struct tty_struct *tty = tty_port_tty_get(&port->port); | 107 | |
108 | if (tty) | 108 | tty_port_tty_wakeup(&port->port); |
109 | tty_wakeup(tty); | ||
110 | tty_kref_put(tty); | ||
111 | } | 109 | } |
112 | 110 | ||
113 | static void keyspan_pda_request_unthrottle(struct work_struct *work) | 111 | static void keyspan_pda_request_unthrottle(struct work_struct *work) |
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index e0ebec3b5d6a..e956eae198fd 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c | |||
@@ -932,7 +932,6 @@ static void mos7720_bulk_in_callback(struct urb *urb) | |||
932 | static void mos7720_bulk_out_data_callback(struct urb *urb) | 932 | static void mos7720_bulk_out_data_callback(struct urb *urb) |
933 | { | 933 | { |
934 | struct moschip_port *mos7720_port; | 934 | struct moschip_port *mos7720_port; |
935 | struct tty_struct *tty; | ||
936 | int status = urb->status; | 935 | int status = urb->status; |
937 | 936 | ||
938 | if (status) { | 937 | if (status) { |
@@ -946,11 +945,8 @@ static void mos7720_bulk_out_data_callback(struct urb *urb) | |||
946 | return ; | 945 | return ; |
947 | } | 946 | } |
948 | 947 | ||
949 | tty = tty_port_tty_get(&mos7720_port->port->port); | 948 | if (mos7720_port->open) |
950 | 949 | tty_port_tty_wakeup(&mos7720_port->port->port); | |
951 | if (tty && mos7720_port->open) | ||
952 | tty_wakeup(tty); | ||
953 | tty_kref_put(tty); | ||
954 | } | 950 | } |
955 | 951 | ||
956 | /* | 952 | /* |
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 809fb329eca5..08284d28e84b 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -814,7 +814,6 @@ static void mos7840_bulk_out_data_callback(struct urb *urb) | |||
814 | { | 814 | { |
815 | struct moschip_port *mos7840_port; | 815 | struct moschip_port *mos7840_port; |
816 | struct usb_serial_port *port; | 816 | struct usb_serial_port *port; |
817 | struct tty_struct *tty; | ||
818 | int status = urb->status; | 817 | int status = urb->status; |
819 | int i; | 818 | int i; |
820 | 819 | ||
@@ -837,10 +836,8 @@ static void mos7840_bulk_out_data_callback(struct urb *urb) | |||
837 | if (mos7840_port_paranoia_check(port, __func__)) | 836 | if (mos7840_port_paranoia_check(port, __func__)) |
838 | return; | 837 | return; |
839 | 838 | ||
840 | tty = tty_port_tty_get(&port->port); | 839 | if (mos7840_port->open) |
841 | if (tty && mos7840_port->open) | 840 | tty_port_tty_wakeup(&port->port); |
842 | tty_wakeup(tty); | ||
843 | tty_kref_put(tty); | ||
844 | 841 | ||
845 | } | 842 | } |
846 | 843 | ||
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 39cb9b807c3c..437f2d579cde 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -1227,7 +1227,6 @@ static void ti_send(struct ti_port *tport) | |||
1227 | { | 1227 | { |
1228 | int count, result; | 1228 | int count, result; |
1229 | struct usb_serial_port *port = tport->tp_port; | 1229 | struct usb_serial_port *port = tport->tp_port; |
1230 | struct tty_struct *tty = tty_port_tty_get(&port->port); /* FIXME */ | ||
1231 | unsigned long flags; | 1230 | unsigned long flags; |
1232 | 1231 | ||
1233 | spin_lock_irqsave(&tport->tp_lock, flags); | 1232 | spin_lock_irqsave(&tport->tp_lock, flags); |
@@ -1268,14 +1267,12 @@ static void ti_send(struct ti_port *tport) | |||
1268 | } | 1267 | } |
1269 | 1268 | ||
1270 | /* more room in the buffer for new writes, wakeup */ | 1269 | /* more room in the buffer for new writes, wakeup */ |
1271 | if (tty) | 1270 | tty_port_tty_wakeup(&port->port); |
1272 | tty_wakeup(tty); | 1271 | |
1273 | tty_kref_put(tty); | ||
1274 | wake_up_interruptible(&tport->tp_write_wait); | 1272 | wake_up_interruptible(&tport->tp_write_wait); |
1275 | return; | 1273 | return; |
1276 | unlock: | 1274 | unlock: |
1277 | spin_unlock_irqrestore(&tport->tp_lock, flags); | 1275 | spin_unlock_irqrestore(&tport->tp_lock, flags); |
1278 | tty_kref_put(tty); | ||
1279 | return; | 1276 | return; |
1280 | } | 1277 | } |
1281 | 1278 | ||
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index a19ed74d770d..2df84845bafb 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -541,16 +541,8 @@ static void usb_serial_port_work(struct work_struct *work) | |||
541 | { | 541 | { |
542 | struct usb_serial_port *port = | 542 | struct usb_serial_port *port = |
543 | container_of(work, struct usb_serial_port, work); | 543 | container_of(work, struct usb_serial_port, work); |
544 | struct tty_struct *tty; | ||
545 | 544 | ||
546 | tty = tty_port_tty_get(&port->port); | 545 | tty_port_tty_wakeup(&port->port); |
547 | if (!tty) | ||
548 | return; | ||
549 | |||
550 | dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number); | ||
551 | |||
552 | tty_wakeup(tty); | ||
553 | tty_kref_put(tty); | ||
554 | } | 546 | } |
555 | 547 | ||
556 | static void kill_traffic(struct usb_serial_port *port) | 548 | static void kill_traffic(struct usb_serial_port *port) |