aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/specialix.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/specialix.c')
-rw-r--r--drivers/char/specialix.c29
1 files changed, 6 insertions, 23 deletions
diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c
index a1d303f9a33d..902c48dca3bc 100644
--- a/drivers/char/specialix.c
+++ b/drivers/char/specialix.c
@@ -182,7 +182,6 @@ static int sx_poll = HZ;
182#define RS_EVENT_WRITE_WAKEUP 0 182#define RS_EVENT_WRITE_WAKEUP 0
183 183
184static struct tty_driver *specialix_driver; 184static struct tty_driver *specialix_driver;
185static unsigned char * tmp_buf;
186 185
187static unsigned long baud_table[] = { 186static unsigned long baud_table[] = {
188 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 187 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800,
@@ -1087,24 +1086,16 @@ static void sx_change_speed(struct specialix_board *bp, struct specialix_port *p
1087 port->MSVR = (sx_in(bp, CD186x_MSVR) & MSVR_RTS); 1086 port->MSVR = (sx_in(bp, CD186x_MSVR) & MSVR_RTS);
1088 spin_unlock_irqrestore(&bp->lock, flags); 1087 spin_unlock_irqrestore(&bp->lock, flags);
1089 dprintk (SX_DEBUG_TERMIOS, "sx: got MSVR=%02x.\n", port->MSVR); 1088 dprintk (SX_DEBUG_TERMIOS, "sx: got MSVR=%02x.\n", port->MSVR);
1090 baud = C_BAUD(tty); 1089 baud = tty_get_baud_rate(tty);
1091 1090
1092 if (baud & CBAUDEX) { 1091 if (baud == 38400) {
1093 baud &= ~CBAUDEX;
1094 if (baud < 1 || baud > 2)
1095 port->tty->termios->c_cflag &= ~CBAUDEX;
1096 else
1097 baud += 15;
1098 }
1099 if (baud == 15) {
1100 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 1092 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
1101 baud ++; 1093 baud ++;
1102 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) 1094 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
1103 baud += 2; 1095 baud += 2;
1104 } 1096 }
1105 1097
1106 1098 if (!baud) {
1107 if (!baud_table[baud]) {
1108 /* Drop DTR & exit */ 1099 /* Drop DTR & exit */
1109 dprintk (SX_DEBUG_TERMIOS, "Dropping DTR... Hmm....\n"); 1100 dprintk (SX_DEBUG_TERMIOS, "Dropping DTR... Hmm....\n");
1110 if (!SX_CRTSCTS (tty)) { 1101 if (!SX_CRTSCTS (tty)) {
@@ -1134,7 +1125,7 @@ static void sx_change_speed(struct specialix_board *bp, struct specialix_port *p
1134 "This is an untested option, please be carefull.\n", 1125 "This is an untested option, please be carefull.\n",
1135 port_No (port), tmp); 1126 port_No (port), tmp);
1136 else 1127 else
1137 tmp = (((SX_OSCFREQ + baud_table[baud]/2) / baud_table[baud] + 1128 tmp = (((SX_OSCFREQ + baud/2) / baud +
1138 CD186x_TPC/2) / CD186x_TPC); 1129 CD186x_TPC/2) / CD186x_TPC);
1139 1130
1140 if ((tmp < 0x10) && time_before(again, jiffies)) { 1131 if ((tmp < 0x10) && time_before(again, jiffies)) {
@@ -1682,7 +1673,7 @@ static int sx_write(struct tty_struct * tty,
1682 1673
1683 bp = port_Board(port); 1674 bp = port_Board(port);
1684 1675
1685 if (!port->xmit_buf || !tmp_buf) { 1676 if (!port->xmit_buf) {
1686 func_exit(); 1677 func_exit();
1687 return 0; 1678 return 0;
1688 } 1679 }
@@ -2372,7 +2363,7 @@ static void do_softint(void *private_)
2372 func_exit(); 2363 func_exit();
2373} 2364}
2374 2365
2375static struct tty_operations sx_ops = { 2366static const struct tty_operations sx_ops = {
2376 .open = sx_open, 2367 .open = sx_open,
2377 .close = sx_close, 2368 .close = sx_close,
2378 .write = sx_write, 2369 .write = sx_write,
@@ -2406,12 +2397,6 @@ static int sx_init_drivers(void)
2406 return 1; 2397 return 1;
2407 } 2398 }
2408 2399
2409 if (!(tmp_buf = (unsigned char *) get_zeroed_page(GFP_KERNEL))) {
2410 printk(KERN_ERR "sx: Couldn't get free page.\n");
2411 put_tty_driver(specialix_driver);
2412 func_exit();
2413 return 1;
2414 }
2415 specialix_driver->owner = THIS_MODULE; 2400 specialix_driver->owner = THIS_MODULE;
2416 specialix_driver->name = "ttyW"; 2401 specialix_driver->name = "ttyW";
2417 specialix_driver->major = SPECIALIX_NORMAL_MAJOR; 2402 specialix_driver->major = SPECIALIX_NORMAL_MAJOR;
@@ -2425,7 +2410,6 @@ static int sx_init_drivers(void)
2425 2410
2426 if ((error = tty_register_driver(specialix_driver))) { 2411 if ((error = tty_register_driver(specialix_driver))) {
2427 put_tty_driver(specialix_driver); 2412 put_tty_driver(specialix_driver);
2428 free_page((unsigned long)tmp_buf);
2429 printk(KERN_ERR "sx: Couldn't register specialix IO8+ driver, error = %d\n", 2413 printk(KERN_ERR "sx: Couldn't register specialix IO8+ driver, error = %d\n",
2430 error); 2414 error);
2431 func_exit(); 2415 func_exit();
@@ -2451,7 +2435,6 @@ static void sx_release_drivers(void)
2451{ 2435{
2452 func_enter(); 2436 func_enter();
2453 2437
2454 free_page((unsigned long)tmp_buf);
2455 tty_unregister_driver(specialix_driver); 2438 tty_unregister_driver(specialix_driver);
2456 put_tty_driver(specialix_driver); 2439 put_tty_driver(specialix_driver);
2457 func_exit(); 2440 func_exit();