diff options
Diffstat (limited to 'drivers/char/pcmcia/synclink_cs.c')
-rw-r--r-- | drivers/char/pcmcia/synclink_cs.c | 131 |
1 files changed, 60 insertions, 71 deletions
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 0a484b4a1b02..3f57d5de3957 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c | |||
@@ -1050,7 +1050,7 @@ static void cts_change(MGSLPC_INFO *info, struct tty_struct *tty) | |||
1050 | wake_up_interruptible(&info->status_event_wait_q); | 1050 | wake_up_interruptible(&info->status_event_wait_q); |
1051 | wake_up_interruptible(&info->event_wait_q); | 1051 | wake_up_interruptible(&info->event_wait_q); |
1052 | 1052 | ||
1053 | if (info->port.flags & ASYNC_CTS_FLOW) { | 1053 | if (tty_port_cts_enabled(&info->port)) { |
1054 | if (tty->hw_stopped) { | 1054 | if (tty->hw_stopped) { |
1055 | if (info->serial_signals & SerialSignal_CTS) { | 1055 | if (info->serial_signals & SerialSignal_CTS) { |
1056 | if (debug_level >= DEBUG_LEVEL_ISR) | 1056 | if (debug_level >= DEBUG_LEVEL_ISR) |
@@ -1344,7 +1344,7 @@ static void shutdown(MGSLPC_INFO * info, struct tty_struct *tty) | |||
1344 | /* TODO:disable interrupts instead of reset to preserve signal states */ | 1344 | /* TODO:disable interrupts instead of reset to preserve signal states */ |
1345 | reset_device(info); | 1345 | reset_device(info); |
1346 | 1346 | ||
1347 | if (!tty || tty->termios->c_cflag & HUPCL) { | 1347 | if (!tty || tty->termios.c_cflag & HUPCL) { |
1348 | info->serial_signals &= ~(SerialSignal_DTR + SerialSignal_RTS); | 1348 | info->serial_signals &= ~(SerialSignal_DTR + SerialSignal_RTS); |
1349 | set_signals(info); | 1349 | set_signals(info); |
1350 | } | 1350 | } |
@@ -1385,7 +1385,7 @@ static void mgslpc_program_hw(MGSLPC_INFO *info, struct tty_struct *tty) | |||
1385 | port_irq_enable(info, (unsigned char) PVR_DSR | PVR_RI); | 1385 | port_irq_enable(info, (unsigned char) PVR_DSR | PVR_RI); |
1386 | get_signals(info); | 1386 | get_signals(info); |
1387 | 1387 | ||
1388 | if (info->netcount || (tty && (tty->termios->c_cflag & CREAD))) | 1388 | if (info->netcount || (tty && (tty->termios.c_cflag & CREAD))) |
1389 | rx_start(info); | 1389 | rx_start(info); |
1390 | 1390 | ||
1391 | spin_unlock_irqrestore(&info->lock,flags); | 1391 | spin_unlock_irqrestore(&info->lock,flags); |
@@ -1398,14 +1398,14 @@ static void mgslpc_change_params(MGSLPC_INFO *info, struct tty_struct *tty) | |||
1398 | unsigned cflag; | 1398 | unsigned cflag; |
1399 | int bits_per_char; | 1399 | int bits_per_char; |
1400 | 1400 | ||
1401 | if (!tty || !tty->termios) | 1401 | if (!tty) |
1402 | return; | 1402 | return; |
1403 | 1403 | ||
1404 | if (debug_level >= DEBUG_LEVEL_INFO) | 1404 | if (debug_level >= DEBUG_LEVEL_INFO) |
1405 | printk("%s(%d):mgslpc_change_params(%s)\n", | 1405 | printk("%s(%d):mgslpc_change_params(%s)\n", |
1406 | __FILE__,__LINE__, info->device_name ); | 1406 | __FILE__,__LINE__, info->device_name ); |
1407 | 1407 | ||
1408 | cflag = tty->termios->c_cflag; | 1408 | cflag = tty->termios.c_cflag; |
1409 | 1409 | ||
1410 | /* if B0 rate (hangup) specified then negate DTR and RTS */ | 1410 | /* if B0 rate (hangup) specified then negate DTR and RTS */ |
1411 | /* otherwise assert DTR and RTS */ | 1411 | /* otherwise assert DTR and RTS */ |
@@ -1728,7 +1728,7 @@ static void mgslpc_throttle(struct tty_struct * tty) | |||
1728 | if (I_IXOFF(tty)) | 1728 | if (I_IXOFF(tty)) |
1729 | mgslpc_send_xchar(tty, STOP_CHAR(tty)); | 1729 | mgslpc_send_xchar(tty, STOP_CHAR(tty)); |
1730 | 1730 | ||
1731 | if (tty->termios->c_cflag & CRTSCTS) { | 1731 | if (tty->termios.c_cflag & CRTSCTS) { |
1732 | spin_lock_irqsave(&info->lock,flags); | 1732 | spin_lock_irqsave(&info->lock,flags); |
1733 | info->serial_signals &= ~SerialSignal_RTS; | 1733 | info->serial_signals &= ~SerialSignal_RTS; |
1734 | set_signals(info); | 1734 | set_signals(info); |
@@ -1757,7 +1757,7 @@ static void mgslpc_unthrottle(struct tty_struct * tty) | |||
1757 | mgslpc_send_xchar(tty, START_CHAR(tty)); | 1757 | mgslpc_send_xchar(tty, START_CHAR(tty)); |
1758 | } | 1758 | } |
1759 | 1759 | ||
1760 | if (tty->termios->c_cflag & CRTSCTS) { | 1760 | if (tty->termios.c_cflag & CRTSCTS) { |
1761 | spin_lock_irqsave(&info->lock,flags); | 1761 | spin_lock_irqsave(&info->lock,flags); |
1762 | info->serial_signals |= SerialSignal_RTS; | 1762 | info->serial_signals |= SerialSignal_RTS; |
1763 | set_signals(info); | 1763 | set_signals(info); |
@@ -2293,8 +2293,8 @@ static void mgslpc_set_termios(struct tty_struct *tty, struct ktermios *old_term | |||
2293 | tty->driver->name ); | 2293 | tty->driver->name ); |
2294 | 2294 | ||
2295 | /* just return if nothing has changed */ | 2295 | /* just return if nothing has changed */ |
2296 | if ((tty->termios->c_cflag == old_termios->c_cflag) | 2296 | if ((tty->termios.c_cflag == old_termios->c_cflag) |
2297 | && (RELEVANT_IFLAG(tty->termios->c_iflag) | 2297 | && (RELEVANT_IFLAG(tty->termios.c_iflag) |
2298 | == RELEVANT_IFLAG(old_termios->c_iflag))) | 2298 | == RELEVANT_IFLAG(old_termios->c_iflag))) |
2299 | return; | 2299 | return; |
2300 | 2300 | ||
@@ -2302,7 +2302,7 @@ static void mgslpc_set_termios(struct tty_struct *tty, struct ktermios *old_term | |||
2302 | 2302 | ||
2303 | /* Handle transition to B0 status */ | 2303 | /* Handle transition to B0 status */ |
2304 | if (old_termios->c_cflag & CBAUD && | 2304 | if (old_termios->c_cflag & CBAUD && |
2305 | !(tty->termios->c_cflag & CBAUD)) { | 2305 | !(tty->termios.c_cflag & CBAUD)) { |
2306 | info->serial_signals &= ~(SerialSignal_RTS + SerialSignal_DTR); | 2306 | info->serial_signals &= ~(SerialSignal_RTS + SerialSignal_DTR); |
2307 | spin_lock_irqsave(&info->lock,flags); | 2307 | spin_lock_irqsave(&info->lock,flags); |
2308 | set_signals(info); | 2308 | set_signals(info); |
@@ -2311,9 +2311,9 @@ static void mgslpc_set_termios(struct tty_struct *tty, struct ktermios *old_term | |||
2311 | 2311 | ||
2312 | /* Handle transition away from B0 status */ | 2312 | /* Handle transition away from B0 status */ |
2313 | if (!(old_termios->c_cflag & CBAUD) && | 2313 | if (!(old_termios->c_cflag & CBAUD) && |
2314 | tty->termios->c_cflag & CBAUD) { | 2314 | tty->termios.c_cflag & CBAUD) { |
2315 | info->serial_signals |= SerialSignal_DTR; | 2315 | info->serial_signals |= SerialSignal_DTR; |
2316 | if (!(tty->termios->c_cflag & CRTSCTS) || | 2316 | if (!(tty->termios.c_cflag & CRTSCTS) || |
2317 | !test_bit(TTY_THROTTLED, &tty->flags)) { | 2317 | !test_bit(TTY_THROTTLED, &tty->flags)) { |
2318 | info->serial_signals |= SerialSignal_RTS; | 2318 | info->serial_signals |= SerialSignal_RTS; |
2319 | } | 2319 | } |
@@ -2324,7 +2324,7 @@ static void mgslpc_set_termios(struct tty_struct *tty, struct ktermios *old_term | |||
2324 | 2324 | ||
2325 | /* Handle turning off CRTSCTS */ | 2325 | /* Handle turning off CRTSCTS */ |
2326 | if (old_termios->c_cflag & CRTSCTS && | 2326 | if (old_termios->c_cflag & CRTSCTS && |
2327 | !(tty->termios->c_cflag & CRTSCTS)) { | 2327 | !(tty->termios.c_cflag & CRTSCTS)) { |
2328 | tty->hw_stopped = 0; | 2328 | tty->hw_stopped = 0; |
2329 | tx_release(tty); | 2329 | tx_release(tty); |
2330 | } | 2330 | } |
@@ -2731,6 +2731,8 @@ static void mgslpc_add_device(MGSLPC_INFO *info) | |||
2731 | #if SYNCLINK_GENERIC_HDLC | 2731 | #if SYNCLINK_GENERIC_HDLC |
2732 | hdlcdev_init(info); | 2732 | hdlcdev_init(info); |
2733 | #endif | 2733 | #endif |
2734 | tty_port_register_device(&info->port, serial_driver, info->line, | ||
2735 | &info->p_dev->dev); | ||
2734 | } | 2736 | } |
2735 | 2737 | ||
2736 | static void mgslpc_remove_device(MGSLPC_INFO *remove_info) | 2738 | static void mgslpc_remove_device(MGSLPC_INFO *remove_info) |
@@ -2744,6 +2746,7 @@ static void mgslpc_remove_device(MGSLPC_INFO *remove_info) | |||
2744 | last->next_device = info->next_device; | 2746 | last->next_device = info->next_device; |
2745 | else | 2747 | else |
2746 | mgslpc_device_list = info->next_device; | 2748 | mgslpc_device_list = info->next_device; |
2749 | tty_unregister_device(serial_driver, info->line); | ||
2747 | #if SYNCLINK_GENERIC_HDLC | 2750 | #if SYNCLINK_GENERIC_HDLC |
2748 | hdlcdev_exit(info); | 2751 | hdlcdev_exit(info); |
2749 | #endif | 2752 | #endif |
@@ -2798,77 +2801,63 @@ static const struct tty_operations mgslpc_ops = { | |||
2798 | .proc_fops = &mgslpc_proc_fops, | 2801 | .proc_fops = &mgslpc_proc_fops, |
2799 | }; | 2802 | }; |
2800 | 2803 | ||
2801 | static void synclink_cs_cleanup(void) | 2804 | static int __init synclink_cs_init(void) |
2802 | { | 2805 | { |
2803 | int rc; | 2806 | int rc; |
2804 | 2807 | ||
2805 | while(mgslpc_device_list) | 2808 | if (break_on_load) { |
2806 | mgslpc_remove_device(mgslpc_device_list); | 2809 | mgslpc_get_text_ptr(); |
2807 | 2810 | BREAKPOINT(); | |
2808 | if (serial_driver) { | ||
2809 | if ((rc = tty_unregister_driver(serial_driver))) | ||
2810 | printk("%s(%d) failed to unregister tty driver err=%d\n", | ||
2811 | __FILE__,__LINE__,rc); | ||
2812 | put_tty_driver(serial_driver); | ||
2813 | } | 2811 | } |
2814 | 2812 | ||
2815 | pcmcia_unregister_driver(&mgslpc_driver); | 2813 | serial_driver = tty_alloc_driver(MAX_DEVICE_COUNT, |
2816 | } | 2814 | TTY_DRIVER_REAL_RAW | |
2817 | 2815 | TTY_DRIVER_DYNAMIC_DEV); | |
2818 | static int __init synclink_cs_init(void) | 2816 | if (IS_ERR(serial_driver)) { |
2819 | { | 2817 | rc = PTR_ERR(serial_driver); |
2820 | int rc; | 2818 | goto err; |
2821 | 2819 | } | |
2822 | if (break_on_load) { | ||
2823 | mgslpc_get_text_ptr(); | ||
2824 | BREAKPOINT(); | ||
2825 | } | ||
2826 | |||
2827 | if ((rc = pcmcia_register_driver(&mgslpc_driver)) < 0) | ||
2828 | return rc; | ||
2829 | |||
2830 | serial_driver = alloc_tty_driver(MAX_DEVICE_COUNT); | ||
2831 | if (!serial_driver) { | ||
2832 | rc = -ENOMEM; | ||
2833 | goto error; | ||
2834 | } | ||
2835 | 2820 | ||
2836 | /* Initialize the tty_driver structure */ | 2821 | /* Initialize the tty_driver structure */ |
2837 | 2822 | serial_driver->driver_name = "synclink_cs"; | |
2838 | serial_driver->driver_name = "synclink_cs"; | 2823 | serial_driver->name = "ttySLP"; |
2839 | serial_driver->name = "ttySLP"; | 2824 | serial_driver->major = ttymajor; |
2840 | serial_driver->major = ttymajor; | 2825 | serial_driver->minor_start = 64; |
2841 | serial_driver->minor_start = 64; | 2826 | serial_driver->type = TTY_DRIVER_TYPE_SERIAL; |
2842 | serial_driver->type = TTY_DRIVER_TYPE_SERIAL; | 2827 | serial_driver->subtype = SERIAL_TYPE_NORMAL; |
2843 | serial_driver->subtype = SERIAL_TYPE_NORMAL; | 2828 | serial_driver->init_termios = tty_std_termios; |
2844 | serial_driver->init_termios = tty_std_termios; | 2829 | serial_driver->init_termios.c_cflag = |
2845 | serial_driver->init_termios.c_cflag = | 2830 | B9600 | CS8 | CREAD | HUPCL | CLOCAL; |
2846 | B9600 | CS8 | CREAD | HUPCL | CLOCAL; | 2831 | tty_set_operations(serial_driver, &mgslpc_ops); |
2847 | serial_driver->flags = TTY_DRIVER_REAL_RAW; | 2832 | |
2848 | tty_set_operations(serial_driver, &mgslpc_ops); | 2833 | rc = tty_register_driver(serial_driver); |
2849 | 2834 | if (rc < 0) { | |
2850 | if ((rc = tty_register_driver(serial_driver)) < 0) { | 2835 | printk(KERN_ERR "%s(%d):Couldn't register serial driver\n", |
2851 | printk("%s(%d):Couldn't register serial driver\n", | 2836 | __FILE__, __LINE__); |
2852 | __FILE__,__LINE__); | 2837 | goto err_put_tty; |
2853 | put_tty_driver(serial_driver); | 2838 | } |
2854 | serial_driver = NULL; | ||
2855 | goto error; | ||
2856 | } | ||
2857 | 2839 | ||
2858 | printk("%s %s, tty major#%d\n", | 2840 | rc = pcmcia_register_driver(&mgslpc_driver); |
2859 | driver_name, driver_version, | 2841 | if (rc < 0) |
2860 | serial_driver->major); | 2842 | goto err_unreg_tty; |
2861 | 2843 | ||
2862 | return 0; | 2844 | printk(KERN_INFO "%s %s, tty major#%d\n", driver_name, driver_version, |
2845 | serial_driver->major); | ||
2863 | 2846 | ||
2864 | error: | 2847 | return 0; |
2865 | synclink_cs_cleanup(); | 2848 | err_unreg_tty: |
2866 | return rc; | 2849 | tty_unregister_driver(serial_driver); |
2850 | err_put_tty: | ||
2851 | put_tty_driver(serial_driver); | ||
2852 | err: | ||
2853 | return rc; | ||
2867 | } | 2854 | } |
2868 | 2855 | ||
2869 | static void __exit synclink_cs_exit(void) | 2856 | static void __exit synclink_cs_exit(void) |
2870 | { | 2857 | { |
2871 | synclink_cs_cleanup(); | 2858 | pcmcia_unregister_driver(&mgslpc_driver); |
2859 | tty_unregister_driver(serial_driver); | ||
2860 | put_tty_driver(serial_driver); | ||
2872 | } | 2861 | } |
2873 | 2862 | ||
2874 | module_init(synclink_cs_init); | 2863 | module_init(synclink_cs_init); |