diff options
author | Jiri Slaby <jslaby@suse.cz> | 2012-03-05 08:52:16 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-03-08 15:27:17 -0500 |
commit | d852256389f1bcf506710ea5de77debde40013b9 (patch) | |
tree | 63235762da2d6ad860a8a281118cd53ced34736f /drivers/tty/amiserial.c | |
parent | 979b6d89766ed573bca6a6e902193c4cad502909 (diff) |
TTY: simserial/amiserial, use one instance of other members
This means:
* close_delay
* closing_wait
* line
* port
* xmit_fifo_size
This actually fixes a bug in amiserial. It initializes one and uses
the other of the close delays. Yes, duplicating structure members is
evil.
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/amiserial.c')
-rw-r--r-- | drivers/tty/amiserial.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c index 8556ca022dbc..5540216e64fd 100644 --- a/drivers/tty/amiserial.c +++ b/drivers/tty/amiserial.c | |||
@@ -723,7 +723,7 @@ static void change_speed(struct async_struct *info, | |||
723 | if (!quot) | 723 | if (!quot) |
724 | quot = baud_base / 9600; | 724 | quot = baud_base / 9600; |
725 | info->quot = quot; | 725 | info->quot = quot; |
726 | info->timeout = ((info->xmit_fifo_size*HZ*bits*quot) / baud_base); | 726 | info->timeout = ((info->state->xmit_fifo_size*HZ*bits*quot) / baud_base); |
727 | info->timeout += HZ/50; /* Add .02 seconds of slop */ | 727 | info->timeout += HZ/50; /* Add .02 seconds of slop */ |
728 | 728 | ||
729 | /* CTS flow control flag and modem status interrupts */ | 729 | /* CTS flow control flag and modem status interrupts */ |
@@ -1425,7 +1425,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp) | |||
1425 | } | 1425 | } |
1426 | if (--state->count < 0) { | 1426 | if (--state->count < 0) { |
1427 | printk("rs_close: bad serial port count for ttys%d: %d\n", | 1427 | printk("rs_close: bad serial port count for ttys%d: %d\n", |
1428 | info->line, state->count); | 1428 | state->line, state->count); |
1429 | state->count = 0; | 1429 | state->count = 0; |
1430 | } | 1430 | } |
1431 | if (state->count) { | 1431 | if (state->count) { |
@@ -1439,8 +1439,8 @@ static void rs_close(struct tty_struct *tty, struct file * filp) | |||
1439 | * the line discipline to only process XON/XOFF characters. | 1439 | * the line discipline to only process XON/XOFF characters. |
1440 | */ | 1440 | */ |
1441 | tty->closing = 1; | 1441 | tty->closing = 1; |
1442 | if (info->closing_wait != ASYNC_CLOSING_WAIT_NONE) | 1442 | if (state->closing_wait != ASYNC_CLOSING_WAIT_NONE) |
1443 | tty_wait_until_sent(tty, info->closing_wait); | 1443 | tty_wait_until_sent(tty, state->closing_wait); |
1444 | /* | 1444 | /* |
1445 | * At this point we stop accepting input. To do this, we | 1445 | * At this point we stop accepting input. To do this, we |
1446 | * disable the receive line status interrupts, and tell the | 1446 | * disable the receive line status interrupts, and tell the |
@@ -1470,8 +1470,8 @@ static void rs_close(struct tty_struct *tty, struct file * filp) | |||
1470 | tty->closing = 0; | 1470 | tty->closing = 0; |
1471 | info->tty = NULL; | 1471 | info->tty = NULL; |
1472 | if (info->blocked_open) { | 1472 | if (info->blocked_open) { |
1473 | if (info->close_delay) { | 1473 | if (state->close_delay) { |
1474 | msleep_interruptible(jiffies_to_msecs(info->close_delay)); | 1474 | msleep_interruptible(jiffies_to_msecs(state->close_delay)); |
1475 | } | 1475 | } |
1476 | wake_up_interruptible(&info->open_wait); | 1476 | wake_up_interruptible(&info->open_wait); |
1477 | } | 1477 | } |
@@ -1492,7 +1492,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout) | |||
1492 | if (serial_paranoia_check(info, tty->name, "rs_wait_until_sent")) | 1492 | if (serial_paranoia_check(info, tty->name, "rs_wait_until_sent")) |
1493 | return; | 1493 | return; |
1494 | 1494 | ||
1495 | if (info->xmit_fifo_size == 0) | 1495 | if (info->state->xmit_fifo_size == 0) |
1496 | return; /* Just in case.... */ | 1496 | return; /* Just in case.... */ |
1497 | 1497 | ||
1498 | orig_jiffies = jiffies; | 1498 | orig_jiffies = jiffies; |
@@ -1505,7 +1505,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout) | |||
1505 | * Note: we have to use pretty tight timings here to satisfy | 1505 | * Note: we have to use pretty tight timings here to satisfy |
1506 | * the NIST-PCTS. | 1506 | * the NIST-PCTS. |
1507 | */ | 1507 | */ |
1508 | char_time = (info->timeout - HZ/50) / info->xmit_fifo_size; | 1508 | char_time = (info->timeout - HZ/50) / info->state->xmit_fifo_size; |
1509 | char_time = char_time / 5; | 1509 | char_time = char_time / 5; |
1510 | if (char_time == 0) | 1510 | if (char_time == 0) |
1511 | char_time = 1; | 1511 | char_time = 1; |
@@ -1700,9 +1700,6 @@ static int get_async_struct(int line, struct async_struct **ret_info) | |||
1700 | init_waitqueue_head(&info->close_wait); | 1700 | init_waitqueue_head(&info->close_wait); |
1701 | init_waitqueue_head(&info->delta_msr_wait); | 1701 | init_waitqueue_head(&info->delta_msr_wait); |
1702 | #endif | 1702 | #endif |
1703 | info->port = sstate->port; | ||
1704 | info->xmit_fifo_size = sstate->xmit_fifo_size; | ||
1705 | info->line = line; | ||
1706 | info->state = sstate; | 1703 | info->state = sstate; |
1707 | if (sstate->info) { | 1704 | if (sstate->info) { |
1708 | kfree(info); | 1705 | kfree(info); |