summaryrefslogtreecommitdiffstats
path: root/drivers/tty/cyclades.c
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2016-04-09 20:53:23 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-04-30 12:26:55 -0400
commit2d68655d15bc99981394f7caa769a14b03cac131 (patch)
treea61f1f9ffe92c21ff69fdd3f09c8f921f0670fcf /drivers/tty/cyclades.c
parent807c8d81f4ec441241cafa3034c58df721fee869 (diff)
tty: Replace ASYNC_CHECK_CD and update atomically
Replace ASYNC_CHECK_CD bit in the tty_port::flags field with TTY_PORT_CHECK_CD bit in the tty_port::iflags field. Introduce helpers tty_port_set_check_carrier() and tty_port_check_carrier() to abstract the atomic bit ops. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/cyclades.c')
-rw-r--r--drivers/tty/cyclades.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
index 1a12776ba24c..9d1e19ba25cb 100644
--- a/drivers/tty/cyclades.c
+++ b/drivers/tty/cyclades.c
@@ -714,7 +714,7 @@ static void cyy_chip_modem(struct cyclades_card *cinfo, int chip,
714 wake_up_interruptible(&info->port.delta_msr_wait); 714 wake_up_interruptible(&info->port.delta_msr_wait);
715 } 715 }
716 716
717 if ((mdm_change & CyDCD) && (info->port.flags & ASYNC_CHECK_CD)) { 717 if ((mdm_change & CyDCD) && tty_port_check_carrier(&info->port)) {
718 if (mdm_status & CyDCD) 718 if (mdm_status & CyDCD)
719 wake_up_interruptible(&info->port.open_wait); 719 wake_up_interruptible(&info->port.open_wait);
720 else 720 else
@@ -1119,7 +1119,7 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo)
1119 case C_CM_MDCD: 1119 case C_CM_MDCD:
1120 info->icount.dcd++; 1120 info->icount.dcd++;
1121 delta_count++; 1121 delta_count++;
1122 if (info->port.flags & ASYNC_CHECK_CD) { 1122 if (tty_port_check_carrier(&info->port)) {
1123 u32 dcd = fw_ver > 241 ? param : 1123 u32 dcd = fw_ver > 241 ? param :
1124 readl(&info->u.cyz.ch_ctrl->rs_status); 1124 readl(&info->u.cyz.ch_ctrl->rs_status);
1125 if (dcd & C_RS_DCD) 1125 if (dcd & C_RS_DCD)
@@ -2088,10 +2088,7 @@ static void cy_set_line_char(struct cyclades_port *info, struct tty_struct *tty)
2088 info->cor2 |= CyCtsAE; 2088 info->cor2 |= CyCtsAE;
2089 else 2089 else
2090 info->cor2 &= ~CyCtsAE; 2090 info->cor2 &= ~CyCtsAE;
2091 if (cflag & CLOCAL) 2091 tty_port_set_check_carrier(&info->port, ~cflag & CLOCAL);
2092 info->port.flags &= ~ASYNC_CHECK_CD;
2093 else
2094 info->port.flags |= ASYNC_CHECK_CD;
2095 2092
2096 /*********************************************** 2093 /***********************************************
2097 The hardware option, CyRtsAO, presents RTS when 2094 The hardware option, CyRtsAO, presents RTS when
@@ -2250,10 +2247,7 @@ static void cy_set_line_char(struct cyclades_port *info, struct tty_struct *tty)
2250 } 2247 }
2251 2248
2252 /* CD sensitivity */ 2249 /* CD sensitivity */
2253 if (cflag & CLOCAL) 2250 tty_port_set_check_carrier(&info->port, ~cflag & CLOCAL);
2254 info->port.flags &= ~ASYNC_CHECK_CD;
2255 else
2256 info->port.flags |= ASYNC_CHECK_CD;
2257 2251
2258 if (baud == 0) { /* baud rate is zero, turn off line */ 2252 if (baud == 0) { /* baud rate is zero, turn off line */
2259 cy_writel(&ch_ctrl->rs_control, 2253 cy_writel(&ch_ctrl->rs_control,