Commit 6aad04f21374633bd8cecf25024553d1e11a9522
Committed by
Greg Kroah-Hartman
1 parent
6982a39842
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 22 changed files with 51 additions and 176 deletions Side-by-side Diff
- arch/um/drivers/line.c
- drivers/isdn/capi/capi.c
- drivers/isdn/gigaset/interface.c
- drivers/net/usb/hso.c
- drivers/s390/char/sclp_tty.c
- drivers/s390/char/sclp_vt220.c
- drivers/staging/fwserial/fwserial.c
- drivers/staging/serqt_usb2/serqt_usb2.c
- drivers/tty/ehv_bytechan.c
- drivers/tty/hvc/hvsi.c
- drivers/tty/nozomi.c
- drivers/tty/serial/ifx6x60.c
- drivers/tty/tty_port.c
- drivers/usb/class/cdc-acm.c
- drivers/usb/serial/digi_acceleport.c
- drivers/usb/serial/io_edgeport.c
- drivers/usb/serial/keyspan_pda.c
- drivers/usb/serial/mos7720.c
- drivers/usb/serial/mos7840.c
- drivers/usb/serial/ti_usb_3410_5052.c
- drivers/usb/serial/usb-serial.c
- include/linux/tty.h
arch/um/drivers/line.c
... | ... | @@ -248,7 +248,6 @@ |
248 | 248 | { |
249 | 249 | struct chan *chan = data; |
250 | 250 | struct line *line = chan->line; |
251 | - struct tty_struct *tty; | |
252 | 251 | int err; |
253 | 252 | |
254 | 253 | /* |
... | ... | @@ -267,12 +266,7 @@ |
267 | 266 | } |
268 | 267 | spin_unlock(&line->lock); |
269 | 268 | |
270 | - tty = tty_port_tty_get(&line->port); | |
271 | - if (tty == NULL) | |
272 | - return IRQ_NONE; | |
273 | - | |
274 | - tty_wakeup(tty); | |
275 | - tty_kref_put(tty); | |
269 | + tty_port_tty_wakeup(&line->port); | |
276 | 270 | |
277 | 271 | return IRQ_HANDLED; |
278 | 272 | } |
drivers/isdn/capi/capi.c
... | ... | @@ -569,7 +569,6 @@ |
569 | 569 | { |
570 | 570 | struct capidev *cdev = ap->private; |
571 | 571 | #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE |
572 | - struct tty_struct *tty; | |
573 | 572 | struct capiminor *mp; |
574 | 573 | u16 datahandle; |
575 | 574 | struct capincci *np; |
... | ... | @@ -627,11 +626,7 @@ |
627 | 626 | CAPIMSG_U16(skb->data, CAPIMSG_BASELEN + 4 + 2)); |
628 | 627 | kfree_skb(skb); |
629 | 628 | capiminor_del_ack(mp, datahandle); |
630 | - tty = tty_port_tty_get(&mp->port); | |
631 | - if (tty) { | |
632 | - tty_wakeup(tty); | |
633 | - tty_kref_put(tty); | |
634 | - } | |
629 | + tty_port_tty_wakeup(&mp->port); | |
635 | 630 | handle_minor_send(mp); |
636 | 631 | |
637 | 632 | } else { |
drivers/isdn/gigaset/interface.c
... | ... | @@ -487,12 +487,8 @@ |
487 | 487 | static void if_wake(unsigned long data) |
488 | 488 | { |
489 | 489 | struct cardstate *cs = (struct cardstate *)data; |
490 | - struct tty_struct *tty = tty_port_tty_get(&cs->port); | |
491 | 490 | |
492 | - if (tty) { | |
493 | - tty_wakeup(tty); | |
494 | - tty_kref_put(tty); | |
495 | - } | |
491 | + tty_port_tty_wakeup(&cs->port); | |
496 | 492 | } |
497 | 493 | |
498 | 494 | /*** interface to common ***/ |
drivers/net/usb/hso.c
... | ... | @@ -1925,7 +1925,6 @@ |
1925 | 1925 | { |
1926 | 1926 | struct hso_serial *serial = urb->context; |
1927 | 1927 | int status = urb->status; |
1928 | - struct tty_struct *tty; | |
1929 | 1928 | |
1930 | 1929 | /* sanity check */ |
1931 | 1930 | if (!serial) { |
... | ... | @@ -1941,11 +1940,7 @@ |
1941 | 1940 | return; |
1942 | 1941 | } |
1943 | 1942 | hso_put_activity(serial->parent); |
1944 | - tty = tty_port_tty_get(&serial->port); | |
1945 | - if (tty) { | |
1946 | - tty_wakeup(tty); | |
1947 | - tty_kref_put(tty); | |
1948 | - } | |
1943 | + tty_port_tty_wakeup(&serial->port); | |
1949 | 1944 | hso_kick_transmit(serial); |
1950 | 1945 | |
1951 | 1946 | D1(" "); |
1952 | 1947 | |
... | ... | @@ -2008,12 +2003,8 @@ |
2008 | 2003 | put_rxbuf_data_and_resubmit_ctrl_urb(serial); |
2009 | 2004 | spin_unlock(&serial->serial_lock); |
2010 | 2005 | } else { |
2011 | - struct tty_struct *tty = tty_port_tty_get(&serial->port); | |
2012 | 2006 | hso_put_activity(serial->parent); |
2013 | - if (tty) { | |
2014 | - tty_wakeup(tty); | |
2015 | - tty_kref_put(tty); | |
2016 | - } | |
2007 | + tty_port_tty_wakeup(&serial->port); | |
2017 | 2008 | /* response to a write command */ |
2018 | 2009 | hso_kick_transmit(serial); |
2019 | 2010 | } |
drivers/s390/char/sclp_tty.c
... | ... | @@ -107,7 +107,6 @@ |
107 | 107 | static void |
108 | 108 | sclp_ttybuf_callback(struct sclp_buffer *buffer, int rc) |
109 | 109 | { |
110 | - struct tty_struct *tty; | |
111 | 110 | unsigned long flags; |
112 | 111 | void *page; |
113 | 112 | |
... | ... | @@ -125,12 +124,8 @@ |
125 | 124 | struct sclp_buffer, list); |
126 | 125 | spin_unlock_irqrestore(&sclp_tty_lock, flags); |
127 | 126 | } while (buffer && sclp_emit_buffer(buffer, sclp_ttybuf_callback)); |
128 | - /* check if the tty needs a wake up call */ | |
129 | - tty = tty_port_tty_get(&sclp_port); | |
130 | - if (tty != NULL) { | |
131 | - tty_wakeup(tty); | |
132 | - tty_kref_put(tty); | |
133 | - } | |
127 | + | |
128 | + tty_port_tty_wakeup(&sclp_port); | |
134 | 129 | } |
135 | 130 | |
136 | 131 | static inline void |
drivers/s390/char/sclp_vt220.c
... | ... | @@ -114,7 +114,6 @@ |
114 | 114 | static void |
115 | 115 | sclp_vt220_process_queue(struct sclp_vt220_request *request) |
116 | 116 | { |
117 | - struct tty_struct *tty; | |
118 | 117 | unsigned long flags; |
119 | 118 | void *page; |
120 | 119 | |
... | ... | @@ -139,12 +138,7 @@ |
139 | 138 | } while (__sclp_vt220_emit(request)); |
140 | 139 | if (request == NULL && sclp_vt220_flush_later) |
141 | 140 | sclp_vt220_emit_current(); |
142 | - /* Check if the tty needs a wake up call */ | |
143 | - tty = tty_port_tty_get(&sclp_vt220_port); | |
144 | - if (tty) { | |
145 | - tty_wakeup(tty); | |
146 | - tty_kref_put(tty); | |
147 | - } | |
141 | + tty_port_tty_wakeup(&sclp_vt220_port); | |
148 | 142 | } |
149 | 143 | |
150 | 144 | #define SCLP_BUFFER_MAX_RETRY 1 |
drivers/staging/fwserial/fwserial.c
... | ... | @@ -744,7 +744,6 @@ |
744 | 744 | struct fwtty_transaction *txn) |
745 | 745 | { |
746 | 746 | struct fwtty_port *port = txn->port; |
747 | - struct tty_struct *tty; | |
748 | 747 | int len; |
749 | 748 | |
750 | 749 | fwtty_dbg(port, "rcode: %d", rcode); |
... | ... | @@ -769,13 +768,8 @@ |
769 | 768 | port->stats.dropped += txn->dma_pended.len; |
770 | 769 | } |
771 | 770 | |
772 | - if (len < WAKEUP_CHARS) { | |
773 | - tty = tty_port_tty_get(&port->port); | |
774 | - if (tty) { | |
775 | - tty_wakeup(tty); | |
776 | - tty_kref_put(tty); | |
777 | - } | |
778 | - } | |
771 | + if (len < WAKEUP_CHARS) | |
772 | + tty_port_tty_wakeup(&port->port); | |
779 | 773 | } |
780 | 774 | |
781 | 775 | static int fwtty_tx(struct fwtty_port *port, bool drain) |
drivers/staging/serqt_usb2/serqt_usb2.c
... | ... | @@ -264,7 +264,6 @@ |
264 | 264 | |
265 | 265 | static void qt_write_bulk_callback(struct urb *urb) |
266 | 266 | { |
267 | - struct tty_struct *tty; | |
268 | 267 | int status; |
269 | 268 | struct quatech_port *quatech_port; |
270 | 269 | |
... | ... | @@ -278,11 +277,7 @@ |
278 | 277 | |
279 | 278 | quatech_port = urb->context; |
280 | 279 | |
281 | - tty = tty_port_tty_get(&quatech_port->port->port); | |
282 | - | |
283 | - if (tty) | |
284 | - tty_wakeup(tty); | |
285 | - tty_kref_put(tty); | |
280 | + tty_port_tty_wakeup(&quatech_port->port->port); | |
286 | 281 | } |
287 | 282 | |
288 | 283 | static void qt_interrupt_callback(struct urb *urb) |
drivers/tty/ehv_bytechan.c
... | ... | @@ -472,13 +472,9 @@ |
472 | 472 | static irqreturn_t ehv_bc_tty_tx_isr(int irq, void *data) |
473 | 473 | { |
474 | 474 | struct ehv_bc_data *bc = data; |
475 | - struct tty_struct *ttys = tty_port_tty_get(&bc->port); | |
476 | 475 | |
477 | 476 | ehv_bc_tx_dequeue(bc); |
478 | - if (ttys) { | |
479 | - tty_wakeup(ttys); | |
480 | - tty_kref_put(ttys); | |
481 | - } | |
477 | + tty_port_tty_wakeup(&bc->port); | |
482 | 478 | |
483 | 479 | return IRQ_HANDLED; |
484 | 480 | } |
drivers/tty/hvc/hvsi.c
... | ... | @@ -861,7 +861,6 @@ |
861 | 861 | { |
862 | 862 | struct hvsi_struct *hp = |
863 | 863 | container_of(work, struct hvsi_struct, writer.work); |
864 | - struct tty_struct *tty; | |
865 | 864 | unsigned long flags; |
866 | 865 | #ifdef DEBUG |
867 | 866 | static long start_j = 0; |
... | ... | @@ -895,11 +894,7 @@ |
895 | 894 | start_j = 0; |
896 | 895 | #endif /* DEBUG */ |
897 | 896 | wake_up_all(&hp->emptyq); |
898 | - tty = tty_port_tty_get(&hp->port); | |
899 | - if (tty) { | |
900 | - tty_wakeup(tty); | |
901 | - tty_kref_put(tty); | |
902 | - } | |
897 | + tty_port_tty_wakeup(&hp->port); | |
903 | 898 | } |
904 | 899 | |
905 | 900 | out: |
drivers/tty/nozomi.c
... | ... | @@ -791,7 +791,6 @@ |
791 | 791 | const u8 toggle = port->toggle_ul; |
792 | 792 | void __iomem *addr = port->ul_addr[toggle]; |
793 | 793 | const u32 ul_size = port->ul_size[toggle]; |
794 | - struct tty_struct *tty = tty_port_tty_get(&port->port); | |
795 | 794 | |
796 | 795 | /* Get data from tty and place in buf for now */ |
797 | 796 | size = kfifo_out(&port->fifo_ul, dc->send_buf, |
... | ... | @@ -799,7 +798,6 @@ |
799 | 798 | |
800 | 799 | if (size == 0) { |
801 | 800 | DBG4("No more data to send, disable link:"); |
802 | - tty_kref_put(tty); | |
803 | 801 | return 0; |
804 | 802 | } |
805 | 803 | |
806 | 804 | |
... | ... | @@ -809,10 +807,8 @@ |
809 | 807 | write_mem32(addr, (u32 *) &size, 4); |
810 | 808 | write_mem32(addr + 4, (u32 *) dc->send_buf, size); |
811 | 809 | |
812 | - if (tty) | |
813 | - tty_wakeup(tty); | |
810 | + tty_port_tty_wakeup(&port->port); | |
814 | 811 | |
815 | - tty_kref_put(tty); | |
816 | 812 | return 1; |
817 | 813 | } |
818 | 814 |
drivers/tty/serial/ifx6x60.c
... | ... | @@ -443,25 +443,6 @@ |
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 | 446 | * ifx_spi_prepare_tx_buffer - prepare transmit frame |
466 | 447 | * @ifx_dev: our SPI device |
467 | 448 | * |
... | ... | @@ -506,7 +487,7 @@ |
506 | 487 | tx_count += temp_count; |
507 | 488 | if (temp_count == queue_length) |
508 | 489 | /* poke port to get more data */ |
509 | - ifx_spi_wakeup_serial(ifx_dev); | |
490 | + tty_port_tty_wakeup(&ifx_dev->tty_port); | |
510 | 491 | else /* more data in port, use next SPI message */ |
511 | 492 | ifx_dev->spi_more = 1; |
512 | 493 | } |
... | ... | @@ -683,8 +664,6 @@ |
683 | 664 | static void ifx_spi_complete(void *ctx) |
684 | 665 | { |
685 | 666 | struct ifx_spi_device *ifx_dev = ctx; |
686 | - struct tty_struct *tty; | |
687 | - struct tty_ldisc *ldisc = NULL; | |
688 | 667 | int length; |
689 | 668 | int actual_length; |
690 | 669 | unsigned char more; |
... | ... | @@ -762,15 +741,7 @@ |
762 | 741 | */ |
763 | 742 | ifx_spi_power_state_clear(ifx_dev, |
764 | 743 | IFX_SPI_POWER_DATA_PENDING); |
765 | - tty = tty_port_tty_get(&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 | - } | |
744 | + tty_port_tty_wakeup(&ifx_dev->tty_port); | |
774 | 745 | } |
775 | 746 | } |
776 | 747 | } |
drivers/tty/tty_port.c
... | ... | @@ -233,6 +233,22 @@ |
233 | 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 | 252 | * tty_port_carrier_raised - carrier raised check |
237 | 253 | * @port: tty port |
238 | 254 | * |
drivers/usb/class/cdc-acm.c
... | ... | @@ -475,15 +475,10 @@ |
475 | 475 | static void acm_softint(struct work_struct *work) |
476 | 476 | { |
477 | 477 | struct acm *acm = container_of(work, struct acm, work); |
478 | - struct tty_struct *tty; | |
479 | 478 | |
480 | 479 | dev_vdbg(&acm->data->dev, "%s\n", __func__); |
481 | 480 | |
482 | - tty = tty_port_tty_get(&acm->port); | |
483 | - if (!tty) | |
484 | - return; | |
485 | - tty_wakeup(tty); | |
486 | - tty_kref_put(tty); | |
481 | + tty_port_tty_wakeup(&acm->port); | |
487 | 482 | } |
488 | 483 | |
489 | 484 | /* |
drivers/usb/serial/digi_acceleport.c
... | ... | @@ -210,7 +210,6 @@ |
210 | 210 | |
211 | 211 | /* Local Function Declarations */ |
212 | 212 | |
213 | -static void digi_wakeup_write(struct usb_serial_port *port); | |
214 | 213 | static void digi_wakeup_write_lock(struct work_struct *work); |
215 | 214 | static int digi_write_oob_command(struct usb_serial_port *port, |
216 | 215 | unsigned char *buf, int count, int interruptible); |
217 | 216 | |
... | ... | @@ -374,20 +373,10 @@ |
374 | 373 | unsigned long flags; |
375 | 374 | |
376 | 375 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
377 | - digi_wakeup_write(port); | |
376 | + tty_port_tty_wakeup(&port->port); | |
378 | 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 | 381 | * Digi Write OOB Command |
393 | 382 | * |
... | ... | @@ -1044,7 +1033,7 @@ |
1044 | 1033 | } |
1045 | 1034 | } |
1046 | 1035 | /* wake up processes sleeping on writes immediately */ |
1047 | - digi_wakeup_write(port); | |
1036 | + tty_port_tty_wakeup(&port->port); | |
1048 | 1037 | /* also queue up a wakeup at scheduler time, in case we */ |
1049 | 1038 | /* lost the race in write_chan(). */ |
1050 | 1039 | schedule_work(&priv->dp_wakeup_work); |
... | ... | @@ -1522,7 +1511,7 @@ |
1522 | 1511 | /* port must be open to use tty struct */ |
1523 | 1512 | if (rts) { |
1524 | 1513 | tty->hw_stopped = 0; |
1525 | - digi_wakeup_write(port); | |
1514 | + tty_port_tty_wakeup(&port->port); | |
1526 | 1515 | } |
1527 | 1516 | } else { |
1528 | 1517 | priv->dp_modem_signals &= ~TIOCM_CTS; |
drivers/usb/serial/io_edgeport.c
... | ... | @@ -565,7 +565,6 @@ |
565 | 565 | struct device *dev; |
566 | 566 | struct edgeport_port *edge_port; |
567 | 567 | struct usb_serial_port *port; |
568 | - struct tty_struct *tty; | |
569 | 568 | unsigned char *data = urb->transfer_buffer; |
570 | 569 | int length = urb->actual_length; |
571 | 570 | int bytes_avail; |
... | ... | @@ -644,12 +643,7 @@ |
644 | 643 | |
645 | 644 | /* tell the tty driver that something |
646 | 645 | has changed */ |
647 | - tty = tty_port_tty_get( | |
648 | - &edge_port->port->port); | |
649 | - if (tty) { | |
650 | - tty_wakeup(tty); | |
651 | - tty_kref_put(tty); | |
652 | - } | |
646 | + tty_port_tty_wakeup(&edge_port->port->port); | |
653 | 647 | /* Since we have more credit, check |
654 | 648 | if more data can be sent */ |
655 | 649 | send_more_port_data(edge_serial, |
... | ... | @@ -738,7 +732,6 @@ |
738 | 732 | static void edge_bulk_out_data_callback(struct urb *urb) |
739 | 733 | { |
740 | 734 | struct edgeport_port *edge_port = urb->context; |
741 | - struct tty_struct *tty; | |
742 | 735 | int status = urb->status; |
743 | 736 | |
744 | 737 | if (status) { |
745 | 738 | |
... | ... | @@ -747,15 +740,9 @@ |
747 | 740 | __func__, status); |
748 | 741 | } |
749 | 742 | |
750 | - tty = tty_port_tty_get(&edge_port->port->port); | |
743 | + if (edge_port->open) | |
744 | + tty_port_tty_wakeup(&edge_port->port->port); | |
751 | 745 | |
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 | - | |
759 | 746 | /* Release the Write URB */ |
760 | 747 | edge_port->write_in_progress = false; |
761 | 748 | |
... | ... | @@ -773,7 +760,6 @@ |
773 | 760 | static void edge_bulk_out_cmd_callback(struct urb *urb) |
774 | 761 | { |
775 | 762 | struct edgeport_port *edge_port = urb->context; |
776 | - struct tty_struct *tty; | |
777 | 763 | int status = urb->status; |
778 | 764 | |
779 | 765 | atomic_dec(&CmdUrbs); |
780 | 766 | |
... | ... | @@ -794,13 +780,9 @@ |
794 | 780 | return; |
795 | 781 | } |
796 | 782 | |
797 | - /* Get pointer to tty */ | |
798 | - tty = tty_port_tty_get(&edge_port->port->port); | |
799 | - | |
800 | 783 | /* tell the tty driver that something has changed */ |
801 | - if (tty && edge_port->open) | |
802 | - tty_wakeup(tty); | |
803 | - tty_kref_put(tty); | |
784 | + if (edge_port->open) | |
785 | + tty_port_tty_wakeup(&edge_port->port->port); | |
804 | 786 | |
805 | 787 | /* we have completed the command */ |
806 | 788 | edge_port->commandPending = false; |
drivers/usb/serial/keyspan_pda.c
... | ... | @@ -104,10 +104,8 @@ |
104 | 104 | struct keyspan_pda_private *priv = |
105 | 105 | container_of(work, struct keyspan_pda_private, wakeup_work); |
106 | 106 | struct usb_serial_port *port = priv->port; |
107 | - struct tty_struct *tty = tty_port_tty_get(&port->port); | |
108 | - if (tty) | |
109 | - tty_wakeup(tty); | |
110 | - tty_kref_put(tty); | |
107 | + | |
108 | + tty_port_tty_wakeup(&port->port); | |
111 | 109 | } |
112 | 110 | |
113 | 111 | static void keyspan_pda_request_unthrottle(struct work_struct *work) |
drivers/usb/serial/mos7720.c
... | ... | @@ -932,7 +932,6 @@ |
932 | 932 | static void mos7720_bulk_out_data_callback(struct urb *urb) |
933 | 933 | { |
934 | 934 | struct moschip_port *mos7720_port; |
935 | - struct tty_struct *tty; | |
936 | 935 | int status = urb->status; |
937 | 936 | |
938 | 937 | if (status) { |
... | ... | @@ -946,11 +945,8 @@ |
946 | 945 | return ; |
947 | 946 | } |
948 | 947 | |
949 | - tty = tty_port_tty_get(&mos7720_port->port->port); | |
950 | - | |
951 | - if (tty && mos7720_port->open) | |
952 | - tty_wakeup(tty); | |
953 | - tty_kref_put(tty); | |
948 | + if (mos7720_port->open) | |
949 | + tty_port_tty_wakeup(&mos7720_port->port->port); | |
954 | 950 | } |
955 | 951 | |
956 | 952 | /* |
drivers/usb/serial/mos7840.c
... | ... | @@ -814,7 +814,6 @@ |
814 | 814 | { |
815 | 815 | struct moschip_port *mos7840_port; |
816 | 816 | struct usb_serial_port *port; |
817 | - struct tty_struct *tty; | |
818 | 817 | int status = urb->status; |
819 | 818 | int i; |
820 | 819 | |
... | ... | @@ -837,10 +836,8 @@ |
837 | 836 | if (mos7840_port_paranoia_check(port, __func__)) |
838 | 837 | return; |
839 | 838 | |
840 | - tty = tty_port_tty_get(&port->port); | |
841 | - if (tty && mos7840_port->open) | |
842 | - tty_wakeup(tty); | |
843 | - tty_kref_put(tty); | |
839 | + if (mos7840_port->open) | |
840 | + tty_port_tty_wakeup(&port->port); | |
844 | 841 | |
845 | 842 | } |
846 | 843 |
drivers/usb/serial/ti_usb_3410_5052.c
... | ... | @@ -1227,7 +1227,6 @@ |
1227 | 1227 | { |
1228 | 1228 | int count, result; |
1229 | 1229 | struct usb_serial_port *port = tport->tp_port; |
1230 | - struct tty_struct *tty = tty_port_tty_get(&port->port); /* FIXME */ | |
1231 | 1230 | unsigned long flags; |
1232 | 1231 | |
1233 | 1232 | spin_lock_irqsave(&tport->tp_lock, flags); |
1234 | 1233 | |
... | ... | @@ -1268,14 +1267,12 @@ |
1268 | 1267 | } |
1269 | 1268 | |
1270 | 1269 | /* more room in the buffer for new writes, wakeup */ |
1271 | - if (tty) | |
1272 | - tty_wakeup(tty); | |
1273 | - tty_kref_put(tty); | |
1270 | + tty_port_tty_wakeup(&port->port); | |
1271 | + | |
1274 | 1272 | wake_up_interruptible(&tport->tp_write_wait); |
1275 | 1273 | return; |
1276 | 1274 | unlock: |
1277 | 1275 | spin_unlock_irqrestore(&tport->tp_lock, flags); |
1278 | - tty_kref_put(tty); | |
1279 | 1276 | return; |
1280 | 1277 | } |
1281 | 1278 |
drivers/usb/serial/usb-serial.c
... | ... | @@ -541,16 +541,8 @@ |
541 | 541 | { |
542 | 542 | struct usb_serial_port *port = |
543 | 543 | container_of(work, struct usb_serial_port, work); |
544 | - struct tty_struct *tty; | |
545 | 544 | |
546 | - tty = tty_port_tty_get(&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); | |
545 | + tty_port_tty_wakeup(&port->port); | |
554 | 546 | } |
555 | 547 | |
556 | 548 | static void kill_traffic(struct usb_serial_port *port) |
include/linux/tty.h
... | ... | @@ -534,6 +534,7 @@ |
534 | 534 | extern void tty_port_raise_dtr_rts(struct tty_port *port); |
535 | 535 | extern void tty_port_lower_dtr_rts(struct tty_port *port); |
536 | 536 | extern void tty_port_hangup(struct tty_port *port); |
537 | +extern void tty_port_tty_wakeup(struct tty_port *port); | |
537 | 538 | extern int tty_port_block_til_ready(struct tty_port *port, |
538 | 539 | struct tty_struct *tty, struct file *filp); |
539 | 540 | extern int tty_port_close_start(struct tty_port *port, |