aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/mwave/mwavedd.c16
-rw-r--r--drivers/char/pcmcia/synclink_cs.c131
-rw-r--r--drivers/char/ttyprintk.c33
3 files changed, 81 insertions, 99 deletions
diff --git a/drivers/char/mwave/mwavedd.c b/drivers/char/mwave/mwavedd.c
index 1d82d5838f0c..164544afd680 100644
--- a/drivers/char/mwave/mwavedd.c
+++ b/drivers/char/mwave/mwavedd.c
@@ -430,7 +430,7 @@ static ssize_t mwave_write(struct file *file, const char __user *buf,
430 430
431static int register_serial_portandirq(unsigned int port, int irq) 431static int register_serial_portandirq(unsigned int port, int irq)
432{ 432{
433 struct uart_port uart; 433 struct uart_8250_port uart;
434 434
435 switch ( port ) { 435 switch ( port ) {
436 case 0x3f8: 436 case 0x3f8:
@@ -462,14 +462,14 @@ static int register_serial_portandirq(unsigned int port, int irq)
462 } /* switch */ 462 } /* switch */
463 /* irq is okay */ 463 /* irq is okay */
464 464
465 memset(&uart, 0, sizeof(struct uart_port)); 465 memset(&uart, 0, sizeof(uart));
466 466
467 uart.uartclk = 1843200; 467 uart.port.uartclk = 1843200;
468 uart.iobase = port; 468 uart.port.iobase = port;
469 uart.irq = irq; 469 uart.port.irq = irq;
470 uart.iotype = UPIO_PORT; 470 uart.port.iotype = UPIO_PORT;
471 uart.flags = UPF_SHARE_IRQ; 471 uart.port.flags = UPF_SHARE_IRQ;
472 return serial8250_register_port(&uart); 472 return serial8250_register_8250_port(&uart);
473} 473}
474 474
475 475
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index a6b8ddea2227..21721d25e388 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -1058,7 +1058,7 @@ static void cts_change(MGSLPC_INFO *info, struct tty_struct *tty)
1058 wake_up_interruptible(&info->status_event_wait_q); 1058 wake_up_interruptible(&info->status_event_wait_q);
1059 wake_up_interruptible(&info->event_wait_q); 1059 wake_up_interruptible(&info->event_wait_q);
1060 1060
1061 if (tty && (info->port.flags & ASYNC_CTS_FLOW)) { 1061 if (tty && tty_port_cts_enabled(&info->port)) {
1062 if (tty->hw_stopped) { 1062 if (tty->hw_stopped) {
1063 if (info->serial_signals & SerialSignal_CTS) { 1063 if (info->serial_signals & SerialSignal_CTS) {
1064 if (debug_level >= DEBUG_LEVEL_ISR) 1064 if (debug_level >= DEBUG_LEVEL_ISR)
@@ -1350,7 +1350,7 @@ static void shutdown(MGSLPC_INFO * info, struct tty_struct *tty)
1350 /* TODO:disable interrupts instead of reset to preserve signal states */ 1350 /* TODO:disable interrupts instead of reset to preserve signal states */
1351 reset_device(info); 1351 reset_device(info);
1352 1352
1353 if (!tty || tty->termios->c_cflag & HUPCL) { 1353 if (!tty || tty->termios.c_cflag & HUPCL) {
1354 info->serial_signals &= ~(SerialSignal_DTR + SerialSignal_RTS); 1354 info->serial_signals &= ~(SerialSignal_DTR + SerialSignal_RTS);
1355 set_signals(info); 1355 set_signals(info);
1356 } 1356 }
@@ -1391,7 +1391,7 @@ static void mgslpc_program_hw(MGSLPC_INFO *info, struct tty_struct *tty)
1391 port_irq_enable(info, (unsigned char) PVR_DSR | PVR_RI); 1391 port_irq_enable(info, (unsigned char) PVR_DSR | PVR_RI);
1392 get_signals(info); 1392 get_signals(info);
1393 1393
1394 if (info->netcount || (tty && (tty->termios->c_cflag & CREAD))) 1394 if (info->netcount || (tty && (tty->termios.c_cflag & CREAD)))
1395 rx_start(info); 1395 rx_start(info);
1396 1396
1397 spin_unlock_irqrestore(&info->lock,flags); 1397 spin_unlock_irqrestore(&info->lock,flags);
@@ -1404,14 +1404,14 @@ static void mgslpc_change_params(MGSLPC_INFO *info, struct tty_struct *tty)
1404 unsigned cflag; 1404 unsigned cflag;
1405 int bits_per_char; 1405 int bits_per_char;
1406 1406
1407 if (!tty || !tty->termios) 1407 if (!tty)
1408 return; 1408 return;
1409 1409
1410 if (debug_level >= DEBUG_LEVEL_INFO) 1410 if (debug_level >= DEBUG_LEVEL_INFO)
1411 printk("%s(%d):mgslpc_change_params(%s)\n", 1411 printk("%s(%d):mgslpc_change_params(%s)\n",
1412 __FILE__,__LINE__, info->device_name ); 1412 __FILE__,__LINE__, info->device_name );
1413 1413
1414 cflag = tty->termios->c_cflag; 1414 cflag = tty->termios.c_cflag;
1415 1415
1416 /* if B0 rate (hangup) specified then negate DTR and RTS */ 1416 /* if B0 rate (hangup) specified then negate DTR and RTS */
1417 /* otherwise assert DTR and RTS */ 1417 /* otherwise assert DTR and RTS */
@@ -1734,7 +1734,7 @@ static void mgslpc_throttle(struct tty_struct * tty)
1734 if (I_IXOFF(tty)) 1734 if (I_IXOFF(tty))
1735 mgslpc_send_xchar(tty, STOP_CHAR(tty)); 1735 mgslpc_send_xchar(tty, STOP_CHAR(tty));
1736 1736
1737 if (tty->termios->c_cflag & CRTSCTS) { 1737 if (tty->termios.c_cflag & CRTSCTS) {
1738 spin_lock_irqsave(&info->lock,flags); 1738 spin_lock_irqsave(&info->lock,flags);
1739 info->serial_signals &= ~SerialSignal_RTS; 1739 info->serial_signals &= ~SerialSignal_RTS;
1740 set_signals(info); 1740 set_signals(info);
@@ -1763,7 +1763,7 @@ static void mgslpc_unthrottle(struct tty_struct * tty)
1763 mgslpc_send_xchar(tty, START_CHAR(tty)); 1763 mgslpc_send_xchar(tty, START_CHAR(tty));
1764 } 1764 }
1765 1765
1766 if (tty->termios->c_cflag & CRTSCTS) { 1766 if (tty->termios.c_cflag & CRTSCTS) {
1767 spin_lock_irqsave(&info->lock,flags); 1767 spin_lock_irqsave(&info->lock,flags);
1768 info->serial_signals |= SerialSignal_RTS; 1768 info->serial_signals |= SerialSignal_RTS;
1769 set_signals(info); 1769 set_signals(info);
@@ -2299,8 +2299,8 @@ static void mgslpc_set_termios(struct tty_struct *tty, struct ktermios *old_term
2299 tty->driver->name ); 2299 tty->driver->name );
2300 2300
2301 /* just return if nothing has changed */ 2301 /* just return if nothing has changed */
2302 if ((tty->termios->c_cflag == old_termios->c_cflag) 2302 if ((tty->termios.c_cflag == old_termios->c_cflag)
2303 && (RELEVANT_IFLAG(tty->termios->c_iflag) 2303 && (RELEVANT_IFLAG(tty->termios.c_iflag)
2304 == RELEVANT_IFLAG(old_termios->c_iflag))) 2304 == RELEVANT_IFLAG(old_termios->c_iflag)))
2305 return; 2305 return;
2306 2306
@@ -2308,7 +2308,7 @@ static void mgslpc_set_termios(struct tty_struct *tty, struct ktermios *old_term
2308 2308
2309 /* Handle transition to B0 status */ 2309 /* Handle transition to B0 status */
2310 if (old_termios->c_cflag & CBAUD && 2310 if (old_termios->c_cflag & CBAUD &&
2311 !(tty->termios->c_cflag & CBAUD)) { 2311 !(tty->termios.c_cflag & CBAUD)) {
2312 info->serial_signals &= ~(SerialSignal_RTS + SerialSignal_DTR); 2312 info->serial_signals &= ~(SerialSignal_RTS + SerialSignal_DTR);
2313 spin_lock_irqsave(&info->lock,flags); 2313 spin_lock_irqsave(&info->lock,flags);
2314 set_signals(info); 2314 set_signals(info);
@@ -2317,9 +2317,9 @@ static void mgslpc_set_termios(struct tty_struct *tty, struct ktermios *old_term
2317 2317
2318 /* Handle transition away from B0 status */ 2318 /* Handle transition away from B0 status */
2319 if (!(old_termios->c_cflag & CBAUD) && 2319 if (!(old_termios->c_cflag & CBAUD) &&
2320 tty->termios->c_cflag & CBAUD) { 2320 tty->termios.c_cflag & CBAUD) {
2321 info->serial_signals |= SerialSignal_DTR; 2321 info->serial_signals |= SerialSignal_DTR;
2322 if (!(tty->termios->c_cflag & CRTSCTS) || 2322 if (!(tty->termios.c_cflag & CRTSCTS) ||
2323 !test_bit(TTY_THROTTLED, &tty->flags)) { 2323 !test_bit(TTY_THROTTLED, &tty->flags)) {
2324 info->serial_signals |= SerialSignal_RTS; 2324 info->serial_signals |= SerialSignal_RTS;
2325 } 2325 }
@@ -2330,7 +2330,7 @@ static void mgslpc_set_termios(struct tty_struct *tty, struct ktermios *old_term
2330 2330
2331 /* Handle turning off CRTSCTS */ 2331 /* Handle turning off CRTSCTS */
2332 if (old_termios->c_cflag & CRTSCTS && 2332 if (old_termios->c_cflag & CRTSCTS &&
2333 !(tty->termios->c_cflag & CRTSCTS)) { 2333 !(tty->termios.c_cflag & CRTSCTS)) {
2334 tty->hw_stopped = 0; 2334 tty->hw_stopped = 0;
2335 tx_release(tty); 2335 tx_release(tty);
2336 } 2336 }
@@ -2737,6 +2737,8 @@ static void mgslpc_add_device(MGSLPC_INFO *info)
2737#if SYNCLINK_GENERIC_HDLC 2737#if SYNCLINK_GENERIC_HDLC
2738 hdlcdev_init(info); 2738 hdlcdev_init(info);
2739#endif 2739#endif
2740 tty_port_register_device(&info->port, serial_driver, info->line,
2741 &info->p_dev->dev);
2740} 2742}
2741 2743
2742static void mgslpc_remove_device(MGSLPC_INFO *remove_info) 2744static void mgslpc_remove_device(MGSLPC_INFO *remove_info)
@@ -2750,6 +2752,7 @@ static void mgslpc_remove_device(MGSLPC_INFO *remove_info)
2750 last->next_device = info->next_device; 2752 last->next_device = info->next_device;
2751 else 2753 else
2752 mgslpc_device_list = info->next_device; 2754 mgslpc_device_list = info->next_device;
2755 tty_unregister_device(serial_driver, info->line);
2753#if SYNCLINK_GENERIC_HDLC 2756#if SYNCLINK_GENERIC_HDLC
2754 hdlcdev_exit(info); 2757 hdlcdev_exit(info);
2755#endif 2758#endif
@@ -2804,77 +2807,63 @@ static const struct tty_operations mgslpc_ops = {
2804 .proc_fops = &mgslpc_proc_fops, 2807 .proc_fops = &mgslpc_proc_fops,
2805}; 2808};
2806 2809
2807static void synclink_cs_cleanup(void) 2810static int __init synclink_cs_init(void)
2808{ 2811{
2809 int rc; 2812 int rc;
2810 2813
2811 while(mgslpc_device_list) 2814 if (break_on_load) {
2812 mgslpc_remove_device(mgslpc_device_list); 2815 mgslpc_get_text_ptr();
2813 2816 BREAKPOINT();
2814 if (serial_driver) {
2815 if ((rc = tty_unregister_driver(serial_driver)))
2816 printk("%s(%d) failed to unregister tty driver err=%d\n",
2817 __FILE__,__LINE__,rc);
2818 put_tty_driver(serial_driver);
2819 } 2817 }
2820 2818
2821 pcmcia_unregister_driver(&mgslpc_driver); 2819 serial_driver = tty_alloc_driver(MAX_DEVICE_COUNT,
2822} 2820 TTY_DRIVER_REAL_RAW |
2823 2821 TTY_DRIVER_DYNAMIC_DEV);
2824static int __init synclink_cs_init(void) 2822 if (IS_ERR(serial_driver)) {
2825{ 2823 rc = PTR_ERR(serial_driver);
2826 int rc; 2824 goto err;
2827 2825 }
2828 if (break_on_load) {
2829 mgslpc_get_text_ptr();
2830 BREAKPOINT();
2831 }
2832
2833 if ((rc = pcmcia_register_driver(&mgslpc_driver)) < 0)
2834 return rc;
2835
2836 serial_driver = alloc_tty_driver(MAX_DEVICE_COUNT);
2837 if (!serial_driver) {
2838 rc = -ENOMEM;
2839 goto error;
2840 }
2841 2826
2842 /* Initialize the tty_driver structure */ 2827 /* Initialize the tty_driver structure */
2843 2828 serial_driver->driver_name = "synclink_cs";
2844 serial_driver->driver_name = "synclink_cs"; 2829 serial_driver->name = "ttySLP";
2845 serial_driver->name = "ttySLP"; 2830 serial_driver->major = ttymajor;
2846 serial_driver->major = ttymajor; 2831 serial_driver->minor_start = 64;
2847 serial_driver->minor_start = 64; 2832 serial_driver->type = TTY_DRIVER_TYPE_SERIAL;
2848 serial_driver->type = TTY_DRIVER_TYPE_SERIAL; 2833 serial_driver->subtype = SERIAL_TYPE_NORMAL;
2849 serial_driver->subtype = SERIAL_TYPE_NORMAL; 2834 serial_driver->init_termios = tty_std_termios;
2850 serial_driver->init_termios = tty_std_termios; 2835 serial_driver->init_termios.c_cflag =
2851 serial_driver->init_termios.c_cflag = 2836 B9600 | CS8 | CREAD | HUPCL | CLOCAL;
2852 B9600 | CS8 | CREAD | HUPCL | CLOCAL; 2837 tty_set_operations(serial_driver, &mgslpc_ops);
2853 serial_driver->flags = TTY_DRIVER_REAL_RAW; 2838
2854 tty_set_operations(serial_driver, &mgslpc_ops); 2839 rc = tty_register_driver(serial_driver);
2855 2840 if (rc < 0) {
2856 if ((rc = tty_register_driver(serial_driver)) < 0) { 2841 printk(KERN_ERR "%s(%d):Couldn't register serial driver\n",
2857 printk("%s(%d):Couldn't register serial driver\n", 2842 __FILE__, __LINE__);
2858 __FILE__,__LINE__); 2843 goto err_put_tty;
2859 put_tty_driver(serial_driver); 2844 }
2860 serial_driver = NULL;
2861 goto error;
2862 }
2863 2845
2864 printk("%s %s, tty major#%d\n", 2846 rc = pcmcia_register_driver(&mgslpc_driver);
2865 driver_name, driver_version, 2847 if (rc < 0)
2866 serial_driver->major); 2848 goto err_unreg_tty;
2867 2849
2868 return 0; 2850 printk(KERN_INFO "%s %s, tty major#%d\n", driver_name, driver_version,
2851 serial_driver->major);
2869 2852
2870error: 2853 return 0;
2871 synclink_cs_cleanup(); 2854err_unreg_tty:
2872 return rc; 2855 tty_unregister_driver(serial_driver);
2856err_put_tty:
2857 put_tty_driver(serial_driver);
2858err:
2859 return rc;
2873} 2860}
2874 2861
2875static void __exit synclink_cs_exit(void) 2862static void __exit synclink_cs_exit(void)
2876{ 2863{
2877 synclink_cs_cleanup(); 2864 pcmcia_unregister_driver(&mgslpc_driver);
2865 tty_unregister_driver(serial_driver);
2866 put_tty_driver(serial_driver);
2878} 2867}
2879 2868
2880module_init(synclink_cs_init); 2869module_init(synclink_cs_init);
diff --git a/drivers/char/ttyprintk.c b/drivers/char/ttyprintk.c
index 46b77ede84c0..af98f6d6509b 100644
--- a/drivers/char/ttyprintk.c
+++ b/drivers/char/ttyprintk.c
@@ -67,7 +67,7 @@ static int tpk_printk(const unsigned char *buf, int count)
67 tmp[tpk_curr + 1] = '\0'; 67 tmp[tpk_curr + 1] = '\0';
68 printk(KERN_INFO "%s%s", tpk_tag, tmp); 68 printk(KERN_INFO "%s%s", tpk_tag, tmp);
69 tpk_curr = 0; 69 tpk_curr = 0;
70 if (buf[i + 1] == '\n') 70 if ((i + 1) < count && buf[i + 1] == '\n')
71 i++; 71 i++;
72 break; 72 break;
73 case '\n': 73 case '\n':
@@ -178,11 +178,17 @@ static struct tty_driver *ttyprintk_driver;
178static int __init ttyprintk_init(void) 178static int __init ttyprintk_init(void)
179{ 179{
180 int ret = -ENOMEM; 180 int ret = -ENOMEM;
181 void *rp;
182 181
183 ttyprintk_driver = alloc_tty_driver(1); 182 tty_port_init(&tpk_port.port);
184 if (!ttyprintk_driver) 183 tpk_port.port.ops = &null_ops;
185 return ret; 184 mutex_init(&tpk_port.port_write_mutex);
185
186 ttyprintk_driver = tty_alloc_driver(1,
187 TTY_DRIVER_RESET_TERMIOS |
188 TTY_DRIVER_REAL_RAW |
189 TTY_DRIVER_UNNUMBERED_NODE);
190 if (IS_ERR(ttyprintk_driver))
191 return PTR_ERR(ttyprintk_driver);
186 192
187 ttyprintk_driver->driver_name = "ttyprintk"; 193 ttyprintk_driver->driver_name = "ttyprintk";
188 ttyprintk_driver->name = "ttyprintk"; 194 ttyprintk_driver->name = "ttyprintk";
@@ -191,9 +197,8 @@ static int __init ttyprintk_init(void)
191 ttyprintk_driver->type = TTY_DRIVER_TYPE_CONSOLE; 197 ttyprintk_driver->type = TTY_DRIVER_TYPE_CONSOLE;
192 ttyprintk_driver->init_termios = tty_std_termios; 198 ttyprintk_driver->init_termios = tty_std_termios;
193 ttyprintk_driver->init_termios.c_oflag = OPOST | OCRNL | ONOCR | ONLRET; 199 ttyprintk_driver->init_termios.c_oflag = OPOST | OCRNL | ONOCR | ONLRET;
194 ttyprintk_driver->flags = TTY_DRIVER_RESET_TERMIOS |
195 TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
196 tty_set_operations(ttyprintk_driver, &ttyprintk_ops); 200 tty_set_operations(ttyprintk_driver, &ttyprintk_ops);
201 tty_port_link_device(&tpk_port.port, ttyprintk_driver, 0);
197 202
198 ret = tty_register_driver(ttyprintk_driver); 203 ret = tty_register_driver(ttyprintk_driver);
199 if (ret < 0) { 204 if (ret < 0) {
@@ -201,22 +206,10 @@ static int __init ttyprintk_init(void)
201 goto error; 206 goto error;
202 } 207 }
203 208
204 /* create our unnumbered device */
205 rp = device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 3), NULL,
206 ttyprintk_driver->name);
207 if (IS_ERR(rp)) {
208 printk(KERN_ERR "Couldn't create ttyprintk device\n");
209 ret = PTR_ERR(rp);
210 goto error;
211 }
212
213 tty_port_init(&tpk_port.port);
214 tpk_port.port.ops = &null_ops;
215 mutex_init(&tpk_port.port_write_mutex);
216
217 return 0; 209 return 0;
218 210
219error: 211error:
212 tty_unregister_driver(ttyprintk_driver);
220 put_tty_driver(ttyprintk_driver); 213 put_tty_driver(ttyprintk_driver);
221 ttyprintk_driver = NULL; 214 ttyprintk_driver = NULL;
222 return ret; 215 return ret;