Skip to content

Commit f21ec3d

Browse files
zyziigregkh
authored andcommitted
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>
1 parent e5b57c0 commit f21ec3d

13 files changed

Lines changed: 20 additions & 14 deletions

File tree

‎drivers/char/pcmcia/synclink_cs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ static void cts_change(MGSLPC_INFO *info, struct tty_struct *tty)
10501050
wake_up_interruptible(&info->status_event_wait_q);
10511051
wake_up_interruptible(&info->event_wait_q);
10521052

1053-
if (info->port.flags & ASYNC_CTS_FLOW) {
1053+
if (tty_port_cts_enabled(&info->port)) {
10541054
if (tty->hw_stopped) {
10551055
if (info->serial_signals & SerialSignal_CTS) {
10561056
if (debug_level >= DEBUG_LEVEL_ISR)

‎drivers/tty/amiserial.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ static void check_modem_status(struct serial_state *info)
420420
tty_hangup(port->tty);
421421
}
422422
}
423-
if (port->flags & ASYNC_CTS_FLOW) {
423+
if (tty_port_cts_enabled(port)) {
424424
if (port->tty->hw_stopped) {
425425
if (!(status & SER_CTS)) {
426426
#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW))

‎drivers/tty/cyclades.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ static void cyy_chip_modem(struct cyclades_card *cinfo, int chip,
727727
else
728728
tty_hangup(tty);
729729
}
730-
if ((mdm_change & CyCTS) && (info->port.flags & ASYNC_CTS_FLOW)) {
730+
if ((mdm_change & CyCTS) && tty_port_cts_enabled(&info->port)) {
731731
if (tty->hw_stopped) {
732732
if (mdm_status & CyCTS) {
733733
/* cy_start isn't used

‎drivers/tty/isicom.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id)
600600
port->status &= ~ISI_DCD;
601601
}
602602

603-
if (port->port.flags & ASYNC_CTS_FLOW) {
603+
if (tty_port_cts_enabled(&port->port)) {
604604
if (tty->hw_stopped) {
605605
if (header & ISI_CTS) {
606606
port->port.tty->hw_stopped = 0;

‎drivers/tty/mxser.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ static void mxser_check_modem_status(struct tty_struct *tty,
830830
wake_up_interruptible(&port->port.open_wait);
831831
}
832832

833-
if (port->port.flags & ASYNC_CTS_FLOW) {
833+
if (tty_port_cts_enabled(&port->port)) {
834834
if (tty->hw_stopped) {
835835
if (status & UART_MSR_CTS) {
836836
tty->hw_stopped = 0;

‎drivers/tty/serial/mxs-auart.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ static void mxs_auart_set_mctrl(struct uart_port *u, unsigned mctrl)
262262

263263
ctrl &= ~AUART_CTRL2_RTSEN;
264264
if (mctrl & TIOCM_RTS) {
265-
if (u->state->port.flags & ASYNC_CTS_FLOW)
265+
if (tty_port_cts_enabled(&u->state->port))
266266
ctrl |= AUART_CTRL2_RTSEN;
267267
}
268268

‎drivers/tty/serial/serial_core.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ static int uart_port_startup(struct tty_struct *tty, struct uart_state *state,
176176
uart_set_mctrl(uport, TIOCM_RTS | TIOCM_DTR);
177177
}
178178

179-
if (port->flags & ASYNC_CTS_FLOW) {
179+
if (tty_port_cts_enabled(port)) {
180180
spin_lock_irq(&uport->lock);
181181
if (!(uport->ops->get_mctrl(uport) & TIOCM_CTS))
182182
tty->hw_stopped = 1;
@@ -2509,7 +2509,7 @@ void uart_handle_cts_change(struct uart_port *uport, unsigned int status)
25092509

25102510
uport->icount.cts++;
25112511

2512-
if (port->flags & ASYNC_CTS_FLOW) {
2512+
if (tty_port_cts_enabled(port)) {
25132513
if (tty->hw_stopped) {
25142514
if (status) {
25152515
tty->hw_stopped = 0;

‎drivers/tty/synclink.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1359,7 +1359,7 @@ static void mgsl_isr_io_pin( struct mgsl_struct *info )
13591359
}
13601360
}
13611361

1362-
if ( (info->port.flags & ASYNC_CTS_FLOW) &&
1362+
if (tty_port_cts_enabled(&info->port) &&
13631363
(status & MISCSTATUS_CTS_LATCHED) ) {
13641364
if (info->port.tty->hw_stopped) {
13651365
if (status & MISCSTATUS_CTS) {

‎drivers/tty/synclink_gt.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2053,7 +2053,7 @@ static void cts_change(struct slgt_info *info, unsigned short status)
20532053
wake_up_interruptible(&info->event_wait_q);
20542054
info->pending_bh |= BH_STATUS;
20552055

2056-
if (info->port.flags & ASYNC_CTS_FLOW) {
2056+
if (tty_port_cts_enabled(&info->port)) {
20572057
if (info->port.tty) {
20582058
if (info->port.tty->hw_stopped) {
20592059
if (info->signals & SerialSignal_CTS) {

‎drivers/tty/synclinkmp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2500,7 +2500,7 @@ static void isr_io_pin( SLMP_INFO *info, u16 status )
25002500
}
25012501
}
25022502

2503-
if ( (info->port.flags & ASYNC_CTS_FLOW) &&
2503+
if (tty_port_cts_enabled(&info->port) &&
25042504
(status & MISCSTATUS_CTS_LATCHED) ) {
25052505
if ( info->port.tty ) {
25062506
if (info->port.tty->hw_stopped) {

0 commit comments

Comments
 (0)