aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial
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/tty/serial
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/tty/serial')
-rw-r--r--drivers/tty/serial/ifx6x60.c33
1 files changed, 2 insertions, 31 deletions
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 */
453static 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,
683static void ifx_spi_complete(void *ctx) 664static 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}