aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/digi_acceleport.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2013-03-07 07:12:29 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-18 19:19:45 -0400
commit6aad04f21374633bd8cecf25024553d1e11a9522 (patch)
tree9e3351e53b68d158b436a737049cbe2ee01ff126 /drivers/usb/serial/digi_acceleport.c
parent6982a398426a22166eaf049b79544536fdd6429f (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/usb/serial/digi_acceleport.c')
-rw-r--r--drivers/usb/serial/digi_acceleport.c17
1 files changed, 3 insertions, 14 deletions
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
213static void digi_wakeup_write(struct usb_serial_port *port);
214static void digi_wakeup_write_lock(struct work_struct *work); 213static void digi_wakeup_write_lock(struct work_struct *work);
215static int digi_write_oob_command(struct usb_serial_port *port, 214static 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
381static 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;