Commit 6aad04f2 authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman

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: default avatarJiri Slaby <jslaby@suse.cz>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6982a398
...@@ -248,7 +248,6 @@ static irqreturn_t line_write_interrupt(int irq, void *data) ...@@ -248,7 +248,6 @@ static irqreturn_t line_write_interrupt(int irq, void *data)
{ {
struct chan *chan = data; struct chan *chan = data;
struct line *line = chan->line; struct line *line = chan->line;
struct tty_struct *tty;
int err; int err;
/* /*
...@@ -267,12 +266,7 @@ static irqreturn_t line_write_interrupt(int irq, void *data) ...@@ -267,12 +266,7 @@ static irqreturn_t line_write_interrupt(int irq, void *data)
} }
spin_unlock(&line->lock); spin_unlock(&line->lock);
tty = tty_port_tty_get(&line->port); tty_port_tty_wakeup(&line->port);
if (tty == NULL)
return IRQ_NONE;
tty_wakeup(tty);
tty_kref_put(tty);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -569,7 +569,6 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb) ...@@ -569,7 +569,6 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb)
{ {
struct capidev *cdev = ap->private; struct capidev *cdev = ap->private;
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
struct tty_struct *tty;
struct capiminor *mp; struct capiminor *mp;
u16 datahandle; u16 datahandle;
struct capincci *np; struct capincci *np;
...@@ -627,11 +626,7 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb) ...@@ -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)); CAPIMSG_U16(skb->data, CAPIMSG_BASELEN + 4 + 2));
kfree_skb(skb); kfree_skb(skb);
capiminor_del_ack(mp, datahandle); capiminor_del_ack(mp, datahandle);
tty = tty_port_tty_get(&mp->port); tty_port_tty_wakeup(&mp->port);
if (tty) {
tty_wakeup(tty);
tty_kref_put(tty);
}
handle_minor_send(mp); handle_minor_send(mp);
} else { } else {
......
...@@ -487,12 +487,8 @@ static const struct tty_operations if_ops = { ...@@ -487,12 +487,8 @@ static const struct tty_operations if_ops = {
static void if_wake(unsigned long data) static void if_wake(unsigned long data)
{ {
struct cardstate *cs = (struct cardstate *)data; struct cardstate *cs = (struct cardstate *)data;
struct tty_struct *tty = tty_port_tty_get(&cs->port);
if (tty) { tty_port_tty_wakeup(&cs->port);
tty_wakeup(tty);
tty_kref_put(tty);
}
} }
/*** interface to common ***/ /*** interface to common ***/
......
...@@ -1925,7 +1925,6 @@ static void hso_std_serial_write_bulk_callback(struct urb *urb) ...@@ -1925,7 +1925,6 @@ static void hso_std_serial_write_bulk_callback(struct urb *urb)
{ {
struct hso_serial *serial = urb->context; struct hso_serial *serial = urb->context;
int status = urb->status; int status = urb->status;
struct tty_struct *tty;
/* sanity check */ /* sanity check */
if (!serial) { if (!serial) {
...@@ -1941,11 +1940,7 @@ static void hso_std_serial_write_bulk_callback(struct urb *urb) ...@@ -1941,11 +1940,7 @@ static void hso_std_serial_write_bulk_callback(struct urb *urb)
return; return;
} }
hso_put_activity(serial->parent); hso_put_activity(serial->parent);
tty = tty_port_tty_get(&serial->port); tty_port_tty_wakeup(&serial->port);
if (tty) {
tty_wakeup(tty);
tty_kref_put(tty);
}
hso_kick_transmit(serial); hso_kick_transmit(serial);
D1(" "); D1(" ");
...@@ -2008,12 +2003,8 @@ static void ctrl_callback(struct urb *urb) ...@@ -2008,12 +2003,8 @@ static void ctrl_callback(struct urb *urb)
put_rxbuf_data_and_resubmit_ctrl_urb(serial); put_rxbuf_data_and_resubmit_ctrl_urb(serial);
spin_unlock(&serial->serial_lock); spin_unlock(&serial->serial_lock);
} else { } else {
struct tty_struct *tty = tty_port_tty_get(&serial->port);
hso_put_activity(serial->parent); hso_put_activity(serial->parent);
if (tty) { tty_port_tty_wakeup(&serial->port);
tty_wakeup(tty);
tty_kref_put(tty);
}
/* response to a write command */ /* response to a write command */
hso_kick_transmit(serial); hso_kick_transmit(serial);
} }
......
...@@ -107,7 +107,6 @@ sclp_tty_write_room (struct tty_struct *tty) ...@@ -107,7 +107,6 @@ sclp_tty_write_room (struct tty_struct *tty)
static void static void
sclp_ttybuf_callback(struct sclp_buffer *buffer, int rc) sclp_ttybuf_callback(struct sclp_buffer *buffer, int rc)
{ {
struct tty_struct *tty;
unsigned long flags; unsigned long flags;
void *page; void *page;
...@@ -125,12 +124,8 @@ sclp_ttybuf_callback(struct sclp_buffer *buffer, int rc) ...@@ -125,12 +124,8 @@ sclp_ttybuf_callback(struct sclp_buffer *buffer, int rc)
struct sclp_buffer, list); struct sclp_buffer, list);
spin_unlock_irqrestore(&sclp_tty_lock, flags); spin_unlock_irqrestore(&sclp_tty_lock, flags);
} while (buffer && sclp_emit_buffer(buffer, sclp_ttybuf_callback)); } 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); tty_port_tty_wakeup(&sclp_port);
if (tty != NULL) {
tty_wakeup(tty);
tty_kref_put(tty);
}
} }
static inline void static inline void
......
...@@ -114,7 +114,6 @@ static struct sclp_register sclp_vt220_register = { ...@@ -114,7 +114,6 @@ static struct sclp_register sclp_vt220_register = {
static void static void
sclp_vt220_process_queue(struct sclp_vt220_request *request) sclp_vt220_process_queue(struct sclp_vt220_request *request)
{ {
struct tty_struct *tty;
unsigned long flags; unsigned long flags;
void *page; void *page;
...@@ -139,12 +138,7 @@ sclp_vt220_process_queue(struct sclp_vt220_request *request) ...@@ -139,12 +138,7 @@ sclp_vt220_process_queue(struct sclp_vt220_request *request)
} while (__sclp_vt220_emit(request)); } while (__sclp_vt220_emit(request));
if (request == NULL && sclp_vt220_flush_later) if (request == NULL && sclp_vt220_flush_later)
sclp_vt220_emit_current(); sclp_vt220_emit_current();
/* Check if the tty needs a wake up call */ tty_port_tty_wakeup(&sclp_vt220_port);
tty = tty_port_tty_get(&sclp_vt220_port);
if (tty) {
tty_wakeup(tty);
tty_kref_put(tty);
}
} }
#define SCLP_BUFFER_MAX_RETRY 1 #define SCLP_BUFFER_MAX_RETRY 1
......
...@@ -744,7 +744,6 @@ static void fwtty_tx_complete(struct fw_card *card, int rcode, ...@@ -744,7 +744,6 @@ static void fwtty_tx_complete(struct fw_card *card, int rcode,
struct fwtty_transaction *txn) struct fwtty_transaction *txn)
{ {
struct fwtty_port *port = txn->port; struct fwtty_port *port = txn->port;
struct tty_struct *tty;
int len; int len;
fwtty_dbg(port, "rcode: %d", rcode); fwtty_dbg(port, "rcode: %d", rcode);
...@@ -769,13 +768,8 @@ static void fwtty_tx_complete(struct fw_card *card, int rcode, ...@@ -769,13 +768,8 @@ static void fwtty_tx_complete(struct fw_card *card, int rcode,
port->stats.dropped += txn->dma_pended.len; port->stats.dropped += txn->dma_pended.len;
} }
if (len < WAKEUP_CHARS) { if (len < WAKEUP_CHARS)
tty = tty_port_tty_get(&port->port); tty_port_tty_wakeup(&port->port);
if (tty) {
tty_wakeup(tty);
tty_kref_put(tty);
}
}
} }
static int fwtty_tx(struct fwtty_port *port, bool drain) static int fwtty_tx(struct fwtty_port *port, bool drain)
......
...@@ -264,7 +264,6 @@ static void ProcessRxChar(struct usb_serial_port *port, unsigned char data) ...@@ -264,7 +264,6 @@ static void ProcessRxChar(struct usb_serial_port *port, unsigned char data)
static void qt_write_bulk_callback(struct urb *urb) static void qt_write_bulk_callback(struct urb *urb)
{ {
struct tty_struct *tty;
int status; int status;
struct quatech_port *quatech_port; struct quatech_port *quatech_port;
...@@ -278,11 +277,7 @@ static void qt_write_bulk_callback(struct urb *urb) ...@@ -278,11 +277,7 @@ static void qt_write_bulk_callback(struct urb *urb)
quatech_port = urb->context; quatech_port = urb->context;
tty = tty_port_tty_get(&quatech_port->port->port); tty_port_tty_wakeup(&quatech_port->port->port);
if (tty)
tty_wakeup(tty);
tty_kref_put(tty);
} }
static void qt_interrupt_callback(struct urb *urb) static void qt_interrupt_callback(struct urb *urb)
......
...@@ -472,13 +472,9 @@ static void ehv_bc_tx_dequeue(struct ehv_bc_data *bc) ...@@ -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) static irqreturn_t ehv_bc_tty_tx_isr(int irq, void *data)
{ {
struct ehv_bc_data *bc = data; struct ehv_bc_data *bc = data;
struct tty_struct *ttys = tty_port_tty_get(&bc->port);
ehv_bc_tx_dequeue(bc); ehv_bc_tx_dequeue(bc);
if (ttys) { tty_port_tty_wakeup(&bc->port);
tty_wakeup(ttys);
tty_kref_put(ttys);
}
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -861,7 +861,6 @@ static void hvsi_write_worker(struct work_struct *work) ...@@ -861,7 +861,6 @@ static void hvsi_write_worker(struct work_struct *work)
{ {
struct hvsi_struct *hp = struct hvsi_struct *hp =
container_of(work, struct hvsi_struct, writer.work); container_of(work, struct hvsi_struct, writer.work);
struct tty_struct *tty;
unsigned long flags; unsigned long flags;
#ifdef DEBUG #ifdef DEBUG
static long start_j = 0; static long start_j = 0;
...@@ -895,11 +894,7 @@ static void hvsi_write_worker(struct work_struct *work) ...@@ -895,11 +894,7 @@ static void hvsi_write_worker(struct work_struct *work)
start_j = 0; start_j = 0;
#endif /* DEBUG */ #endif /* DEBUG */
wake_up_all(&hp->emptyq); wake_up_all(&hp->emptyq);
tty = tty_port_tty_get(&hp->port); tty_port_tty_wakeup(&hp->port);
if (tty) {
tty_wakeup(tty);
tty_kref_put(tty);
}
} }
out: out:
......
...@@ -791,7 +791,6 @@ static int send_data(enum port_type index, struct nozomi *dc) ...@@ -791,7 +791,6 @@ static int send_data(enum port_type index, struct nozomi *dc)
const u8 toggle = port->toggle_ul; const u8 toggle = port->toggle_ul;
void __iomem *addr = port->ul_addr[toggle]; void __iomem *addr = port->ul_addr[toggle];
const u32 ul_size = port->ul_size[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 */ /* Get data from tty and place in buf for now */
size = kfifo_out(&port->fifo_ul, dc->send_buf, 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,7 +798,6 @@ static int send_data(enum port_type index, struct nozomi *dc)
if (size == 0) { if (size == 0) {
DBG4("No more data to send, disable link:"); DBG4("No more data to send, disable link:");
tty_kref_put(tty);
return 0; return 0;
} }
...@@ -809,10 +807,8 @@ static int send_data(enum port_type index, struct nozomi *dc) ...@@ -809,10 +807,8 @@ static int send_data(enum port_type index, struct nozomi *dc)
write_mem32(addr, (u32 *) &size, 4); write_mem32(addr, (u32 *) &size, 4);
write_mem32(addr + 4, (u32 *) dc->send_buf, size); write_mem32(addr + 4, (u32 *) dc->send_buf, size);
if (tty) tty_port_tty_wakeup(&port->port);
tty_wakeup(tty);
tty_kref_put(tty);
return 1; return 1;
} }
......
...@@ -442,25 +442,6 @@ static void ifx_spi_setup_spi_header(unsigned char *txbuffer, int tx_count, ...@@ -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; 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_spi_prepare_tx_buffer - prepare transmit frame
* @ifx_dev: our SPI device * @ifx_dev: our SPI device
...@@ -506,7 +487,7 @@ static int ifx_spi_prepare_tx_buffer(struct ifx_spi_device *ifx_dev) ...@@ -506,7 +487,7 @@ static int ifx_spi_prepare_tx_buffer(struct ifx_spi_device *ifx_dev)
tx_count += temp_count; tx_count += temp_count;
if (temp_count == queue_length) if (temp_count == queue_length)
/* poke port to get more data */ /* 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 */ else /* more data in port, use next SPI message */
ifx_dev->spi_more = 1; ifx_dev->spi_more = 1;
} }
...@@ -683,8 +664,6 @@ static void ifx_spi_insert_flip_string(struct ifx_spi_device *ifx_dev, ...@@ -683,8 +664,6 @@ static void ifx_spi_insert_flip_string(struct ifx_spi_device *ifx_dev,
static void ifx_spi_complete(void *ctx) static void ifx_spi_complete(void *ctx)
{ {
struct ifx_spi_device *ifx_dev = ctx; struct ifx_spi_device *ifx_dev = ctx;
struct tty_struct *tty;
struct tty_ldisc *ldisc = NULL;
int length; int length;
int actual_length; int actual_length;
unsigned char more; unsigned char more;
...@@ -762,15 +741,7 @@ static void ifx_spi_complete(void *ctx) ...@@ -762,15 +741,7 @@ static void ifx_spi_complete(void *ctx)
*/ */
ifx_spi_power_state_clear(ifx_dev, ifx_spi_power_state_clear(ifx_dev,
IFX_SPI_POWER_DATA_PENDING); IFX_SPI_POWER_DATA_PENDING);
tty = tty_port_tty_get(&ifx_dev->tty_port); tty_port_tty_wakeup(&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);
}
} }
} }
} }
......
...@@ -232,6 +232,22 @@ void tty_port_hangup(struct tty_port *port) ...@@ -232,6 +232,22 @@ void tty_port_hangup(struct tty_port *port)
} }
EXPORT_SYMBOL(tty_port_hangup); 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 * tty_port_carrier_raised - carrier raised check
* @port: tty port * @port: tty port
......
...@@ -475,15 +475,10 @@ static void acm_write_bulk(struct urb *urb) ...@@ -475,15 +475,10 @@ static void acm_write_bulk(struct urb *urb)
static void acm_softint(struct work_struct *work) static void acm_softint(struct work_struct *work)
{ {
struct acm *acm = container_of(work, struct acm, work); struct acm *acm = container_of(work, struct acm, work);
struct tty_struct *tty;
dev_vdbg(&acm->data->dev, "%s\n", __func__); dev_vdbg(&acm->data->dev, "%s\n", __func__);
tty = tty_port_tty_get(&acm->port); tty_port_tty_wakeup(&acm->port);
if (!tty)
return;
tty_wakeup(tty);
tty_kref_put(tty);
} }
/* /*
......
...@@ -210,7 +210,6 @@ struct digi_port { ...@@ -210,7 +210,6 @@ struct digi_port {
/* Local Function Declarations */ /* Local Function Declarations */
static void digi_wakeup_write(struct usb_serial_port *port);
static void digi_wakeup_write_lock(struct work_struct *work); static void digi_wakeup_write_lock(struct work_struct *work);
static int digi_write_oob_command(struct usb_serial_port *port, static int digi_write_oob_command(struct usb_serial_port *port,
unsigned char *buf, int count, int interruptible); unsigned char *buf, int count, int interruptible);
...@@ -374,20 +373,10 @@ static void digi_wakeup_write_lock(struct work_struct *work) ...@@ -374,20 +373,10 @@ static void digi_wakeup_write_lock(struct work_struct *work)
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&priv->dp_port_lock, 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); 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 * Digi Write OOB Command
* *
...@@ -1044,7 +1033,7 @@ static void digi_write_bulk_callback(struct urb *urb) ...@@ -1044,7 +1033,7 @@ static void digi_write_bulk_callback(struct urb *urb)
} }
} }
/* wake up processes sleeping on writes immediately */ /* 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 */ /* also queue up a wakeup at scheduler time, in case we */
/* lost the race in write_chan(). */ /* lost the race in write_chan(). */
schedule_work(&priv->dp_wakeup_work); schedule_work(&priv->dp_wakeup_work);
...@@ -1522,7 +1511,7 @@ static int digi_read_oob_callback(struct urb *urb) ...@@ -1522,7 +1511,7 @@ static int digi_read_oob_callback(struct urb *urb)
/* port must be open to use tty struct */ /* port must be open to use tty struct */
if (rts) { if (rts) {
tty->hw_stopped = 0; tty->hw_stopped = 0;
digi_wakeup_write(port); tty_port_tty_wakeup(&port->port);
} }
} else { } else {
priv->dp_modem_signals &= ~TIOCM_CTS; priv->dp_modem_signals &= ~TIOCM_CTS;
......
...@@ -565,7 +565,6 @@ static void edge_interrupt_callback(struct urb *urb) ...@@ -565,7 +565,6 @@ static void edge_interrupt_callback(struct urb *urb)
struct device *dev; struct device *dev;
struct edgeport_port *edge_port; struct edgeport_port *edge_port;
struct usb_serial_port *port; struct usb_serial_port *port;
struct tty_struct *tty;
unsigned char *data = urb->transfer_buffer; unsigned char *data = urb->transfer_buffer;
int length = urb->actual_length; int length = urb->actual_length;
int bytes_avail; int bytes_avail;
...@@ -644,12 +643,7 @@ static void edge_interrupt_callback(struct urb *urb) ...@@ -644,12 +643,7 @@ static void edge_interrupt_callback(struct urb *urb)
/* tell the tty driver that something /* tell the tty driver that something
has changed */ has changed */
tty = tty_port_tty_get( tty_port_tty_wakeup(&edge_port->port->port);
&edge_port->port->port);
if (tty) {
tty_wakeup(tty);
tty_kref_put(tty);
}
/* Since we have more credit, check /* Since we have more credit, check
if more data can be sent */ if more data can be sent */
send_more_port_data(edge_serial, send_more_port_data(edge_serial,
...@@ -738,7 +732,6 @@ static void edge_bulk_in_callback(struct urb *urb) ...@@ -738,7 +732,6 @@ static void edge_bulk_in_callback(struct urb *urb)
static void edge_bulk_out_data_callback(struct urb *urb) static void edge_bulk_out_data_callback(struct urb *urb)
{ {
struct edgeport_port *edge_port = urb->context; struct edgeport_port *edge_port = urb->context;
struct tty_struct *tty;
int status = urb->status; int status = urb->status;
if (status) { if (status) {
...@@ -747,14 +740,8 @@ static void edge_bulk_out_data_callback(struct urb *urb) ...@@ -747,14 +740,8 @@ static void edge_bulk_out_data_callback(struct urb *urb)
__func__, status); __func__, status);
} }
tty = tty_port_tty_get(&edge_port->port->port); if (edge_port->open)
tty_port_tty_wakeup(&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);
/* Release the Write URB */ /* Release the Write URB */
edge_port->write_in_progress = false; edge_port->write_in_progress = false;
...@@ -773,7 +760,6 @@ static void edge_bulk_out_data_callback(struct urb *urb) ...@@ -773,7 +760,6 @@ static void edge_bulk_out_data_callback(struct urb *urb)
static void edge_bulk_out_cmd_callback(struct urb *urb) static void edge_bulk_out_cmd_callback(struct urb *urb)
{ {
struct edgeport_port *edge_port = urb->context; struct edgeport_port *edge_port = urb->context;
struct tty_struct *tty;
int status = urb->status; int status = urb->status;
atomic_dec(&CmdUrbs); atomic_dec(&CmdUrbs);
...@@ -794,13 +780,9 @@ static void edge_bulk_out_cmd_callback(struct urb *urb) ...@@ -794,13 +780,9 @@ static void edge_bulk_out_cmd_callback(struct urb *urb)
return; return;
} }
/* Get pointer to tty */
tty = tty_port_tty_get(&edge_port->port->port);
/* tell the tty driver that something has changed */ /* tell the tty driver that something has changed */
if (tty && edge_port->open) if (edge_port->open)
tty_wakeup(tty); tty_port_tty_wakeup(&edge_port->port->port);
tty_kref_put(tty);
/* we have completed the command */ /* we have completed the command */
edge_port->commandPending = false; edge_port->commandPending = false;
......
...@@ -104,10 +104,8 @@ static void keyspan_pda_wakeup_write(struct work_struct *work) ...@@ -104,10 +104,8 @@ static void keyspan_pda_wakeup_write(struct work_struct *work)
struct keyspan_pda_private *priv = struct keyspan_pda_private *priv =
container_of(work, struct keyspan_pda_private, wakeup_work); container_of(work, struct keyspan_pda_private, wakeup_work);
struct usb_serial_port *port = priv->port; struct usb_serial_port *port = priv->port;
struct tty_struct *tty = tty_port_tty_get(&port->port);
if (tty) tty_port_tty_wakeup(&port->port);
tty_wakeup(tty);
tty_kref_put(tty);
} }
static void keyspan_pda_request_unthrottle(struct work_struct *work) static void keyspan_pda_request_unthrottle(struct work_struct *work)
......
...@@ -932,7 +932,6 @@ static void mos7720_bulk_in_callback(struct urb *urb) ...@@ -932,7 +932,6 @@ static void mos7720_bulk_in_callback(struct urb *urb)
static void mos7720_bulk_out_data_callback(struct urb *urb) static void mos7720_bulk_out_data_callback(struct urb *urb)
{ {
struct moschip_port *mos7720_port; struct moschip_port *mos7720_port;
struct tty_struct *tty;
int status = urb->status; int status = urb->status;
if (status) { if (status) {
...@@ -946,11 +945,8 @@ static void mos7720_bulk_out_data_callback(struct urb *urb) ...@@ -946,11 +945,8 @@ static void mos7720_bulk_out_data_callback(struct urb *urb)
return ; return ;
} }
tty = tty_port_tty_get(&mos7720_port->port->port); if (mos7720_port->open)
tty_port_tty_wakeup(&mos7720_port->port->port);
if (tty && mos7720_port->open)
tty_wakeup(tty);
tty_kref_put(tty);
} }
/* /*
......
...@@ -814,7 +814,6 @@ static void mos7840_bulk_out_data_callback(struct urb *urb) ...@@ -814,7 +814,6 @@ static void mos7840_bulk_out_data_callback(struct urb *urb)
{ {
struct moschip_port *mos7840_port; struct moschip_port *mos7840_port;
struct usb_serial_port *port; struct usb_serial_port *port;
struct tty_struct *tty;
int status = urb->status; int status = urb->status;
int i; int i;
...@@ -837,10 +836,8 @@ static void mos7840_bulk_out_data_callback(struct urb *urb) ...@@ -837,10 +836,8 @@ static void mos7840_bulk_out_data_callback(struct urb *urb)
if (mos7840_port_paranoia_check(port, __func__)) if (mos7840_port_paranoia_check(port, __func__))
return; return;
tty = tty_port_tty_get(&port->port); if (mos7840_port->open)
if (tty && mos7840_port->open) tty_port_tty_wakeup(&port->port);
tty_wakeup(tty);
tty_kref_put(tty);
} }
......
...@@ -1227,7 +1227,6 @@ static void ti_send(struct ti_port *tport) ...@@ -1227,7 +1227,6 @@ static void ti_send(struct ti_port *tport)
{ {
int count, result; int count, result;
struct usb_serial_port *port = tport->tp_port; struct usb_serial_port *port = tport->tp_port;
struct tty_struct *tty = tty_port_tty_get(&port->port); /* FIXME */
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&tport->tp_lock, flags); spin_lock_irqsave(&tport->tp_lock, flags);
...@@ -1268,14 +1267,12 @@ static void ti_send(struct ti_port *tport) ...@@ -1268,14 +1267,12 @@ static void ti_send(struct ti_port *tport)
} }
/* more room in the buffer for new writes, wakeup */ /* more room in the buffer for new writes, wakeup */
if (tty) tty_port_tty_wakeup(&port->port);
tty_wakeup(tty);
tty_kref_put(tty);
wake_up_interruptible(&tport->tp_write_wait); wake_up_interruptible(&tport->tp_write_wait);
return; return;
unlock: unlock:
spin_unlock_irqrestore(&tport->tp_lock, flags); spin_unlock_irqrestore(&tport->tp_lock, flags);
tty_kref_put(tty);
return; return;
} }
......
...@@ -541,16 +541,8 @@ static void usb_serial_port_work(struct work_struct *work) ...@@ -541,16 +541,8 @@ static void usb_serial_port_work(struct work_struct *work)
{ {
struct usb_serial_port *port = struct usb_serial_port *port =
container_of(work, struct usb_serial_port, work); container_of(work, struct usb_serial_port, work);
struct tty_struct *tty;
tty = tty_port_tty_get(&port->port); tty_port_tty_wakeup(&port->port);
if (!tty)
return;
dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number);
tty_wakeup(tty);
tty_kref_put(tty);
} }
static void kill_traffic(struct usb_serial_port *port) static void kill_traffic(struct usb_serial_port *port)
......
...@@ -534,6 +534,7 @@ extern int tty_port_carrier_raised(struct tty_port *port); ...@@ -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_raise_dtr_rts(struct tty_port *port);
extern void tty_port_lower_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_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, extern int tty_port_block_til_ready(struct tty_port *port,
struct tty_struct *tty, struct file *filp); struct tty_struct *tty, struct file *filp);
extern int tty_port_close_start(struct tty_port *port, extern int tty_port_close_start(struct tty_port *port,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment