diff options
Diffstat (limited to 'drivers/tty/amiserial.c')
-rw-r--r-- | drivers/tty/amiserial.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c index 6cc4358f68c..42d0a2581a8 100644 --- a/drivers/tty/amiserial.c +++ b/drivers/tty/amiserial.c | |||
@@ -420,7 +420,7 @@ static void check_modem_status(struct serial_state *info) | |||
420 | tty_hangup(port->tty); | 420 | tty_hangup(port->tty); |
421 | } | 421 | } |
422 | } | 422 | } |
423 | if (port->flags & ASYNC_CTS_FLOW) { | 423 | if (tty_port_cts_enabled(port)) { |
424 | if (port->tty->hw_stopped) { | 424 | if (port->tty->hw_stopped) { |
425 | if (!(status & SER_CTS)) { | 425 | if (!(status & SER_CTS)) { |
426 | #if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW)) | 426 | #if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW)) |
@@ -646,7 +646,7 @@ static void shutdown(struct tty_struct *tty, struct serial_state *info) | |||
646 | custom.adkcon = AC_UARTBRK; | 646 | custom.adkcon = AC_UARTBRK; |
647 | mb(); | 647 | mb(); |
648 | 648 | ||
649 | if (tty->termios->c_cflag & HUPCL) | 649 | if (tty->termios.c_cflag & HUPCL) |
650 | info->MCR &= ~(SER_DTR|SER_RTS); | 650 | info->MCR &= ~(SER_DTR|SER_RTS); |
651 | rtsdtr_ctrl(info->MCR); | 651 | rtsdtr_ctrl(info->MCR); |
652 | 652 | ||
@@ -670,7 +670,7 @@ static void change_speed(struct tty_struct *tty, struct serial_state *info, | |||
670 | int bits; | 670 | int bits; |
671 | unsigned long flags; | 671 | unsigned long flags; |
672 | 672 | ||
673 | cflag = tty->termios->c_cflag; | 673 | cflag = tty->termios.c_cflag; |
674 | 674 | ||
675 | /* Byte size is always 8 bits plus parity bit if requested */ | 675 | /* Byte size is always 8 bits plus parity bit if requested */ |
676 | 676 | ||
@@ -707,8 +707,8 @@ static void change_speed(struct tty_struct *tty, struct serial_state *info, | |||
707 | /* If the quotient is zero refuse the change */ | 707 | /* If the quotient is zero refuse the change */ |
708 | if (!quot && old_termios) { | 708 | if (!quot && old_termios) { |
709 | /* FIXME: Will need updating for new tty in the end */ | 709 | /* FIXME: Will need updating for new tty in the end */ |
710 | tty->termios->c_cflag &= ~CBAUD; | 710 | tty->termios.c_cflag &= ~CBAUD; |
711 | tty->termios->c_cflag |= (old_termios->c_cflag & CBAUD); | 711 | tty->termios.c_cflag |= (old_termios->c_cflag & CBAUD); |
712 | baud = tty_get_baud_rate(tty); | 712 | baud = tty_get_baud_rate(tty); |
713 | if (!baud) | 713 | if (!baud) |
714 | baud = 9600; | 714 | baud = 9600; |
@@ -984,7 +984,7 @@ static void rs_throttle(struct tty_struct * tty) | |||
984 | if (I_IXOFF(tty)) | 984 | if (I_IXOFF(tty)) |
985 | rs_send_xchar(tty, STOP_CHAR(tty)); | 985 | rs_send_xchar(tty, STOP_CHAR(tty)); |
986 | 986 | ||
987 | if (tty->termios->c_cflag & CRTSCTS) | 987 | if (tty->termios.c_cflag & CRTSCTS) |
988 | info->MCR &= ~SER_RTS; | 988 | info->MCR &= ~SER_RTS; |
989 | 989 | ||
990 | local_irq_save(flags); | 990 | local_irq_save(flags); |
@@ -1012,7 +1012,7 @@ static void rs_unthrottle(struct tty_struct * tty) | |||
1012 | else | 1012 | else |
1013 | rs_send_xchar(tty, START_CHAR(tty)); | 1013 | rs_send_xchar(tty, START_CHAR(tty)); |
1014 | } | 1014 | } |
1015 | if (tty->termios->c_cflag & CRTSCTS) | 1015 | if (tty->termios.c_cflag & CRTSCTS) |
1016 | info->MCR |= SER_RTS; | 1016 | info->MCR |= SER_RTS; |
1017 | local_irq_save(flags); | 1017 | local_irq_save(flags); |
1018 | rtsdtr_ctrl(info->MCR); | 1018 | rtsdtr_ctrl(info->MCR); |
@@ -1033,7 +1033,7 @@ static int get_serial_info(struct tty_struct *tty, struct serial_state *state, | |||
1033 | if (!retinfo) | 1033 | if (!retinfo) |
1034 | return -EFAULT; | 1034 | return -EFAULT; |
1035 | memset(&tmp, 0, sizeof(tmp)); | 1035 | memset(&tmp, 0, sizeof(tmp)); |
1036 | tty_lock(); | 1036 | tty_lock(tty); |
1037 | tmp.line = tty->index; | 1037 | tmp.line = tty->index; |
1038 | tmp.port = state->port; | 1038 | tmp.port = state->port; |
1039 | tmp.flags = state->tport.flags; | 1039 | tmp.flags = state->tport.flags; |
@@ -1042,7 +1042,7 @@ static int get_serial_info(struct tty_struct *tty, struct serial_state *state, | |||
1042 | tmp.close_delay = state->tport.close_delay; | 1042 | tmp.close_delay = state->tport.close_delay; |
1043 | tmp.closing_wait = state->tport.closing_wait; | 1043 | tmp.closing_wait = state->tport.closing_wait; |
1044 | tmp.custom_divisor = state->custom_divisor; | 1044 | tmp.custom_divisor = state->custom_divisor; |
1045 | tty_unlock(); | 1045 | tty_unlock(tty); |
1046 | if (copy_to_user(retinfo,&tmp,sizeof(*retinfo))) | 1046 | if (copy_to_user(retinfo,&tmp,sizeof(*retinfo))) |
1047 | return -EFAULT; | 1047 | return -EFAULT; |
1048 | return 0; | 1048 | return 0; |
@@ -1059,12 +1059,12 @@ static int set_serial_info(struct tty_struct *tty, struct serial_state *state, | |||
1059 | if (copy_from_user(&new_serial,new_info,sizeof(new_serial))) | 1059 | if (copy_from_user(&new_serial,new_info,sizeof(new_serial))) |
1060 | return -EFAULT; | 1060 | return -EFAULT; |
1061 | 1061 | ||
1062 | tty_lock(); | 1062 | tty_lock(tty); |
1063 | change_spd = ((new_serial.flags ^ port->flags) & ASYNC_SPD_MASK) || | 1063 | change_spd = ((new_serial.flags ^ port->flags) & ASYNC_SPD_MASK) || |
1064 | new_serial.custom_divisor != state->custom_divisor; | 1064 | new_serial.custom_divisor != state->custom_divisor; |
1065 | if (new_serial.irq || new_serial.port != state->port || | 1065 | if (new_serial.irq || new_serial.port != state->port || |
1066 | new_serial.xmit_fifo_size != state->xmit_fifo_size) { | 1066 | new_serial.xmit_fifo_size != state->xmit_fifo_size) { |
1067 | tty_unlock(); | 1067 | tty_unlock(tty); |
1068 | return -EINVAL; | 1068 | return -EINVAL; |
1069 | } | 1069 | } |
1070 | 1070 | ||
@@ -1074,7 +1074,7 @@ static int set_serial_info(struct tty_struct *tty, struct serial_state *state, | |||
1074 | (new_serial.xmit_fifo_size != state->xmit_fifo_size) || | 1074 | (new_serial.xmit_fifo_size != state->xmit_fifo_size) || |
1075 | ((new_serial.flags & ~ASYNC_USR_MASK) != | 1075 | ((new_serial.flags & ~ASYNC_USR_MASK) != |
1076 | (port->flags & ~ASYNC_USR_MASK))) { | 1076 | (port->flags & ~ASYNC_USR_MASK))) { |
1077 | tty_unlock(); | 1077 | tty_unlock(tty); |
1078 | return -EPERM; | 1078 | return -EPERM; |
1079 | } | 1079 | } |
1080 | port->flags = ((port->flags & ~ASYNC_USR_MASK) | | 1080 | port->flags = ((port->flags & ~ASYNC_USR_MASK) | |
@@ -1084,7 +1084,7 @@ static int set_serial_info(struct tty_struct *tty, struct serial_state *state, | |||
1084 | } | 1084 | } |
1085 | 1085 | ||
1086 | if (new_serial.baud_base < 9600) { | 1086 | if (new_serial.baud_base < 9600) { |
1087 | tty_unlock(); | 1087 | tty_unlock(tty); |
1088 | return -EINVAL; | 1088 | return -EINVAL; |
1089 | } | 1089 | } |
1090 | 1090 | ||
@@ -1116,7 +1116,7 @@ check_and_exit: | |||
1116 | } | 1116 | } |
1117 | } else | 1117 | } else |
1118 | retval = startup(tty, state); | 1118 | retval = startup(tty, state); |
1119 | tty_unlock(); | 1119 | tty_unlock(tty); |
1120 | return retval; | 1120 | return retval; |
1121 | } | 1121 | } |
1122 | 1122 | ||
@@ -1330,7 +1330,7 @@ static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios) | |||
1330 | { | 1330 | { |
1331 | struct serial_state *info = tty->driver_data; | 1331 | struct serial_state *info = tty->driver_data; |
1332 | unsigned long flags; | 1332 | unsigned long flags; |
1333 | unsigned int cflag = tty->termios->c_cflag; | 1333 | unsigned int cflag = tty->termios.c_cflag; |
1334 | 1334 | ||
1335 | change_speed(tty, info, old_termios); | 1335 | change_speed(tty, info, old_termios); |
1336 | 1336 | ||
@@ -1347,7 +1347,7 @@ static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios) | |||
1347 | if (!(old_termios->c_cflag & CBAUD) && | 1347 | if (!(old_termios->c_cflag & CBAUD) && |
1348 | (cflag & CBAUD)) { | 1348 | (cflag & CBAUD)) { |
1349 | info->MCR |= SER_DTR; | 1349 | info->MCR |= SER_DTR; |
1350 | if (!(tty->termios->c_cflag & CRTSCTS) || | 1350 | if (!(tty->termios.c_cflag & CRTSCTS) || |
1351 | !test_bit(TTY_THROTTLED, &tty->flags)) { | 1351 | !test_bit(TTY_THROTTLED, &tty->flags)) { |
1352 | info->MCR |= SER_RTS; | 1352 | info->MCR |= SER_RTS; |
1353 | } | 1353 | } |
@@ -1358,7 +1358,7 @@ static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios) | |||
1358 | 1358 | ||
1359 | /* Handle turning off CRTSCTS */ | 1359 | /* Handle turning off CRTSCTS */ |
1360 | if ((old_termios->c_cflag & CRTSCTS) && | 1360 | if ((old_termios->c_cflag & CRTSCTS) && |
1361 | !(tty->termios->c_cflag & CRTSCTS)) { | 1361 | !(tty->termios.c_cflag & CRTSCTS)) { |
1362 | tty->hw_stopped = 0; | 1362 | tty->hw_stopped = 0; |
1363 | rs_start(tty); | 1363 | rs_start(tty); |
1364 | } | 1364 | } |
@@ -1371,7 +1371,7 @@ static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios) | |||
1371 | * or not. Hence, this may change..... | 1371 | * or not. Hence, this may change..... |
1372 | */ | 1372 | */ |
1373 | if (!(old_termios->c_cflag & CLOCAL) && | 1373 | if (!(old_termios->c_cflag & CLOCAL) && |
1374 | (tty->termios->c_cflag & CLOCAL)) | 1374 | (tty->termios.c_cflag & CLOCAL)) |
1375 | wake_up_interruptible(&info->open_wait); | 1375 | wake_up_interruptible(&info->open_wait); |
1376 | #endif | 1376 | #endif |
1377 | } | 1377 | } |
@@ -1710,10 +1710,6 @@ static int __init amiga_serial_probe(struct platform_device *pdev) | |||
1710 | serial_driver->flags = TTY_DRIVER_REAL_RAW; | 1710 | serial_driver->flags = TTY_DRIVER_REAL_RAW; |
1711 | tty_set_operations(serial_driver, &serial_ops); | 1711 | tty_set_operations(serial_driver, &serial_ops); |
1712 | 1712 | ||
1713 | error = tty_register_driver(serial_driver); | ||
1714 | if (error) | ||
1715 | goto fail_put_tty_driver; | ||
1716 | |||
1717 | state = rs_table; | 1713 | state = rs_table; |
1718 | state->port = (int)&custom.serdatr; /* Just to give it a value */ | 1714 | state->port = (int)&custom.serdatr; /* Just to give it a value */ |
1719 | state->custom_divisor = 0; | 1715 | state->custom_divisor = 0; |
@@ -1724,6 +1720,11 @@ static int __init amiga_serial_probe(struct platform_device *pdev) | |||
1724 | state->icount.overrun = state->icount.brk = 0; | 1720 | state->icount.overrun = state->icount.brk = 0; |
1725 | tty_port_init(&state->tport); | 1721 | tty_port_init(&state->tport); |
1726 | state->tport.ops = &amiga_port_ops; | 1722 | state->tport.ops = &amiga_port_ops; |
1723 | tty_port_link_device(&state->tport, serial_driver, 0); | ||
1724 | |||
1725 | error = tty_register_driver(serial_driver); | ||
1726 | if (error) | ||
1727 | goto fail_put_tty_driver; | ||
1727 | 1728 | ||
1728 | printk(KERN_INFO "ttyS0 is the amiga builtin serial port\n"); | 1729 | printk(KERN_INFO "ttyS0 is the amiga builtin serial port\n"); |
1729 | 1730 | ||