aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2012-03-05 08:52:26 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-08 15:30:51 -0500
commit12c8035435fa16e3f6b18049bb1d7815c00a7a58 (patch)
tree4777a85e7f4902bc37b1ace6d26e11d2ec43fb1b
parent799be6ff2fd7294f428a9e68a7786490c862c1af (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>
-rw-r--r--arch/ia64/hp/sim/simserial.c24
-rw-r--r--drivers/tty/amiserial.c34
-rw-r--r--include/linux/serialP.h1
3 files changed, 29 insertions, 30 deletions
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c
index fb324b345e8..baa2b1ec00a 100644
--- a/arch/ia64/hp/sim/simserial.c
+++ b/arch/ia64/hp/sim/simserial.c
@@ -500,26 +500,26 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
500 return; 500 return;
501 } 501 }
502#ifdef SIMSERIAL_DEBUG 502#ifdef SIMSERIAL_DEBUG
503 printk("rs_close ttys%d, count = %d\n", info->line, info->count); 503 printk("rs_close ttys%d, count = %d\n", info->line, info->tport.count);
504#endif 504#endif
505 if ((tty->count == 1) && (info->count != 1)) { 505 if ((tty->count == 1) && (info->tport.count != 1)) {
506 /* 506 /*
507 * Uh, oh. tty->count is 1, which means that the tty 507 * Uh, oh. tty->count is 1, which means that the tty
508 * structure will be freed. info->count should always 508 * structure will be freed. info->tport.count should always
509 * be one in these conditions. If it's greater than 509 * be one in these conditions. If it's greater than
510 * one, we've got real problems, since it means the 510 * one, we've got real problems, since it means the
511 * serial port won't be shutdown. 511 * serial port won't be shutdown.
512 */ 512 */
513 printk(KERN_ERR "rs_close: bad serial port count; tty->count is 1, " 513 printk(KERN_ERR "rs_close: bad serial port count; tty->count is 1, "
514 "info->count is %d\n", info->count); 514 "info->tport.count is %d\n", info->tport.count);
515 info->count = 1; 515 info->tport.count = 1;
516 } 516 }
517 if (--info->count < 0) { 517 if (--info->tport.count < 0) {
518 printk(KERN_ERR "rs_close: bad serial port count for ttys%d: %d\n", 518 printk(KERN_ERR "rs_close: bad serial port count for ttys%d: %d\n",
519 info->line, info->count); 519 info->line, info->tport.count);
520 info->count = 0; 520 info->tport.count = 0;
521 } 521 }
522 if (info->count) { 522 if (info->tport.count) {
523 local_irq_restore(flags); 523 local_irq_restore(flags);
524 return; 524 return;
525 } 525 }
@@ -567,7 +567,7 @@ static void rs_hangup(struct tty_struct *tty)
567 return; 567 return;
568 shutdown(tty, info); 568 shutdown(tty, info);
569 569
570 info->count = 0; 570 info->tport.count = 0;
571 info->flags &= ~ASYNC_NORMAL_ACTIVE; 571 info->flags &= ~ASYNC_NORMAL_ACTIVE;
572 info->tport.tty = NULL; 572 info->tport.tty = NULL;
573 wake_up_interruptible(&info->tport.open_wait); 573 wake_up_interruptible(&info->tport.open_wait);
@@ -661,13 +661,13 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
661 int retval; 661 int retval;
662 unsigned long page; 662 unsigned long page;
663 663
664 info->count++; 664 info->tport.count++;
665 info->tport.tty = tty; 665 info->tport.tty = tty;
666 tty->driver_data = info; 666 tty->driver_data = info;
667 tty->port = &info->tport; 667 tty->port = &info->tport;
668 668
669#ifdef SIMSERIAL_DEBUG 669#ifdef SIMSERIAL_DEBUG
670 printk("rs_open %s, count = %d\n", tty->name, info->count); 670 printk("rs_open %s, count = %d\n", tty->name, info->tport.count);
671#endif 671#endif
672 tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; 672 tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
673 673
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
index 06e3a0990c8..8ad64a0f125 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;
diff --git a/include/linux/serialP.h b/include/linux/serialP.h
index 997edd008b9..a6612b9c7e8 100644
--- a/include/linux/serialP.h
+++ b/include/linux/serialP.h
@@ -35,7 +35,6 @@ struct serial_state {
35 int line; 35 int line;
36 int xmit_fifo_size; 36 int xmit_fifo_size;
37 int custom_divisor; 37 int custom_divisor;
38 int count;
39 struct async_icount icount; 38 struct async_icount icount;
40 struct tty_port tport; 39 struct tty_port tport;
41 40