aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2016-04-09 20:53:25 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-04-30 12:26:55 -0400
commitd41861ca19c9e96f12a4f1ebbc8255d00909a232 (patch)
tree4b09c15500d404b0b375469dd673f0bc8fd05f5f /drivers/char
parent80f02d5424301bf4df195d09b1a664f394435851 (diff)
tty: Replace ASYNC_INITIALIZED bit and update atomically
Replace ASYNC_INITIALIZED bit in the tty_port::flags field with TTY_PORT_INITIALIZED bit in the tty_port::iflags field. Introduce helpers tty_port_set_initialized() and tty_port_initialized() to abstract atomic bit ops. Note: the transforms for test_and_set_bit() and test_and_clear_bit() are unnecessary as the state transitions are already mutually exclusive; the tty lock prevents concurrent open/close/hangup. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/pcmcia/synclink_cs.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index bf54f4e23b6f..345ca7c7ea74 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -1272,7 +1272,7 @@ static int startup(MGSLPC_INFO * info, struct tty_struct *tty)
1272 if (debug_level >= DEBUG_LEVEL_INFO) 1272 if (debug_level >= DEBUG_LEVEL_INFO)
1273 printk("%s(%d):startup(%s)\n", __FILE__, __LINE__, info->device_name); 1273 printk("%s(%d):startup(%s)\n", __FILE__, __LINE__, info->device_name);
1274 1274
1275 if (info->port.flags & ASYNC_INITIALIZED) 1275 if (tty_port_initialized(&info->port))
1276 return 0; 1276 return 0;
1277 1277
1278 if (!info->tx_buf) { 1278 if (!info->tx_buf) {
@@ -1311,7 +1311,7 @@ static int startup(MGSLPC_INFO * info, struct tty_struct *tty)
1311 if (tty) 1311 if (tty)
1312 clear_bit(TTY_IO_ERROR, &tty->flags); 1312 clear_bit(TTY_IO_ERROR, &tty->flags);
1313 1313
1314 info->port.flags |= ASYNC_INITIALIZED; 1314 tty_port_set_initialized(&info->port, 1);
1315 1315
1316 return 0; 1316 return 0;
1317} 1317}
@@ -1322,7 +1322,7 @@ static void shutdown(MGSLPC_INFO * info, struct tty_struct *tty)
1322{ 1322{
1323 unsigned long flags; 1323 unsigned long flags;
1324 1324
1325 if (!(info->port.flags & ASYNC_INITIALIZED)) 1325 if (!tty_port_initialized(&info->port))
1326 return; 1326 return;
1327 1327
1328 if (debug_level >= DEBUG_LEVEL_INFO) 1328 if (debug_level >= DEBUG_LEVEL_INFO)
@@ -1361,7 +1361,7 @@ static void shutdown(MGSLPC_INFO * info, struct tty_struct *tty)
1361 if (tty) 1361 if (tty)
1362 set_bit(TTY_IO_ERROR, &tty->flags); 1362 set_bit(TTY_IO_ERROR, &tty->flags);
1363 1363
1364 info->port.flags &= ~ASYNC_INITIALIZED; 1364 tty_port_set_initialized(&info->port, 0);
1365} 1365}
1366 1366
1367static void mgslpc_program_hw(MGSLPC_INFO *info, struct tty_struct *tty) 1367static void mgslpc_program_hw(MGSLPC_INFO *info, struct tty_struct *tty)
@@ -2338,7 +2338,7 @@ static void mgslpc_close(struct tty_struct *tty, struct file * filp)
2338 if (tty_port_close_start(port, tty, filp) == 0) 2338 if (tty_port_close_start(port, tty, filp) == 0)
2339 goto cleanup; 2339 goto cleanup;
2340 2340
2341 if (port->flags & ASYNC_INITIALIZED) 2341 if (tty_port_initialized(port))
2342 mgslpc_wait_until_sent(tty, info->timeout); 2342 mgslpc_wait_until_sent(tty, info->timeout);
2343 2343
2344 mgslpc_flush_buffer(tty); 2344 mgslpc_flush_buffer(tty);
@@ -2371,7 +2371,7 @@ static void mgslpc_wait_until_sent(struct tty_struct *tty, int timeout)
2371 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_wait_until_sent")) 2371 if (mgslpc_paranoia_check(info, tty->name, "mgslpc_wait_until_sent"))
2372 return; 2372 return;
2373 2373
2374 if (!(info->port.flags & ASYNC_INITIALIZED)) 2374 if (!tty_port_initialized(&info->port))
2375 goto exit; 2375 goto exit;
2376 2376
2377 orig_jiffies = jiffies; 2377 orig_jiffies = jiffies;