diff options
author | Huang Shijie <shijie8@gmail.com> | 2012-08-22 22:13:36 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-05 16:28:35 -0400 |
commit | f21ec3d2d46e5f2ffc06f31fe2704fdcea7a58f3 (patch) | |
tree | 5d814cd687776374f960d3af2490187c3fbdf750 /drivers/tty | |
parent | e5b57c037a656c694c7f3674f96352297a6ee7d8 (diff) |
serial: add a new helper function
In most of the time, the driver needs to check if the cts flow control
is enabled. But now, the driver checks the ASYNC_CTS_FLOW flag manually,
which is not a grace way. So add a new wraper function to make the code
tidy and clean.
Signed-off-by: Huang Shijie <shijie8@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/amiserial.c | 2 | ||||
-rw-r--r-- | drivers/tty/cyclades.c | 2 | ||||
-rw-r--r-- | drivers/tty/isicom.c | 2 | ||||
-rw-r--r-- | drivers/tty/mxser.c | 2 | ||||
-rw-r--r-- | drivers/tty/serial/mxs-auart.c | 2 | ||||
-rw-r--r-- | drivers/tty/serial/serial_core.c | 4 | ||||
-rw-r--r-- | drivers/tty/synclink.c | 2 | ||||
-rw-r--r-- | drivers/tty/synclink_gt.c | 2 | ||||
-rw-r--r-- | drivers/tty/synclinkmp.c | 2 |
9 files changed, 10 insertions, 10 deletions
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c index 2b7535d42e05..42d0a2581a87 100644 --- a/drivers/tty/amiserial.c +++ b/drivers/tty/amiserial.c | |||
@@ -420,7 +420,7 @@ static void check_modem_status(struct serial_state *info) | |||
420 | tty_hangup(port->tty); | 420 | tty_hangup(port->tty); |
421 | } | 421 | } |
422 | } | 422 | } |
423 | if (port->flags & ASYNC_CTS_FLOW) { | 423 | if (tty_port_cts_enabled(port)) { |
424 | if (port->tty->hw_stopped) { | 424 | if (port->tty->hw_stopped) { |
425 | if (!(status & SER_CTS)) { | 425 | if (!(status & SER_CTS)) { |
426 | #if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW)) | 426 | #if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW)) |
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c index e3954dae5064..0a6a0bc1b598 100644 --- a/drivers/tty/cyclades.c +++ b/drivers/tty/cyclades.c | |||
@@ -727,7 +727,7 @@ static void cyy_chip_modem(struct cyclades_card *cinfo, int chip, | |||
727 | else | 727 | else |
728 | tty_hangup(tty); | 728 | tty_hangup(tty); |
729 | } | 729 | } |
730 | if ((mdm_change & CyCTS) && (info->port.flags & ASYNC_CTS_FLOW)) { | 730 | if ((mdm_change & CyCTS) && tty_port_cts_enabled(&info->port)) { |
731 | if (tty->hw_stopped) { | 731 | if (tty->hw_stopped) { |
732 | if (mdm_status & CyCTS) { | 732 | if (mdm_status & CyCTS) { |
733 | /* cy_start isn't used | 733 | /* cy_start isn't used |
diff --git a/drivers/tty/isicom.c b/drivers/tty/isicom.c index 99cf22e5f2b6..d7492e183607 100644 --- a/drivers/tty/isicom.c +++ b/drivers/tty/isicom.c | |||
@@ -600,7 +600,7 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id) | |||
600 | port->status &= ~ISI_DCD; | 600 | port->status &= ~ISI_DCD; |
601 | } | 601 | } |
602 | 602 | ||
603 | if (port->port.flags & ASYNC_CTS_FLOW) { | 603 | if (tty_port_cts_enabled(&port->port)) { |
604 | if (tty->hw_stopped) { | 604 | if (tty->hw_stopped) { |
605 | if (header & ISI_CTS) { | 605 | if (header & ISI_CTS) { |
606 | port->port.tty->hw_stopped = 0; | 606 | port->port.tty->hw_stopped = 0; |
diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index bb2da4ca8257..cfda47dabd28 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c | |||
@@ -830,7 +830,7 @@ static void mxser_check_modem_status(struct tty_struct *tty, | |||
830 | wake_up_interruptible(&port->port.open_wait); | 830 | wake_up_interruptible(&port->port.open_wait); |
831 | } | 831 | } |
832 | 832 | ||
833 | if (port->port.flags & ASYNC_CTS_FLOW) { | 833 | if (tty_port_cts_enabled(&port->port)) { |
834 | if (tty->hw_stopped) { | 834 | if (tty->hw_stopped) { |
835 | if (status & UART_MSR_CTS) { | 835 | if (status & UART_MSR_CTS) { |
836 | tty->hw_stopped = 0; | 836 | tty->hw_stopped = 0; |
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c index 3a667eed63d6..dafeef2bfb49 100644 --- a/drivers/tty/serial/mxs-auart.c +++ b/drivers/tty/serial/mxs-auart.c | |||
@@ -262,7 +262,7 @@ static void mxs_auart_set_mctrl(struct uart_port *u, unsigned mctrl) | |||
262 | 262 | ||
263 | ctrl &= ~AUART_CTRL2_RTSEN; | 263 | ctrl &= ~AUART_CTRL2_RTSEN; |
264 | if (mctrl & TIOCM_RTS) { | 264 | if (mctrl & TIOCM_RTS) { |
265 | if (u->state->port.flags & ASYNC_CTS_FLOW) | 265 | if (tty_port_cts_enabled(&u->state->port)) |
266 | ctrl |= AUART_CTRL2_RTSEN; | 266 | ctrl |= AUART_CTRL2_RTSEN; |
267 | } | 267 | } |
268 | 268 | ||
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index bb5f23603836..137b25ce39a7 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c | |||
@@ -176,7 +176,7 @@ static int uart_port_startup(struct tty_struct *tty, struct uart_state *state, | |||
176 | uart_set_mctrl(uport, TIOCM_RTS | TIOCM_DTR); | 176 | uart_set_mctrl(uport, TIOCM_RTS | TIOCM_DTR); |
177 | } | 177 | } |
178 | 178 | ||
179 | if (port->flags & ASYNC_CTS_FLOW) { | 179 | if (tty_port_cts_enabled(port)) { |
180 | spin_lock_irq(&uport->lock); | 180 | spin_lock_irq(&uport->lock); |
181 | if (!(uport->ops->get_mctrl(uport) & TIOCM_CTS)) | 181 | if (!(uport->ops->get_mctrl(uport) & TIOCM_CTS)) |
182 | tty->hw_stopped = 1; | 182 | tty->hw_stopped = 1; |
@@ -2509,7 +2509,7 @@ void uart_handle_cts_change(struct uart_port *uport, unsigned int status) | |||
2509 | 2509 | ||
2510 | uport->icount.cts++; | 2510 | uport->icount.cts++; |
2511 | 2511 | ||
2512 | if (port->flags & ASYNC_CTS_FLOW) { | 2512 | if (tty_port_cts_enabled(port)) { |
2513 | if (tty->hw_stopped) { | 2513 | if (tty->hw_stopped) { |
2514 | if (status) { | 2514 | if (status) { |
2515 | tty->hw_stopped = 0; | 2515 | tty->hw_stopped = 0; |
diff --git a/drivers/tty/synclink.c b/drivers/tty/synclink.c index 666aa1455fc7..70e3a525bc82 100644 --- a/drivers/tty/synclink.c +++ b/drivers/tty/synclink.c | |||
@@ -1359,7 +1359,7 @@ static void mgsl_isr_io_pin( struct mgsl_struct *info ) | |||
1359 | } | 1359 | } |
1360 | } | 1360 | } |
1361 | 1361 | ||
1362 | if ( (info->port.flags & ASYNC_CTS_FLOW) && | 1362 | if (tty_port_cts_enabled(&info->port) && |
1363 | (status & MISCSTATUS_CTS_LATCHED) ) { | 1363 | (status & MISCSTATUS_CTS_LATCHED) ) { |
1364 | if (info->port.tty->hw_stopped) { | 1364 | if (info->port.tty->hw_stopped) { |
1365 | if (status & MISCSTATUS_CTS) { | 1365 | if (status & MISCSTATUS_CTS) { |
diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c index 45f6136f4e51..b38e954eedd3 100644 --- a/drivers/tty/synclink_gt.c +++ b/drivers/tty/synclink_gt.c | |||
@@ -2053,7 +2053,7 @@ static void cts_change(struct slgt_info *info, unsigned short status) | |||
2053 | wake_up_interruptible(&info->event_wait_q); | 2053 | wake_up_interruptible(&info->event_wait_q); |
2054 | info->pending_bh |= BH_STATUS; | 2054 | info->pending_bh |= BH_STATUS; |
2055 | 2055 | ||
2056 | if (info->port.flags & ASYNC_CTS_FLOW) { | 2056 | if (tty_port_cts_enabled(&info->port)) { |
2057 | if (info->port.tty) { | 2057 | if (info->port.tty) { |
2058 | if (info->port.tty->hw_stopped) { | 2058 | if (info->port.tty->hw_stopped) { |
2059 | if (info->signals & SerialSignal_CTS) { | 2059 | if (info->signals & SerialSignal_CTS) { |
diff --git a/drivers/tty/synclinkmp.c b/drivers/tty/synclinkmp.c index 53429c890a89..f17d9f3d84a2 100644 --- a/drivers/tty/synclinkmp.c +++ b/drivers/tty/synclinkmp.c | |||
@@ -2500,7 +2500,7 @@ static void isr_io_pin( SLMP_INFO *info, u16 status ) | |||
2500 | } | 2500 | } |
2501 | } | 2501 | } |
2502 | 2502 | ||
2503 | if ( (info->port.flags & ASYNC_CTS_FLOW) && | 2503 | if (tty_port_cts_enabled(&info->port) && |
2504 | (status & MISCSTATUS_CTS_LATCHED) ) { | 2504 | (status & MISCSTATUS_CTS_LATCHED) ) { |
2505 | if ( info->port.tty ) { | 2505 | if ( info->port.tty ) { |
2506 | if (info->port.tty->hw_stopped) { | 2506 | if (info->port.tty->hw_stopped) { |