diff options
author | Jiri Slaby <jslaby@suse.cz> | 2012-03-05 08:52:26 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-03-08 15:30:51 -0500 |
commit | 12c8035435fa16e3f6b18049bb1d7815c00a7a58 (patch) | |
tree | 4777a85e7f4902bc37b1ace6d26e11d2ec43fb1b /drivers/tty | |
parent | 799be6ff2fd7294f428a9e68a7786490c862c1af (diff) |
TTY: amiserial/simserial, use count from tty_port
Nothing special. Just remove count from serial_state and change all
users to use tty_port.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/amiserial.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c index 06e3a0990c8b..8ad64a0f1251 100644 --- a/drivers/tty/amiserial.c +++ b/drivers/tty/amiserial.c | |||
@@ -1383,26 +1383,26 @@ static void rs_close(struct tty_struct *tty, struct file * filp) | |||
1383 | } | 1383 | } |
1384 | 1384 | ||
1385 | #ifdef SERIAL_DEBUG_OPEN | 1385 | #ifdef SERIAL_DEBUG_OPEN |
1386 | printk("rs_close ttys%d, count = %d\n", state->line, state->count); | 1386 | printk("rs_close ttys%d, count = %d\n", state->line, state->tport.count); |
1387 | #endif | 1387 | #endif |
1388 | if ((tty->count == 1) && (state->count != 1)) { | 1388 | if ((tty->count == 1) && (state->tport.count != 1)) { |
1389 | /* | 1389 | /* |
1390 | * Uh, oh. tty->count is 1, which means that the tty | 1390 | * Uh, oh. tty->count is 1, which means that the tty |
1391 | * structure will be freed. state->count should always | 1391 | * structure will be freed. state->tport.count should always |
1392 | * be one in these conditions. If it's greater than | 1392 | * be one in these conditions. If it's greater than |
1393 | * one, we've got real problems, since it means the | 1393 | * one, we've got real problems, since it means the |
1394 | * serial port won't be shutdown. | 1394 | * serial port won't be shutdown. |
1395 | */ | 1395 | */ |
1396 | printk("rs_close: bad serial port count; tty->count is 1, " | 1396 | printk("rs_close: bad serial port count; tty->count is 1, " |
1397 | "state->count is %d\n", state->count); | 1397 | "state->tport.count is %d\n", state->tport.count); |
1398 | state->count = 1; | 1398 | state->tport.count = 1; |
1399 | } | 1399 | } |
1400 | if (--state->count < 0) { | 1400 | if (--state->tport.count < 0) { |
1401 | printk("rs_close: bad serial port count for ttys%d: %d\n", | 1401 | printk("rs_close: bad serial port count for ttys%d: %d\n", |
1402 | state->line, state->count); | 1402 | state->line, state->tport.count); |
1403 | state->count = 0; | 1403 | state->tport.count = 0; |
1404 | } | 1404 | } |
1405 | if (state->count) { | 1405 | if (state->tport.count) { |
1406 | DBG_CNT("before DEC-2"); | 1406 | DBG_CNT("before DEC-2"); |
1407 | local_irq_restore(flags); | 1407 | local_irq_restore(flags); |
1408 | return; | 1408 | return; |
@@ -1529,7 +1529,7 @@ static void rs_hangup(struct tty_struct *tty) | |||
1529 | 1529 | ||
1530 | rs_flush_buffer(tty); | 1530 | rs_flush_buffer(tty); |
1531 | shutdown(tty, info); | 1531 | shutdown(tty, info); |
1532 | info->count = 0; | 1532 | info->tport.count = 0; |
1533 | info->flags &= ~ASYNC_NORMAL_ACTIVE; | 1533 | info->flags &= ~ASYNC_NORMAL_ACTIVE; |
1534 | info->tport.tty = NULL; | 1534 | info->tport.tty = NULL; |
1535 | wake_up_interruptible(&info->tport.open_wait); | 1535 | wake_up_interruptible(&info->tport.open_wait); |
@@ -1584,7 +1584,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
1584 | /* | 1584 | /* |
1585 | * Block waiting for the carrier detect and the line to become | 1585 | * Block waiting for the carrier detect and the line to become |
1586 | * free (i.e., not in use by the callout). While we are in | 1586 | * free (i.e., not in use by the callout). While we are in |
1587 | * this loop, info->count is dropped by one, so that | 1587 | * this loop, info->tport.count is dropped by one, so that |
1588 | * rs_close() knows when to free things. We restore it upon | 1588 | * rs_close() knows when to free things. We restore it upon |
1589 | * exit, either normal or abnormal. | 1589 | * exit, either normal or abnormal. |
1590 | */ | 1590 | */ |
@@ -1592,12 +1592,12 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
1592 | add_wait_queue(&info->tport.open_wait, &wait); | 1592 | add_wait_queue(&info->tport.open_wait, &wait); |
1593 | #ifdef SERIAL_DEBUG_OPEN | 1593 | #ifdef SERIAL_DEBUG_OPEN |
1594 | printk("block_til_ready before block: ttys%d, count = %d\n", | 1594 | printk("block_til_ready before block: ttys%d, count = %d\n", |
1595 | info->line, info->count); | 1595 | info->line, info->tport.count); |
1596 | #endif | 1596 | #endif |
1597 | local_irq_save(flags); | 1597 | local_irq_save(flags); |
1598 | if (!tty_hung_up_p(filp)) { | 1598 | if (!tty_hung_up_p(filp)) { |
1599 | extra_count = 1; | 1599 | extra_count = 1; |
1600 | info->count--; | 1600 | info->tport.count--; |
1601 | } | 1601 | } |
1602 | local_irq_restore(flags); | 1602 | local_irq_restore(flags); |
1603 | info->tport.blocked_open++; | 1603 | info->tport.blocked_open++; |
@@ -1628,7 +1628,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
1628 | } | 1628 | } |
1629 | #ifdef SERIAL_DEBUG_OPEN | 1629 | #ifdef SERIAL_DEBUG_OPEN |
1630 | printk("block_til_ready blocking: ttys%d, count = %d\n", | 1630 | printk("block_til_ready blocking: ttys%d, count = %d\n", |
1631 | info->line, info->count); | 1631 | info->line, info->tport.count); |
1632 | #endif | 1632 | #endif |
1633 | tty_unlock(); | 1633 | tty_unlock(); |
1634 | schedule(); | 1634 | schedule(); |
@@ -1637,11 +1637,11 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, | |||
1637 | __set_current_state(TASK_RUNNING); | 1637 | __set_current_state(TASK_RUNNING); |
1638 | remove_wait_queue(&info->tport.open_wait, &wait); | 1638 | remove_wait_queue(&info->tport.open_wait, &wait); |
1639 | if (extra_count) | 1639 | if (extra_count) |
1640 | info->count++; | 1640 | info->tport.count++; |
1641 | info->tport.blocked_open--; | 1641 | info->tport.blocked_open--; |
1642 | #ifdef SERIAL_DEBUG_OPEN | 1642 | #ifdef SERIAL_DEBUG_OPEN |
1643 | printk("block_til_ready after blocking: ttys%d, count = %d\n", | 1643 | printk("block_til_ready after blocking: ttys%d, count = %d\n", |
1644 | info->line, info->count); | 1644 | info->line, info->tport.count); |
1645 | #endif | 1645 | #endif |
1646 | if (retval) | 1646 | if (retval) |
1647 | return retval; | 1647 | return retval; |
@@ -1660,7 +1660,7 @@ static int rs_open(struct tty_struct *tty, struct file * filp) | |||
1660 | struct serial_state *info = rs_table + tty->index; | 1660 | struct serial_state *info = rs_table + tty->index; |
1661 | int retval; | 1661 | int retval; |
1662 | 1662 | ||
1663 | info->count++; | 1663 | info->tport.count++; |
1664 | info->tport.tty = tty; | 1664 | info->tport.tty = tty; |
1665 | tty->driver_data = info; | 1665 | tty->driver_data = info; |
1666 | tty->port = &info->tport; | 1666 | tty->port = &info->tport; |