TTY: add tty_port_tty_wakeup helper
authorJiri Slaby <jslaby@suse.cz>
Thu, 7 Mar 2013 12:12:29 +0000 (13:12 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 18 Mar 2013 23:19:45 +0000 (16:19 -0700)
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>
22 files changed:
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

index f1b38571f94e7996d1c83712945583e3d1e75a06..cc206eda245c9912705c98e23c6f60eab56e01eb 100644 (file)
@@ -248,7 +248,6 @@ static irqreturn_t line_write_interrupt(int irq, void *data)
 {
        struct chan *chan = data;
        struct line *line = chan->line;
-       struct tty_struct *tty;
        int err;
 
        /*
@@ -267,12 +266,7 @@ static irqreturn_t line_write_interrupt(int irq, void *data)
        }
        spin_unlock(&line->lock);
 
-       tty = tty_port_tty_get(&line->port);
-       if (tty == NULL)
-               return IRQ_NONE;
-
-       tty_wakeup(tty);
-       tty_kref_put(tty);
+       tty_port_tty_wakeup(&line->port);
 
        return IRQ_HANDLED;
 }
index 89562a845f6aee86af1bb5bd54f1ceef228eb2c8..ac6f72b455d174fa97c317bce1475946de7a83eb 100644 (file)
@@ -569,7 +569,6 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb)
 {
        struct capidev *cdev = ap->private;
 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
-       struct tty_struct *tty;
        struct capiminor *mp;
        u16 datahandle;
        struct capincci *np;
@@ -627,11 +626,7 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb)
                         CAPIMSG_U16(skb->data, CAPIMSG_BASELEN + 4 + 2));
                kfree_skb(skb);
                capiminor_del_ack(mp, datahandle);
-               tty = tty_port_tty_get(&mp->port);
-               if (tty) {
-                       tty_wakeup(tty);
-                       tty_kref_put(tty);
-               }
+               tty_port_tty_wakeup(&mp->port);
                handle_minor_send(mp);
 
        } else {
index e2b539675b665d72aa1fe183cd9f0a61ad0262c2..600c79b030cdb68ddfb2fefd4cd53b6d10433511 100644 (file)
@@ -487,12 +487,8 @@ static const struct tty_operations if_ops = {
 static void if_wake(unsigned long data)
 {
        struct cardstate *cs = (struct cardstate *)data;
-       struct tty_struct *tty = tty_port_tty_get(&cs->port);
 
-       if (tty) {
-               tty_wakeup(tty);
-               tty_kref_put(tty);
-       }
+       tty_port_tty_wakeup(&cs->port);
 }
 
 /*** interface to common ***/
index e2dd3249b6bd3632d3d1750f2e992bea13f0178f..a7714b4f29adf4df0ddc761c122e350c90b0c8f0 100644 (file)
@@ -1925,7 +1925,6 @@ static void hso_std_serial_write_bulk_callback(struct urb *urb)
 {
        struct hso_serial *serial = urb->context;
        int status = urb->status;
-       struct tty_struct *tty;
 
        /* sanity check */
        if (!serial) {
@@ -1941,11 +1940,7 @@ static void hso_std_serial_write_bulk_callback(struct urb *urb)
                return;
        }
        hso_put_activity(serial->parent);
-       tty = tty_port_tty_get(&serial->port);
-       if (tty) {
-               tty_wakeup(tty);
-               tty_kref_put(tty);
-       }
+       tty_port_tty_wakeup(&serial->port);
        hso_kick_transmit(serial);
 
        D1(" ");
@@ -2008,12 +2003,8 @@ static void ctrl_callback(struct urb *urb)
                put_rxbuf_data_and_resubmit_ctrl_urb(serial);
                spin_unlock(&serial->serial_lock);
        } else {
-               struct tty_struct *tty = tty_port_tty_get(&serial->port);
                hso_put_activity(serial->parent);
-               if (tty) {
-                       tty_wakeup(tty);
-                       tty_kref_put(tty);
-               }
+               tty_port_tty_wakeup(&serial->port);
                /* response to a write command */
                hso_kick_transmit(serial);
        }
index 14b4cb8abcc8ffb41c6c56121c97bca90616ea11..7ed7a59878165bf8ef265e3fae90ee4b10017827 100644 (file)
@@ -107,7 +107,6 @@ sclp_tty_write_room (struct tty_struct *tty)
 static void
 sclp_ttybuf_callback(struct sclp_buffer *buffer, int rc)
 {
-       struct tty_struct *tty;
        unsigned long flags;
        void *page;
 
@@ -125,12 +124,8 @@ sclp_ttybuf_callback(struct sclp_buffer *buffer, int rc)
                                            struct sclp_buffer, list);
                spin_unlock_irqrestore(&sclp_tty_lock, flags);
        } while (buffer && sclp_emit_buffer(buffer, sclp_ttybuf_callback));
-       /* check if the tty needs a wake up call */
-       tty = tty_port_tty_get(&sclp_port);
-       if (tty != NULL) {
-               tty_wakeup(tty);
-               tty_kref_put(tty);
-       }
+
+       tty_port_tty_wakeup(&sclp_port);
 }
 
 static inline void
index 6c92f62623be4623cd7c950b6ab21d7d3c870be9..5aaaa2ec8df44f4547c70b9f80d5c628c6d9d591 100644 (file)
@@ -114,7 +114,6 @@ static struct sclp_register sclp_vt220_register = {
 static void
 sclp_vt220_process_queue(struct sclp_vt220_request *request)
 {
-       struct tty_struct *tty;
        unsigned long flags;
        void *page;
 
@@ -139,12 +138,7 @@ sclp_vt220_process_queue(struct sclp_vt220_request *request)
        } while (__sclp_vt220_emit(request));
        if (request == NULL && sclp_vt220_flush_later)
                sclp_vt220_emit_current();
-       /* Check if the tty needs a wake up call */
-       tty = tty_port_tty_get(&sclp_vt220_port);
-       if (tty) {
-               tty_wakeup(tty);
-               tty_kref_put(tty);
-       }
+       tty_port_tty_wakeup(&sclp_vt220_port);
 }
 
 #define SCLP_BUFFER_MAX_RETRY          1
index 5a6fb44f38a8ae22a2d6d8d8786b3788dc7f9f07..5c64e3a35b281dad02bac6b10d68529423cfaeb2 100644 (file)
@@ -744,7 +744,6 @@ static void fwtty_tx_complete(struct fw_card *card, int rcode,
                              struct fwtty_transaction *txn)
 {
        struct fwtty_port *port = txn->port;
-       struct tty_struct *tty;
        int len;
 
        fwtty_dbg(port, "rcode: %d", rcode);
@@ -769,13 +768,8 @@ static void fwtty_tx_complete(struct fw_card *card, int rcode,
                port->stats.dropped += txn->dma_pended.len;
        }
 
-       if (len < WAKEUP_CHARS) {
-               tty = tty_port_tty_get(&port->port);
-               if (tty) {
-                       tty_wakeup(tty);
-                       tty_kref_put(tty);
-               }
-       }
+       if (len < WAKEUP_CHARS)
+               tty_port_tty_wakeup(&port->port);
 }
 
 static int fwtty_tx(struct fwtty_port *port, bool drain)
index b1bb1a6abe8177eeab930d4963fecca11516df57..8a6e5ea476e1cf59f123742372bcb6a8a10425eb 100644 (file)
@@ -264,7 +264,6 @@ static void ProcessRxChar(struct usb_serial_port *port, unsigned char data)
 
 static void qt_write_bulk_callback(struct urb *urb)
 {
-       struct tty_struct *tty;
        int status;
        struct quatech_port *quatech_port;
 
@@ -278,11 +277,7 @@ static void qt_write_bulk_callback(struct urb *urb)
 
        quatech_port = urb->context;
 
-       tty = tty_port_tty_get(&quatech_port->port->port);
-
-       if (tty)
-               tty_wakeup(tty);
-       tty_kref_put(tty);
+       tty_port_tty_wakeup(&quatech_port->port->port);
 }
 
 static void qt_interrupt_callback(struct urb *urb)
index ed92622b8949dcdd3338388e213b67241110d3e1..6d0c27cd03da2676b91bfef307482a83be765697 100644 (file)
@@ -472,13 +472,9 @@ static void ehv_bc_tx_dequeue(struct ehv_bc_data *bc)
 static irqreturn_t ehv_bc_tty_tx_isr(int irq, void *data)
 {
        struct ehv_bc_data *bc = data;
-       struct tty_struct *ttys = tty_port_tty_get(&bc->port);
 
        ehv_bc_tx_dequeue(bc);
-       if (ttys) {
-               tty_wakeup(ttys);
-               tty_kref_put(ttys);
-       }
+       tty_port_tty_wakeup(&bc->port);
 
        return IRQ_HANDLED;
 }
index ef95a154854abc9622999df1f5248e683e3d85d5..41901997c0d62802b6ae0c165e87eca49c7be372 100644 (file)
@@ -861,7 +861,6 @@ static void hvsi_write_worker(struct work_struct *work)
 {
        struct hvsi_struct *hp =
                container_of(work, struct hvsi_struct, writer.work);
-       struct tty_struct *tty;
        unsigned long flags;
 #ifdef DEBUG
        static long start_j = 0;
@@ -895,11 +894,7 @@ static void hvsi_write_worker(struct work_struct *work)
                start_j = 0;
 #endif /* DEBUG */
                wake_up_all(&hp->emptyq);
-               tty = tty_port_tty_get(&hp->port);
-               if (tty) {
-                       tty_wakeup(tty);
-                       tty_kref_put(tty);
-               }
+               tty_port_tty_wakeup(&hp->port);
        }
 
 out:
index 2dff19796157b8ffc9c7c8bfe4aa3806b362c814..2e5bbdc09e1ce3d671e462dae35906f7b2a2c0aa 100644 (file)
@@ -791,7 +791,6 @@ static int send_data(enum port_type index, struct nozomi *dc)
        const u8 toggle = port->toggle_ul;
        void __iomem *addr = port->ul_addr[toggle];
        const u32 ul_size = port->ul_size[toggle];
-       struct tty_struct *tty = tty_port_tty_get(&port->port);
 
        /* Get data from tty and place in buf for now */
        size = kfifo_out(&port->fifo_ul, dc->send_buf,
@@ -799,7 +798,6 @@ static int send_data(enum port_type index, struct nozomi *dc)
 
        if (size == 0) {
                DBG4("No more data to send, disable link:");
-               tty_kref_put(tty);
                return 0;
        }
 
@@ -809,10 +807,8 @@ static int send_data(enum port_type index, struct nozomi *dc)
        write_mem32(addr, (u32 *) &size, 4);
        write_mem32(addr + 4, (u32 *) dc->send_buf, size);
 
-       if (tty)
-               tty_wakeup(tty);
+       tty_port_tty_wakeup(&port->port);
 
-       tty_kref_put(tty);
        return 1;
 }
 
index 68d7ce997ede999fce550d0b6d1ccd6d0e9032be..d723d4193b9014a6bc1730b106798d22fe9ca59d 100644 (file)
@@ -442,25 +442,6 @@ static void ifx_spi_setup_spi_header(unsigned char *txbuffer, int tx_count,
        txbuffer[1] |= (more << IFX_SPI_MORE_BIT) & IFX_SPI_MORE_MASK;
 }
 
-/**
- *     ifx_spi_wakeup_serial   -       SPI space made
- *     @port_data: our SPI device
- *
- *     We have emptied the FIFO enough that we want to get more data
- *     queued into it. Poke the line discipline via tty_wakeup so that
- *     it will feed us more bits
- */
-static void ifx_spi_wakeup_serial(struct ifx_spi_device *ifx_dev)
-{
-       struct tty_struct *tty;
-
-       tty = tty_port_tty_get(&ifx_dev->tty_port);
-       if (!tty)
-               return;
-       tty_wakeup(tty);
-       tty_kref_put(tty);
-}
-
 /**
  *     ifx_spi_prepare_tx_buffer       -       prepare transmit frame
  *     @ifx_dev: our SPI device
@@ -506,7 +487,7 @@ static int ifx_spi_prepare_tx_buffer(struct ifx_spi_device *ifx_dev)
                        tx_count += temp_count;
                        if (temp_count == queue_length)
                                /* poke port to get more data */
-                               ifx_spi_wakeup_serial(ifx_dev);
+                               tty_port_tty_wakeup(&ifx_dev->tty_port);
                        else /* more data in port, use next SPI message */
                                ifx_dev->spi_more = 1;
                }
@@ -683,8 +664,6 @@ static void ifx_spi_insert_flip_string(struct ifx_spi_device *ifx_dev,
 static void ifx_spi_complete(void *ctx)
 {
        struct ifx_spi_device *ifx_dev = ctx;
-       struct tty_struct *tty;
-       struct tty_ldisc *ldisc = NULL;
        int length;
        int actual_length;
        unsigned char more;
@@ -762,15 +741,7 @@ complete_exit:
                         */
                        ifx_spi_power_state_clear(ifx_dev,
                                                  IFX_SPI_POWER_DATA_PENDING);
-                       tty = tty_port_tty_get(&ifx_dev->tty_port);
-                       if (tty) {
-                               ldisc = tty_ldisc_ref(tty);
-                               if (ldisc) {
-                                       ldisc->ops->write_wakeup(tty);
-                                       tty_ldisc_deref(ldisc);
-                               }
-                               tty_kref_put(tty);
-                       }
+                       tty_port_tty_wakeup(&ifx_dev->tty_port);
                }
        }
 }
index b7ff59d3db88f85d5f37027e2adf44d036c1e0a2..8bb757c62ee2044746cd9e93a052325bc28907db 100644 (file)
@@ -232,6 +232,22 @@ void tty_port_hangup(struct tty_port *port)
 }
 EXPORT_SYMBOL(tty_port_hangup);
 
+/**
+ * tty_port_tty_wakeup - helper to wake up a tty
+ *
+ * @port: tty port
+ */
+void tty_port_tty_wakeup(struct tty_port *port)
+{
+       struct tty_struct *tty = tty_port_tty_get(port);
+
+       if (tty) {
+               tty_wakeup(tty);
+               tty_kref_put(tty);
+       }
+}
+EXPORT_SYMBOL_GPL(tty_port_tty_wakeup);
+
 /**
  *     tty_port_carrier_raised -       carrier raised check
  *     @port: tty port
index 8ac25adf31b41d857a6919299f1848cf2ee43710..755766e4b7566d2a9fa236cd5ce919ba97a9a23e 100644 (file)
@@ -475,15 +475,10 @@ static void acm_write_bulk(struct urb *urb)
 static void acm_softint(struct work_struct *work)
 {
        struct acm *acm = container_of(work, struct acm, work);
-       struct tty_struct *tty;
 
        dev_vdbg(&acm->data->dev, "%s\n", __func__);
 
-       tty = tty_port_tty_get(&acm->port);
-       if (!tty)
-               return;
-       tty_wakeup(tty);
-       tty_kref_put(tty);
+       tty_port_tty_wakeup(&acm->port);
 }
 
 /*
index ebe45fa0ed50a3722ed7feae0750558ffea7fdad..31191581060c94762c7265eb031e224ccb227713 100644 (file)
@@ -210,7 +210,6 @@ struct digi_port {
 
 /* Local Function Declarations */
 
-static void digi_wakeup_write(struct usb_serial_port *port);
 static void digi_wakeup_write_lock(struct work_struct *work);
 static int digi_write_oob_command(struct usb_serial_port *port,
        unsigned char *buf, int count, int interruptible);
@@ -374,20 +373,10 @@ static void digi_wakeup_write_lock(struct work_struct *work)
        unsigned long flags;
 
        spin_lock_irqsave(&priv->dp_port_lock, flags);
-       digi_wakeup_write(port);
+       tty_port_tty_wakeup(&port->port);
        spin_unlock_irqrestore(&priv->dp_port_lock, flags);
 }
 
-static void digi_wakeup_write(struct usb_serial_port *port)
-{
-       struct tty_struct *tty = tty_port_tty_get(&port->port);
-       if (tty) {
-               tty_wakeup(tty);
-               tty_kref_put(tty);
-       }
-}
-
-
 /*
  *  Digi Write OOB Command
  *
@@ -1044,7 +1033,7 @@ static void digi_write_bulk_callback(struct urb *urb)
                }
        }
        /* wake up processes sleeping on writes immediately */
-       digi_wakeup_write(port);
+       tty_port_tty_wakeup(&port->port);
        /* also queue up a wakeup at scheduler time, in case we */
        /* lost the race in write_chan(). */
        schedule_work(&priv->dp_wakeup_work);
@@ -1522,7 +1511,7 @@ static int digi_read_oob_callback(struct urb *urb)
                                /* port must be open to use tty struct */
                                if (rts) {
                                        tty->hw_stopped = 0;
-                                       digi_wakeup_write(port);
+                                       tty_port_tty_wakeup(&port->port);
                                }
                        } else {
                                priv->dp_modem_signals &= ~TIOCM_CTS;
index b00e5cbf741f16b63071c8273c7f69eaa279ca6d..44e5208f7c61461be5ab21d1e3f8bc1bc2ded754 100644 (file)
@@ -565,7 +565,6 @@ static void edge_interrupt_callback(struct urb *urb)
        struct device *dev;
        struct edgeport_port *edge_port;
        struct usb_serial_port *port;
-       struct tty_struct *tty;
        unsigned char *data = urb->transfer_buffer;
        int length = urb->actual_length;
        int bytes_avail;
@@ -644,12 +643,7 @@ static void edge_interrupt_callback(struct urb *urb)
 
                                        /* tell the tty driver that something
                                           has changed */
-                                       tty = tty_port_tty_get(
-                                               &edge_port->port->port);
-                                       if (tty) {
-                                               tty_wakeup(tty);
-                                               tty_kref_put(tty);
-                                       }
+                                       tty_port_tty_wakeup(&edge_port->port->port);
                                        /* Since we have more credit, check
                                           if more data can be sent */
                                        send_more_port_data(edge_serial,
@@ -738,7 +732,6 @@ static void edge_bulk_in_callback(struct urb *urb)
 static void edge_bulk_out_data_callback(struct urb *urb)
 {
        struct edgeport_port *edge_port = urb->context;
-       struct tty_struct *tty;
        int status = urb->status;
 
        if (status) {
@@ -747,14 +740,8 @@ static void edge_bulk_out_data_callback(struct urb *urb)
                        __func__, status);
        }
 
-       tty = tty_port_tty_get(&edge_port->port->port);
-
-       if (tty && edge_port->open) {
-               /* let the tty driver wakeup if it has a special
-                  write_wakeup function */
-               tty_wakeup(tty);
-       }
-       tty_kref_put(tty);
+       if (edge_port->open)
+               tty_port_tty_wakeup(&edge_port->port->port);
 
        /* Release the Write URB */
        edge_port->write_in_progress = false;
@@ -773,7 +760,6 @@ static void edge_bulk_out_data_callback(struct urb *urb)
 static void edge_bulk_out_cmd_callback(struct urb *urb)
 {
        struct edgeport_port *edge_port = urb->context;
-       struct tty_struct *tty;
        int status = urb->status;
 
        atomic_dec(&CmdUrbs);
@@ -794,13 +780,9 @@ static void edge_bulk_out_cmd_callback(struct urb *urb)
                return;
        }
 
-       /* Get pointer to tty */
-       tty = tty_port_tty_get(&edge_port->port->port);
-
        /* tell the tty driver that something has changed */
-       if (tty && edge_port->open)
-               tty_wakeup(tty);
-       tty_kref_put(tty);
+       if (edge_port->open)
+               tty_port_tty_wakeup(&edge_port->port->port);
 
        /* we have completed the command */
        edge_port->commandPending = false;
index 3b17d5d13dc86aa8fa9ebe8b6a290572c57a6323..2230223978ca731bef98ffb09b121ad974ff649f 100644 (file)
@@ -104,10 +104,8 @@ static void keyspan_pda_wakeup_write(struct work_struct *work)
        struct keyspan_pda_private *priv =
                container_of(work, struct keyspan_pda_private, wakeup_work);
        struct usb_serial_port *port = priv->port;
-       struct tty_struct *tty = tty_port_tty_get(&port->port);
-       if (tty)
-               tty_wakeup(tty);
-       tty_kref_put(tty);
+
+       tty_port_tty_wakeup(&port->port);
 }
 
 static void keyspan_pda_request_unthrottle(struct work_struct *work)
index e0ebec3b5d6ae077aa4ac0347e8a33470f8dc6c3..e956eae198fd6cfbb014fc727912953dee22d892 100644 (file)
@@ -932,7 +932,6 @@ static void mos7720_bulk_in_callback(struct urb *urb)
 static void mos7720_bulk_out_data_callback(struct urb *urb)
 {
        struct moschip_port *mos7720_port;
-       struct tty_struct *tty;
        int status = urb->status;
 
        if (status) {
@@ -946,11 +945,8 @@ static void mos7720_bulk_out_data_callback(struct urb *urb)
                return ;
        }
 
-       tty = tty_port_tty_get(&mos7720_port->port->port);
-
-       if (tty && mos7720_port->open)
-               tty_wakeup(tty);
-       tty_kref_put(tty);
+       if (mos7720_port->open)
+               tty_port_tty_wakeup(&mos7720_port->port->port);
 }
 
 /*
index 809fb329eca5f945d13c25e75f74bf79145389df..08284d28e84b3b396b3a6d08283b5c6715152cd4 100644 (file)
@@ -814,7 +814,6 @@ static void mos7840_bulk_out_data_callback(struct urb *urb)
 {
        struct moschip_port *mos7840_port;
        struct usb_serial_port *port;
-       struct tty_struct *tty;
        int status = urb->status;
        int i;
 
@@ -837,10 +836,8 @@ static void mos7840_bulk_out_data_callback(struct urb *urb)
        if (mos7840_port_paranoia_check(port, __func__))
                return;
 
-       tty = tty_port_tty_get(&port->port);
-       if (tty && mos7840_port->open)
-               tty_wakeup(tty);
-       tty_kref_put(tty);
+       if (mos7840_port->open)
+               tty_port_tty_wakeup(&port->port);
 
 }
 
index 39cb9b807c3cf998842c39267e9d217b82460e59..437f2d579cde421d6363e0c564955e569ee74762 100644 (file)
@@ -1227,7 +1227,6 @@ static void ti_send(struct ti_port *tport)
 {
        int count, result;
        struct usb_serial_port *port = tport->tp_port;
-       struct tty_struct *tty = tty_port_tty_get(&port->port); /* FIXME */
        unsigned long flags;
 
        spin_lock_irqsave(&tport->tp_lock, flags);
@@ -1268,14 +1267,12 @@ static void ti_send(struct ti_port *tport)
        }
 
        /* more room in the buffer for new writes, wakeup */
-       if (tty)
-               tty_wakeup(tty);
-       tty_kref_put(tty);
+       tty_port_tty_wakeup(&port->port);
+
        wake_up_interruptible(&tport->tp_write_wait);
        return;
 unlock:
        spin_unlock_irqrestore(&tport->tp_lock, flags);
-       tty_kref_put(tty);
        return;
 }
 
index a19ed74d770d73b016e69070cb27e282bbc21fad..2df84845bafb3f8f624b93c8a0f1aca1c57e3080 100644 (file)
@@ -541,16 +541,8 @@ static void usb_serial_port_work(struct work_struct *work)
 {
        struct usb_serial_port *port =
                container_of(work, struct usb_serial_port, work);
-       struct tty_struct *tty;
 
-       tty = tty_port_tty_get(&port->port);
-       if (!tty)
-               return;
-
-       dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number);
-
-       tty_wakeup(tty);
-       tty_kref_put(tty);
+       tty_port_tty_wakeup(&port->port);
 }
 
 static void kill_traffic(struct usb_serial_port *port)
index 63b62865c8e9908c9596c4de958c36202d3709d6..b6e890a87eb1bae0640612548c1713fbae8b6186 100644 (file)
@@ -534,6 +534,7 @@ extern int tty_port_carrier_raised(struct tty_port *port);
 extern void tty_port_raise_dtr_rts(struct tty_port *port);
 extern void tty_port_lower_dtr_rts(struct tty_port *port);
 extern void tty_port_hangup(struct tty_port *port);
+extern void tty_port_tty_wakeup(struct tty_port *port);
 extern int tty_port_block_til_ready(struct tty_port *port,
                                struct tty_struct *tty, struct file *filp);
 extern int tty_port_close_start(struct tty_port *port,