aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/synclinkmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/synclinkmp.c')
-rw-r--r--drivers/tty/synclinkmp.c58
1 files changed, 34 insertions, 24 deletions
diff --git a/drivers/tty/synclinkmp.c b/drivers/tty/synclinkmp.c
index a3dddc12d2fe..f17d9f3d84a2 100644
--- a/drivers/tty/synclinkmp.c
+++ b/drivers/tty/synclinkmp.c
@@ -711,15 +711,11 @@ static void ldisc_receive_buf(struct tty_struct *tty,
711 711
712/* tty callbacks */ 712/* tty callbacks */
713 713
714/* Called when a port is opened. Init and enable port. 714static int install(struct tty_driver *driver, struct tty_struct *tty)
715 */
716static int open(struct tty_struct *tty, struct file *filp)
717{ 715{
718 SLMP_INFO *info; 716 SLMP_INFO *info;
719 int retval, line; 717 int line = tty->index;
720 unsigned long flags;
721 718
722 line = tty->index;
723 if (line >= synclinkmp_device_count) { 719 if (line >= synclinkmp_device_count) {
724 printk("%s(%d): open with invalid line #%d.\n", 720 printk("%s(%d): open with invalid line #%d.\n",
725 __FILE__,__LINE__,line); 721 __FILE__,__LINE__,line);
@@ -727,17 +723,30 @@ static int open(struct tty_struct *tty, struct file *filp)
727 } 723 }
728 724
729 info = synclinkmp_device_list; 725 info = synclinkmp_device_list;
730 while(info && info->line != line) 726 while (info && info->line != line)
731 info = info->next_device; 727 info = info->next_device;
732 if (sanity_check(info, tty->name, "open")) 728 if (sanity_check(info, tty->name, "open"))
733 return -ENODEV; 729 return -ENODEV;
734 if ( info->init_error ) { 730 if (info->init_error) {
735 printk("%s(%d):%s device is not allocated, init error=%d\n", 731 printk("%s(%d):%s device is not allocated, init error=%d\n",
736 __FILE__,__LINE__,info->device_name,info->init_error); 732 __FILE__, __LINE__, info->device_name,
733 info->init_error);
737 return -ENODEV; 734 return -ENODEV;
738 } 735 }
739 736
740 tty->driver_data = info; 737 tty->driver_data = info;
738
739 return tty_port_install(&info->port, driver, tty);
740}
741
742/* Called when a port is opened. Init and enable port.
743 */
744static int open(struct tty_struct *tty, struct file *filp)
745{
746 SLMP_INFO *info = tty->driver_data;
747 unsigned long flags;
748 int retval;
749
741 info->port.tty = tty; 750 info->port.tty = tty;
742 751
743 if (debug_level >= DEBUG_LEVEL_INFO) 752 if (debug_level >= DEBUG_LEVEL_INFO)
@@ -873,7 +882,7 @@ static void set_termios(struct tty_struct *tty, struct ktermios *old_termios)
873 882
874 /* Handle transition to B0 status */ 883 /* Handle transition to B0 status */
875 if (old_termios->c_cflag & CBAUD && 884 if (old_termios->c_cflag & CBAUD &&
876 !(tty->termios->c_cflag & CBAUD)) { 885 !(tty->termios.c_cflag & CBAUD)) {
877 info->serial_signals &= ~(SerialSignal_RTS + SerialSignal_DTR); 886 info->serial_signals &= ~(SerialSignal_RTS + SerialSignal_DTR);
878 spin_lock_irqsave(&info->lock,flags); 887 spin_lock_irqsave(&info->lock,flags);
879 set_signals(info); 888 set_signals(info);
@@ -882,9 +891,9 @@ static void set_termios(struct tty_struct *tty, struct ktermios *old_termios)
882 891
883 /* Handle transition away from B0 status */ 892 /* Handle transition away from B0 status */
884 if (!(old_termios->c_cflag & CBAUD) && 893 if (!(old_termios->c_cflag & CBAUD) &&
885 tty->termios->c_cflag & CBAUD) { 894 tty->termios.c_cflag & CBAUD) {
886 info->serial_signals |= SerialSignal_DTR; 895 info->serial_signals |= SerialSignal_DTR;
887 if (!(tty->termios->c_cflag & CRTSCTS) || 896 if (!(tty->termios.c_cflag & CRTSCTS) ||
888 !test_bit(TTY_THROTTLED, &tty->flags)) { 897 !test_bit(TTY_THROTTLED, &tty->flags)) {
889 info->serial_signals |= SerialSignal_RTS; 898 info->serial_signals |= SerialSignal_RTS;
890 } 899 }
@@ -895,7 +904,7 @@ static void set_termios(struct tty_struct *tty, struct ktermios *old_termios)
895 904
896 /* Handle turning off CRTSCTS */ 905 /* Handle turning off CRTSCTS */
897 if (old_termios->c_cflag & CRTSCTS && 906 if (old_termios->c_cflag & CRTSCTS &&
898 !(tty->termios->c_cflag & CRTSCTS)) { 907 !(tty->termios.c_cflag & CRTSCTS)) {
899 tty->hw_stopped = 0; 908 tty->hw_stopped = 0;
900 tx_release(tty); 909 tx_release(tty);
901 } 910 }
@@ -1473,7 +1482,7 @@ static void throttle(struct tty_struct * tty)
1473 if (I_IXOFF(tty)) 1482 if (I_IXOFF(tty))
1474 send_xchar(tty, STOP_CHAR(tty)); 1483 send_xchar(tty, STOP_CHAR(tty));
1475 1484
1476 if (tty->termios->c_cflag & CRTSCTS) { 1485 if (tty->termios.c_cflag & CRTSCTS) {
1477 spin_lock_irqsave(&info->lock,flags); 1486 spin_lock_irqsave(&info->lock,flags);
1478 info->serial_signals &= ~SerialSignal_RTS; 1487 info->serial_signals &= ~SerialSignal_RTS;
1479 set_signals(info); 1488 set_signals(info);
@@ -1502,7 +1511,7 @@ static void unthrottle(struct tty_struct * tty)
1502 send_xchar(tty, START_CHAR(tty)); 1511 send_xchar(tty, START_CHAR(tty));
1503 } 1512 }
1504 1513
1505 if (tty->termios->c_cflag & CRTSCTS) { 1514 if (tty->termios.c_cflag & CRTSCTS) {
1506 spin_lock_irqsave(&info->lock,flags); 1515 spin_lock_irqsave(&info->lock,flags);
1507 info->serial_signals |= SerialSignal_RTS; 1516 info->serial_signals |= SerialSignal_RTS;
1508 set_signals(info); 1517 set_signals(info);
@@ -2491,7 +2500,7 @@ static void isr_io_pin( SLMP_INFO *info, u16 status )
2491 } 2500 }
2492 } 2501 }
2493 2502
2494 if ( (info->port.flags & ASYNC_CTS_FLOW) && 2503 if (tty_port_cts_enabled(&info->port) &&
2495 (status & MISCSTATUS_CTS_LATCHED) ) { 2504 (status & MISCSTATUS_CTS_LATCHED) ) {
2496 if ( info->port.tty ) { 2505 if ( info->port.tty ) {
2497 if (info->port.tty->hw_stopped) { 2506 if (info->port.tty->hw_stopped) {
@@ -2708,7 +2717,7 @@ static void shutdown(SLMP_INFO * info)
2708 2717
2709 reset_port(info); 2718 reset_port(info);
2710 2719
2711 if (!info->port.tty || info->port.tty->termios->c_cflag & HUPCL) { 2720 if (!info->port.tty || info->port.tty->termios.c_cflag & HUPCL) {
2712 info->serial_signals &= ~(SerialSignal_DTR + SerialSignal_RTS); 2721 info->serial_signals &= ~(SerialSignal_DTR + SerialSignal_RTS);
2713 set_signals(info); 2722 set_signals(info);
2714 } 2723 }
@@ -2749,7 +2758,7 @@ static void program_hw(SLMP_INFO *info)
2749 2758
2750 get_signals(info); 2759 get_signals(info);
2751 2760
2752 if (info->netcount || (info->port.tty && info->port.tty->termios->c_cflag & CREAD) ) 2761 if (info->netcount || (info->port.tty && info->port.tty->termios.c_cflag & CREAD) )
2753 rx_start(info); 2762 rx_start(info);
2754 2763
2755 spin_unlock_irqrestore(&info->lock,flags); 2764 spin_unlock_irqrestore(&info->lock,flags);
@@ -2762,14 +2771,14 @@ static void change_params(SLMP_INFO *info)
2762 unsigned cflag; 2771 unsigned cflag;
2763 int bits_per_char; 2772 int bits_per_char;
2764 2773
2765 if (!info->port.tty || !info->port.tty->termios) 2774 if (!info->port.tty)
2766 return; 2775 return;
2767 2776
2768 if (debug_level >= DEBUG_LEVEL_INFO) 2777 if (debug_level >= DEBUG_LEVEL_INFO)
2769 printk("%s(%d):%s change_params()\n", 2778 printk("%s(%d):%s change_params()\n",
2770 __FILE__,__LINE__, info->device_name ); 2779 __FILE__,__LINE__, info->device_name );
2771 2780
2772 cflag = info->port.tty->termios->c_cflag; 2781 cflag = info->port.tty->termios.c_cflag;
2773 2782
2774 /* if B0 rate (hangup) specified then negate DTR and RTS */ 2783 /* if B0 rate (hangup) specified then negate DTR and RTS */
2775 /* otherwise assert DTR and RTS */ 2784 /* otherwise assert DTR and RTS */
@@ -3306,7 +3315,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
3306 return 0; 3315 return 0;
3307 } 3316 }
3308 3317
3309 if (tty->termios->c_cflag & CLOCAL) 3318 if (tty->termios.c_cflag & CLOCAL)
3310 do_clocal = true; 3319 do_clocal = true;
3311 3320
3312 /* Wait for carrier detect and the line to become 3321 /* Wait for carrier detect and the line to become
@@ -3332,7 +3341,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
3332 port->blocked_open++; 3341 port->blocked_open++;
3333 3342
3334 while (1) { 3343 while (1) {
3335 if (tty->termios->c_cflag & CBAUD) 3344 if (tty->termios.c_cflag & CBAUD)
3336 tty_port_raise_dtr_rts(port); 3345 tty_port_raise_dtr_rts(port);
3337 3346
3338 set_current_state(TASK_INTERRUPTIBLE); 3347 set_current_state(TASK_INTERRUPTIBLE);
@@ -3357,9 +3366,9 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
3357 printk("%s(%d):%s block_til_ready() count=%d\n", 3366 printk("%s(%d):%s block_til_ready() count=%d\n",
3358 __FILE__,__LINE__, tty->driver->name, port->count ); 3367 __FILE__,__LINE__, tty->driver->name, port->count );
3359 3368
3360 tty_unlock(); 3369 tty_unlock(tty);
3361 schedule(); 3370 schedule();
3362 tty_lock(); 3371 tty_lock(tty);
3363 } 3372 }
3364 3373
3365 set_current_state(TASK_RUNNING); 3374 set_current_state(TASK_RUNNING);
@@ -3881,6 +3890,7 @@ static void device_init(int adapter_num, struct pci_dev *pdev)
3881} 3890}
3882 3891
3883static const struct tty_operations ops = { 3892static const struct tty_operations ops = {
3893 .install = install,
3884 .open = open, 3894 .open = open,
3885 .close = close, 3895 .close = close,
3886 .write = write, 3896 .write = write,