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 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
2736static void mgslpc_remove_device(MGSLPC_INFO *remove_info) 2738static 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
2801static void synclink_cs_cleanup(void) 2804static 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);
2818static 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
2864error: 2847 return 0;
2865 synclink_cs_cleanup(); 2848err_unreg_tty:
2866 return rc; 2849 tty_unregister_driver(serial_driver);
2850err_put_tty:
2851 put_tty_driver(serial_driver);
2852err:
2853 return rc;
2867} 2854}
2868 2855
2869static void __exit synclink_cs_exit(void) 2856static 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
2874module_init(synclink_cs_init); 2863module_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;