aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/amiserial.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2012-03-05 08:52:14 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-08 14:48:43 -0500
commitfef21073af6f826510e41fc367df68383b63e1d2 (patch)
tree4119b21967795c3347e6e58e52588808e050f60b /drivers/tty/amiserial.c
parentc5f0508b992ad081ba378a59b2404966f9f89429 (diff)
TTY: amiserial, use only one copy of async flags
Huh, why would one want to store two copies of them? Get rid of the one from async_struct. That structure is going away as a whole soon. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/amiserial.c')
-rw-r--r--drivers/tty/amiserial.c82
1 files changed, 38 insertions, 44 deletions
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
index d5fac8626988..8556ca022dbc 100644
--- a/drivers/tty/amiserial.c
+++ b/drivers/tty/amiserial.c
@@ -45,7 +45,7 @@
45 45
46#if defined(MODULE) && defined(SERIAL_DEBUG_MCOUNT) 46#if defined(MODULE) && defined(SERIAL_DEBUG_MCOUNT)
47#define DBG_CNT(s) printk("(%s): [%x] refc=%d, serc=%d, ttyc=%d -> %s\n", \ 47#define DBG_CNT(s) printk("(%s): [%x] refc=%d, serc=%d, ttyc=%d -> %s\n", \
48 tty->name, (info->flags), serial_driver->refcount,info->count,tty->count,s) 48 tty->name, (info->state->flags), serial_driver->refcount,info->count,tty->count,s)
49#else 49#else
50#define DBG_CNT(s) 50#define DBG_CNT(s)
51#endif 51#endif
@@ -297,7 +297,7 @@ static void receive_chars(struct async_struct *info)
297 printk("handling break...."); 297 printk("handling break....");
298#endif 298#endif
299 flag = TTY_BREAK; 299 flag = TTY_BREAK;
300 if (info->flags & ASYNC_SAK) 300 if (info->state->flags & ASYNC_SAK)
301 do_SAK(tty); 301 do_SAK(tty);
302 } else if (status & UART_LSR_PE) 302 } else if (status & UART_LSR_PE)
303 flag = TTY_PARITY; 303 flag = TTY_PARITY;
@@ -378,7 +378,7 @@ static void check_modem_status(struct async_struct *info)
378 if (dstatus & SER_DCD) { 378 if (dstatus & SER_DCD) {
379 icount->dcd++; 379 icount->dcd++;
380#ifdef CONFIG_HARD_PPS 380#ifdef CONFIG_HARD_PPS
381 if ((info->flags & ASYNC_HARDPPS_CD) && 381 if ((info->state->flags & ASYNC_HARDPPS_CD) &&
382 !(status & SER_DCD)) 382 !(status & SER_DCD))
383 hardpps(); 383 hardpps();
384#endif 384#endif
@@ -388,7 +388,7 @@ static void check_modem_status(struct async_struct *info)
388 wake_up_interruptible(&info->delta_msr_wait); 388 wake_up_interruptible(&info->delta_msr_wait);
389 } 389 }
390 390
391 if ((info->flags & ASYNC_CHECK_CD) && (dstatus & SER_DCD)) { 391 if ((info->state->flags & ASYNC_CHECK_CD) && (dstatus & SER_DCD)) {
392#if (defined(SERIAL_DEBUG_OPEN) || defined(SERIAL_DEBUG_INTR)) 392#if (defined(SERIAL_DEBUG_OPEN) || defined(SERIAL_DEBUG_INTR))
393 printk("ttyS%d CD now %s...", info->line, 393 printk("ttyS%d CD now %s...", info->line,
394 (!(status & SER_DCD)) ? "on" : "off"); 394 (!(status & SER_DCD)) ? "on" : "off");
@@ -403,7 +403,7 @@ static void check_modem_status(struct async_struct *info)
403 tty_hangup(info->tty); 403 tty_hangup(info->tty);
404 } 404 }
405 } 405 }
406 if (info->flags & ASYNC_CTS_FLOW) { 406 if (info->state->flags & ASYNC_CTS_FLOW) {
407 if (info->tty->hw_stopped) { 407 if (info->tty->hw_stopped) {
408 if (!(status & SER_CTS)) { 408 if (!(status & SER_CTS)) {
409#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW)) 409#if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW))
@@ -516,7 +516,7 @@ static int startup(struct async_struct * info)
516 516
517 local_irq_save(flags); 517 local_irq_save(flags);
518 518
519 if (info->flags & ASYNC_INITIALIZED) { 519 if (info->state->flags & ASYNC_INITIALIZED) {
520 free_page(page); 520 free_page(page);
521 goto errout; 521 goto errout;
522 } 522 }
@@ -569,13 +569,13 @@ static int startup(struct async_struct * info)
569 * Set up the tty->alt_speed kludge 569 * Set up the tty->alt_speed kludge
570 */ 570 */
571 if (info->tty) { 571 if (info->tty) {
572 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 572 if ((info->state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
573 info->tty->alt_speed = 57600; 573 info->tty->alt_speed = 57600;
574 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) 574 if ((info->state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
575 info->tty->alt_speed = 115200; 575 info->tty->alt_speed = 115200;
576 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) 576 if ((info->state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
577 info->tty->alt_speed = 230400; 577 info->tty->alt_speed = 230400;
578 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) 578 if ((info->state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
579 info->tty->alt_speed = 460800; 579 info->tty->alt_speed = 460800;
580 } 580 }
581 581
@@ -584,7 +584,7 @@ static int startup(struct async_struct * info)
584 */ 584 */
585 change_speed(info, NULL); 585 change_speed(info, NULL);
586 586
587 info->flags |= ASYNC_INITIALIZED; 587 info->state->flags |= ASYNC_INITIALIZED;
588 local_irq_restore(flags); 588 local_irq_restore(flags);
589 return 0; 589 return 0;
590 590
@@ -602,7 +602,7 @@ static void shutdown(struct async_struct * info)
602 unsigned long flags; 602 unsigned long flags;
603 struct serial_state *state; 603 struct serial_state *state;
604 604
605 if (!(info->flags & ASYNC_INITIALIZED)) 605 if (!(info->state->flags & ASYNC_INITIALIZED))
606 return; 606 return;
607 607
608 state = info->state; 608 state = info->state;
@@ -646,7 +646,7 @@ static void shutdown(struct async_struct * info)
646 if (info->tty) 646 if (info->tty)
647 set_bit(TTY_IO_ERROR, &info->tty->flags); 647 set_bit(TTY_IO_ERROR, &info->tty->flags);
648 648
649 info->flags &= ~ASYNC_INITIALIZED; 649 info->state->flags &= ~ASYNC_INITIALIZED;
650 local_irq_restore(flags); 650 local_irq_restore(flags);
651} 651}
652 652
@@ -691,7 +691,7 @@ static void change_speed(struct async_struct *info,
691 baud = 9600; /* B0 transition handled in rs_set_termios */ 691 baud = 9600; /* B0 transition handled in rs_set_termios */
692 baud_base = info->state->baud_base; 692 baud_base = info->state->baud_base;
693 if (baud == 38400 && 693 if (baud == 38400 &&
694 ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)) 694 ((info->state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST))
695 quot = info->state->custom_divisor; 695 quot = info->state->custom_divisor;
696 else { 696 else {
697 if (baud == 134) 697 if (baud == 134)
@@ -709,7 +709,7 @@ static void change_speed(struct async_struct *info,
709 if (!baud) 709 if (!baud)
710 baud = 9600; 710 baud = 9600;
711 if (baud == 38400 && 711 if (baud == 38400 &&
712 ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST)) 712 ((info->state->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST))
713 quot = info->state->custom_divisor; 713 quot = info->state->custom_divisor;
714 else { 714 else {
715 if (baud == 134) 715 if (baud == 134)
@@ -728,17 +728,17 @@ static void change_speed(struct async_struct *info,
728 728
729 /* CTS flow control flag and modem status interrupts */ 729 /* CTS flow control flag and modem status interrupts */
730 info->IER &= ~UART_IER_MSI; 730 info->IER &= ~UART_IER_MSI;
731 if (info->flags & ASYNC_HARDPPS_CD) 731 if (info->state->flags & ASYNC_HARDPPS_CD)
732 info->IER |= UART_IER_MSI; 732 info->IER |= UART_IER_MSI;
733 if (cflag & CRTSCTS) { 733 if (cflag & CRTSCTS) {
734 info->flags |= ASYNC_CTS_FLOW; 734 info->state->flags |= ASYNC_CTS_FLOW;
735 info->IER |= UART_IER_MSI; 735 info->IER |= UART_IER_MSI;
736 } else 736 } else
737 info->flags &= ~ASYNC_CTS_FLOW; 737 info->state->flags &= ~ASYNC_CTS_FLOW;
738 if (cflag & CLOCAL) 738 if (cflag & CLOCAL)
739 info->flags &= ~ASYNC_CHECK_CD; 739 info->state->flags &= ~ASYNC_CHECK_CD;
740 else { 740 else {
741 info->flags |= ASYNC_CHECK_CD; 741 info->state->flags |= ASYNC_CHECK_CD;
742 info->IER |= UART_IER_MSI; 742 info->IER |= UART_IER_MSI;
743 } 743 }
744 /* TBD: 744 /* TBD:
@@ -1080,8 +1080,6 @@ static int set_serial_info(struct async_struct * info,
1080 return -EPERM; 1080 return -EPERM;
1081 state->flags = ((state->flags & ~ASYNC_USR_MASK) | 1081 state->flags = ((state->flags & ~ASYNC_USR_MASK) |
1082 (new_serial.flags & ASYNC_USR_MASK)); 1082 (new_serial.flags & ASYNC_USR_MASK));
1083 info->flags = ((info->flags & ~ASYNC_USR_MASK) |
1084 (new_serial.flags & ASYNC_USR_MASK));
1085 state->custom_divisor = new_serial.custom_divisor; 1083 state->custom_divisor = new_serial.custom_divisor;
1086 goto check_and_exit; 1084 goto check_and_exit;
1087 } 1085 }
@@ -1099,15 +1097,13 @@ static int set_serial_info(struct async_struct * info,
1099 state->baud_base = new_serial.baud_base; 1097 state->baud_base = new_serial.baud_base;
1100 state->flags = ((state->flags & ~ASYNC_FLAGS) | 1098 state->flags = ((state->flags & ~ASYNC_FLAGS) |
1101 (new_serial.flags & ASYNC_FLAGS)); 1099 (new_serial.flags & ASYNC_FLAGS));
1102 info->flags = ((state->flags & ~ASYNC_INTERNAL_FLAGS) |
1103 (info->flags & ASYNC_INTERNAL_FLAGS));
1104 state->custom_divisor = new_serial.custom_divisor; 1100 state->custom_divisor = new_serial.custom_divisor;
1105 state->close_delay = new_serial.close_delay * HZ/100; 1101 state->close_delay = new_serial.close_delay * HZ/100;
1106 state->closing_wait = new_serial.closing_wait * HZ/100; 1102 state->closing_wait = new_serial.closing_wait * HZ/100;
1107 info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; 1103 info->tty->low_latency = (state->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
1108 1104
1109check_and_exit: 1105check_and_exit:
1110 if (info->flags & ASYNC_INITIALIZED) { 1106 if (state->flags & ASYNC_INITIALIZED) {
1111 if (((old_state.flags & ASYNC_SPD_MASK) != 1107 if (((old_state.flags & ASYNC_SPD_MASK) !=
1112 (state->flags & ASYNC_SPD_MASK)) || 1108 (state->flags & ASYNC_SPD_MASK)) ||
1113 (old_state.custom_divisor != state->custom_divisor)) { 1109 (old_state.custom_divisor != state->custom_divisor)) {
@@ -1437,7 +1433,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
1437 local_irq_restore(flags); 1433 local_irq_restore(flags);
1438 return; 1434 return;
1439 } 1435 }
1440 info->flags |= ASYNC_CLOSING; 1436 state->flags |= ASYNC_CLOSING;
1441 /* 1437 /*
1442 * Now we wait for the transmit buffer to clear; and we notify 1438 * Now we wait for the transmit buffer to clear; and we notify
1443 * the line discipline to only process XON/XOFF characters. 1439 * the line discipline to only process XON/XOFF characters.
@@ -1452,7 +1448,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
1452 * line status register. 1448 * line status register.
1453 */ 1449 */
1454 info->read_status_mask &= ~UART_LSR_DR; 1450 info->read_status_mask &= ~UART_LSR_DR;
1455 if (info->flags & ASYNC_INITIALIZED) { 1451 if (state->flags & ASYNC_INITIALIZED) {
1456 /* disable receive interrupts */ 1452 /* disable receive interrupts */
1457 custom.intena = IF_RBF; 1453 custom.intena = IF_RBF;
1458 mb(); 1454 mb();
@@ -1479,7 +1475,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
1479 } 1475 }
1480 wake_up_interruptible(&info->open_wait); 1476 wake_up_interruptible(&info->open_wait);
1481 } 1477 }
1482 info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); 1478 state->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
1483 wake_up_interruptible(&info->close_wait); 1479 wake_up_interruptible(&info->close_wait);
1484 local_irq_restore(flags); 1480 local_irq_restore(flags);
1485} 1481}
@@ -1563,7 +1559,7 @@ static void rs_hangup(struct tty_struct *tty)
1563 rs_flush_buffer(tty); 1559 rs_flush_buffer(tty);
1564 shutdown(info); 1560 shutdown(info);
1565 state->count = 0; 1561 state->count = 0;
1566 info->flags &= ~ASYNC_NORMAL_ACTIVE; 1562 state->flags &= ~ASYNC_NORMAL_ACTIVE;
1567 info->tty = NULL; 1563 info->tty = NULL;
1568 wake_up_interruptible(&info->open_wait); 1564 wake_up_interruptible(&info->open_wait);
1569} 1565}
@@ -1591,11 +1587,11 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
1591 * until it's done, and then try again. 1587 * until it's done, and then try again.
1592 */ 1588 */
1593 if (tty_hung_up_p(filp) || 1589 if (tty_hung_up_p(filp) ||
1594 (info->flags & ASYNC_CLOSING)) { 1590 (state->flags & ASYNC_CLOSING)) {
1595 if (info->flags & ASYNC_CLOSING) 1591 if (state->flags & ASYNC_CLOSING)
1596 interruptible_sleep_on(&info->close_wait); 1592 interruptible_sleep_on(&info->close_wait);
1597#ifdef SERIAL_DO_RESTART 1593#ifdef SERIAL_DO_RESTART
1598 return ((info->flags & ASYNC_HUP_NOTIFY) ? 1594 return ((state->flags & ASYNC_HUP_NOTIFY) ?
1599 -EAGAIN : -ERESTARTSYS); 1595 -EAGAIN : -ERESTARTSYS);
1600#else 1596#else
1601 return -EAGAIN; 1597 return -EAGAIN;
@@ -1608,7 +1604,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
1608 */ 1604 */
1609 if ((filp->f_flags & O_NONBLOCK) || 1605 if ((filp->f_flags & O_NONBLOCK) ||
1610 (tty->flags & (1 << TTY_IO_ERROR))) { 1606 (tty->flags & (1 << TTY_IO_ERROR))) {
1611 info->flags |= ASYNC_NORMAL_ACTIVE; 1607 state->flags |= ASYNC_NORMAL_ACTIVE;
1612 return 0; 1608 return 0;
1613 } 1609 }
1614 1610
@@ -1642,9 +1638,9 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
1642 local_irq_restore(flags); 1638 local_irq_restore(flags);
1643 set_current_state(TASK_INTERRUPTIBLE); 1639 set_current_state(TASK_INTERRUPTIBLE);
1644 if (tty_hung_up_p(filp) || 1640 if (tty_hung_up_p(filp) ||
1645 !(info->flags & ASYNC_INITIALIZED)) { 1641 !(state->flags & ASYNC_INITIALIZED)) {
1646#ifdef SERIAL_DO_RESTART 1642#ifdef SERIAL_DO_RESTART
1647 if (info->flags & ASYNC_HUP_NOTIFY) 1643 if (state->flags & ASYNC_HUP_NOTIFY)
1648 retval = -EAGAIN; 1644 retval = -EAGAIN;
1649 else 1645 else
1650 retval = -ERESTARTSYS; 1646 retval = -ERESTARTSYS;
@@ -1653,7 +1649,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
1653#endif 1649#endif
1654 break; 1650 break;
1655 } 1651 }
1656 if (!(info->flags & ASYNC_CLOSING) && 1652 if (!(state->flags & ASYNC_CLOSING) &&
1657 (do_clocal || (!(ciab.pra & SER_DCD)) )) 1653 (do_clocal || (!(ciab.pra & SER_DCD)) ))
1658 break; 1654 break;
1659 if (signal_pending(current)) { 1655 if (signal_pending(current)) {
@@ -1679,7 +1675,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
1679#endif 1675#endif
1680 if (retval) 1676 if (retval)
1681 return retval; 1677 return retval;
1682 info->flags |= ASYNC_NORMAL_ACTIVE; 1678 state->flags |= ASYNC_NORMAL_ACTIVE;
1683 return 0; 1679 return 0;
1684} 1680}
1685 1681
@@ -1705,7 +1701,6 @@ static int get_async_struct(int line, struct async_struct **ret_info)
1705 init_waitqueue_head(&info->delta_msr_wait); 1701 init_waitqueue_head(&info->delta_msr_wait);
1706#endif 1702#endif
1707 info->port = sstate->port; 1703 info->port = sstate->port;
1708 info->flags = sstate->flags;
1709 info->xmit_fifo_size = sstate->xmit_fifo_size; 1704 info->xmit_fifo_size = sstate->xmit_fifo_size;
1710 info->line = line; 1705 info->line = line;
1711 info->state = sstate; 1706 info->state = sstate;
@@ -1741,17 +1736,17 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
1741#ifdef SERIAL_DEBUG_OPEN 1736#ifdef SERIAL_DEBUG_OPEN
1742 printk("rs_open %s, count = %d\n", tty->name, info->state->count); 1737 printk("rs_open %s, count = %d\n", tty->name, info->state->count);
1743#endif 1738#endif
1744 info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; 1739 info->tty->low_latency = (info->state->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
1745 1740
1746 /* 1741 /*
1747 * If the port is the middle of closing, bail out now 1742 * If the port is the middle of closing, bail out now
1748 */ 1743 */
1749 if (tty_hung_up_p(filp) || 1744 if (tty_hung_up_p(filp) ||
1750 (info->flags & ASYNC_CLOSING)) { 1745 (info->state->flags & ASYNC_CLOSING)) {
1751 if (info->flags & ASYNC_CLOSING) 1746 if (info->state->flags & ASYNC_CLOSING)
1752 interruptible_sleep_on(&info->close_wait); 1747 interruptible_sleep_on(&info->close_wait);
1753#ifdef SERIAL_DO_RESTART 1748#ifdef SERIAL_DO_RESTART
1754 return ((info->flags & ASYNC_HUP_NOTIFY) ? 1749 return ((info->state->flags & ASYNC_HUP_NOTIFY) ?
1755 -EAGAIN : -ERESTARTSYS); 1750 -EAGAIN : -ERESTARTSYS);
1756#else 1751#else
1757 return -EAGAIN; 1752 return -EAGAIN;
@@ -1799,7 +1794,6 @@ static inline void line_info(struct seq_file *m, struct serial_state *state)
1799 if (!info) { 1794 if (!info) {
1800 info = &scr_info; /* This is just for serial_{in,out} */ 1795 info = &scr_info; /* This is just for serial_{in,out} */
1801 1796
1802 info->flags = state->flags;
1803 info->quot = 0; 1797 info->quot = 0;
1804 info->tty = NULL; 1798 info->tty = NULL;
1805 } 1799 }