diff options
author | Dave Jones <davej@redhat.com> | 2006-12-12 18:13:32 -0500 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2006-12-12 18:13:32 -0500 |
commit | f0eef25339f92f7cd4aeea23d9ae97987a5a1e82 (patch) | |
tree | 2472e94d39f43a9580a6d2d5d92de0b749023263 /drivers/char/epca.c | |
parent | 0cfea5dd98205f2fa318836da664a7d7df1afbc1 (diff) | |
parent | e1036502e5263851259d147771226161e5ccc85a (diff) |
Merge ../linus
Diffstat (limited to 'drivers/char/epca.c')
-rw-r--r-- | drivers/char/epca.c | 75 |
1 files changed, 41 insertions, 34 deletions
diff --git a/drivers/char/epca.c b/drivers/char/epca.c index 86d290e9f307..a0f822c9d74d 100644 --- a/drivers/char/epca.c +++ b/drivers/char/epca.c | |||
@@ -199,8 +199,8 @@ static int pc_ioctl(struct tty_struct *, struct file *, | |||
199 | unsigned int, unsigned long); | 199 | unsigned int, unsigned long); |
200 | static int info_ioctl(struct tty_struct *, struct file *, | 200 | static int info_ioctl(struct tty_struct *, struct file *, |
201 | unsigned int, unsigned long); | 201 | unsigned int, unsigned long); |
202 | static void pc_set_termios(struct tty_struct *, struct termios *); | 202 | static void pc_set_termios(struct tty_struct *, struct ktermios *); |
203 | static void do_softint(void *); | 203 | static void do_softint(struct work_struct *work); |
204 | static void pc_stop(struct tty_struct *); | 204 | static void pc_stop(struct tty_struct *); |
205 | static void pc_start(struct tty_struct *); | 205 | static void pc_start(struct tty_struct *); |
206 | static void pc_throttle(struct tty_struct * tty); | 206 | static void pc_throttle(struct tty_struct * tty); |
@@ -1113,11 +1113,8 @@ static void __exit epca_module_exit(void) | |||
1113 | ch = card_ptr[crd]; | 1113 | ch = card_ptr[crd]; |
1114 | for (count = 0; count < bd->numports; count++, ch++) | 1114 | for (count = 0; count < bd->numports; count++, ch++) |
1115 | { /* Begin for each port */ | 1115 | { /* Begin for each port */ |
1116 | if (ch) { | 1116 | if (ch && ch->tty) |
1117 | if (ch->tty) | 1117 | tty_hangup(ch->tty); |
1118 | tty_hangup(ch->tty); | ||
1119 | kfree(ch->tmp_buf); | ||
1120 | } | ||
1121 | } /* End for each port */ | 1118 | } /* End for each port */ |
1122 | } /* End for each card */ | 1119 | } /* End for each card */ |
1123 | pci_unregister_driver (&epca_driver); | 1120 | pci_unregister_driver (&epca_driver); |
@@ -1125,7 +1122,7 @@ static void __exit epca_module_exit(void) | |||
1125 | 1122 | ||
1126 | module_exit(epca_module_exit); | 1123 | module_exit(epca_module_exit); |
1127 | 1124 | ||
1128 | static struct tty_operations pc_ops = { | 1125 | static const struct tty_operations pc_ops = { |
1129 | .open = pc_open, | 1126 | .open = pc_open, |
1130 | .close = pc_close, | 1127 | .close = pc_close, |
1131 | .write = pc_write, | 1128 | .write = pc_write, |
@@ -1160,6 +1157,7 @@ static int __init pc_init(void) | |||
1160 | int crd; | 1157 | int crd; |
1161 | struct board_info *bd; | 1158 | struct board_info *bd; |
1162 | unsigned char board_id = 0; | 1159 | unsigned char board_id = 0; |
1160 | int err = -ENOMEM; | ||
1163 | 1161 | ||
1164 | int pci_boards_found, pci_count; | 1162 | int pci_boards_found, pci_count; |
1165 | 1163 | ||
@@ -1167,13 +1165,11 @@ static int __init pc_init(void) | |||
1167 | 1165 | ||
1168 | pc_driver = alloc_tty_driver(MAX_ALLOC); | 1166 | pc_driver = alloc_tty_driver(MAX_ALLOC); |
1169 | if (!pc_driver) | 1167 | if (!pc_driver) |
1170 | return -ENOMEM; | 1168 | goto out1; |
1171 | 1169 | ||
1172 | pc_info = alloc_tty_driver(MAX_ALLOC); | 1170 | pc_info = alloc_tty_driver(MAX_ALLOC); |
1173 | if (!pc_info) { | 1171 | if (!pc_info) |
1174 | put_tty_driver(pc_driver); | 1172 | goto out2; |
1175 | return -ENOMEM; | ||
1176 | } | ||
1177 | 1173 | ||
1178 | /* ----------------------------------------------------------------------- | 1174 | /* ----------------------------------------------------------------------- |
1179 | If epca_setup has not been ran by LILO set num_cards to defaults; copy | 1175 | If epca_setup has not been ran by LILO set num_cards to defaults; copy |
@@ -1240,6 +1236,8 @@ static int __init pc_init(void) | |||
1240 | pc_driver->init_termios.c_oflag = 0; | 1236 | pc_driver->init_termios.c_oflag = 0; |
1241 | pc_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | CLOCAL | HUPCL; | 1237 | pc_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | CLOCAL | HUPCL; |
1242 | pc_driver->init_termios.c_lflag = 0; | 1238 | pc_driver->init_termios.c_lflag = 0; |
1239 | pc_driver->init_termios.c_ispeed = 9600; | ||
1240 | pc_driver->init_termios.c_ospeed = 9600; | ||
1243 | pc_driver->flags = TTY_DRIVER_REAL_RAW; | 1241 | pc_driver->flags = TTY_DRIVER_REAL_RAW; |
1244 | tty_set_operations(pc_driver, &pc_ops); | 1242 | tty_set_operations(pc_driver, &pc_ops); |
1245 | 1243 | ||
@@ -1254,6 +1252,8 @@ static int __init pc_init(void) | |||
1254 | pc_info->init_termios.c_oflag = 0; | 1252 | pc_info->init_termios.c_oflag = 0; |
1255 | pc_info->init_termios.c_lflag = 0; | 1253 | pc_info->init_termios.c_lflag = 0; |
1256 | pc_info->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL; | 1254 | pc_info->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL; |
1255 | pc_info->init_termios.c_ispeed = 9600; | ||
1256 | pc_info->init_termios.c_ospeed = 9600; | ||
1257 | pc_info->flags = TTY_DRIVER_REAL_RAW; | 1257 | pc_info->flags = TTY_DRIVER_REAL_RAW; |
1258 | tty_set_operations(pc_info, &info_ops); | 1258 | tty_set_operations(pc_info, &info_ops); |
1259 | 1259 | ||
@@ -1373,11 +1373,17 @@ static int __init pc_init(void) | |||
1373 | 1373 | ||
1374 | } /* End for each card */ | 1374 | } /* End for each card */ |
1375 | 1375 | ||
1376 | if (tty_register_driver(pc_driver)) | 1376 | err = tty_register_driver(pc_driver); |
1377 | panic("Couldn't register Digi PC/ driver"); | 1377 | if (err) { |
1378 | printk(KERN_ERR "Couldn't register Digi PC/ driver"); | ||
1379 | goto out3; | ||
1380 | } | ||
1378 | 1381 | ||
1379 | if (tty_register_driver(pc_info)) | 1382 | err = tty_register_driver(pc_info); |
1380 | panic("Couldn't register Digi PC/ info "); | 1383 | if (err) { |
1384 | printk(KERN_ERR "Couldn't register Digi PC/ info "); | ||
1385 | goto out4; | ||
1386 | } | ||
1381 | 1387 | ||
1382 | /* ------------------------------------------------------------------- | 1388 | /* ------------------------------------------------------------------- |
1383 | Start up the poller to check for events on all enabled boards | 1389 | Start up the poller to check for events on all enabled boards |
@@ -1388,6 +1394,15 @@ static int __init pc_init(void) | |||
1388 | mod_timer(&epca_timer, jiffies + HZ/25); | 1394 | mod_timer(&epca_timer, jiffies + HZ/25); |
1389 | return 0; | 1395 | return 0; |
1390 | 1396 | ||
1397 | out4: | ||
1398 | tty_unregister_driver(pc_driver); | ||
1399 | out3: | ||
1400 | put_tty_driver(pc_info); | ||
1401 | out2: | ||
1402 | put_tty_driver(pc_driver); | ||
1403 | out1: | ||
1404 | return err; | ||
1405 | |||
1391 | } /* End pc_init */ | 1406 | } /* End pc_init */ |
1392 | 1407 | ||
1393 | /* ------------------ Begin post_fep_init ---------------------- */ | 1408 | /* ------------------ Begin post_fep_init ---------------------- */ |
@@ -1494,7 +1509,7 @@ static void post_fep_init(unsigned int crd) | |||
1494 | 1509 | ||
1495 | ch->brdchan = bc; | 1510 | ch->brdchan = bc; |
1496 | ch->mailbox = gd; | 1511 | ch->mailbox = gd; |
1497 | INIT_WORK(&ch->tqueue, do_softint, ch); | 1512 | INIT_WORK(&ch->tqueue, do_softint); |
1498 | ch->board = &boards[crd]; | 1513 | ch->board = &boards[crd]; |
1499 | 1514 | ||
1500 | spin_lock_irqsave(&epca_lock, flags); | 1515 | spin_lock_irqsave(&epca_lock, flags); |
@@ -1635,16 +1650,6 @@ static void post_fep_init(unsigned int crd) | |||
1635 | init_waitqueue_head(&ch->close_wait); | 1650 | init_waitqueue_head(&ch->close_wait); |
1636 | 1651 | ||
1637 | spin_unlock_irqrestore(&epca_lock, flags); | 1652 | spin_unlock_irqrestore(&epca_lock, flags); |
1638 | |||
1639 | ch->tmp_buf = kmalloc(ch->txbufsize,GFP_KERNEL); | ||
1640 | if (!ch->tmp_buf) { | ||
1641 | printk(KERN_ERR "POST FEP INIT : kmalloc failed for port 0x%x\n",i); | ||
1642 | release_region((int)bd->port, 4); | ||
1643 | while(i-- > 0) | ||
1644 | kfree((ch--)->tmp_buf); | ||
1645 | return; | ||
1646 | } else | ||
1647 | memset((void *)ch->tmp_buf,0,ch->txbufsize); | ||
1648 | } /* End for each port */ | 1653 | } /* End for each port */ |
1649 | 1654 | ||
1650 | printk(KERN_INFO | 1655 | printk(KERN_INFO |
@@ -1998,7 +2003,7 @@ static void epcaparam(struct tty_struct *tty, struct channel *ch) | |||
1998 | { /* Begin epcaparam */ | 2003 | { /* Begin epcaparam */ |
1999 | 2004 | ||
2000 | unsigned int cmdHead; | 2005 | unsigned int cmdHead; |
2001 | struct termios *ts; | 2006 | struct ktermios *ts; |
2002 | struct board_chan __iomem *bc; | 2007 | struct board_chan __iomem *bc; |
2003 | unsigned mval, hflow, cflag, iflag; | 2008 | unsigned mval, hflow, cflag, iflag; |
2004 | 2009 | ||
@@ -2113,7 +2118,7 @@ static void receive_data(struct channel *ch) | |||
2113 | { /* Begin receive_data */ | 2118 | { /* Begin receive_data */ |
2114 | 2119 | ||
2115 | unchar *rptr; | 2120 | unchar *rptr; |
2116 | struct termios *ts = NULL; | 2121 | struct ktermios *ts = NULL; |
2117 | struct tty_struct *tty; | 2122 | struct tty_struct *tty; |
2118 | struct board_chan __iomem *bc; | 2123 | struct board_chan __iomem *bc; |
2119 | int dataToRead, wrapgap, bytesAvailable; | 2124 | int dataToRead, wrapgap, bytesAvailable; |
@@ -2361,12 +2366,14 @@ static int pc_ioctl(struct tty_struct *tty, struct file * file, | |||
2361 | switch (cmd) | 2366 | switch (cmd) |
2362 | { /* Begin switch cmd */ | 2367 | { /* Begin switch cmd */ |
2363 | 2368 | ||
2369 | #if 0 /* Handled by calling layer properly */ | ||
2364 | case TCGETS: | 2370 | case TCGETS: |
2365 | if (copy_to_user(argp, tty->termios, sizeof(struct termios))) | 2371 | if (copy_to_user(argp, tty->termios, sizeof(struct ktermios))) |
2366 | return -EFAULT; | 2372 | return -EFAULT; |
2367 | return 0; | 2373 | return 0; |
2368 | case TCGETA: | 2374 | case TCGETA: |
2369 | return get_termio(tty, argp); | 2375 | return get_termio(tty, argp); |
2376 | #endif | ||
2370 | case TCSBRK: /* SVID version: non-zero arg --> no break */ | 2377 | case TCSBRK: /* SVID version: non-zero arg --> no break */ |
2371 | retval = tty_check_change(tty); | 2378 | retval = tty_check_change(tty); |
2372 | if (retval) | 2379 | if (retval) |
@@ -2535,7 +2542,7 @@ static int pc_ioctl(struct tty_struct *tty, struct file * file, | |||
2535 | 2542 | ||
2536 | /* --------------------- Begin pc_set_termios ----------------------- */ | 2543 | /* --------------------- Begin pc_set_termios ----------------------- */ |
2537 | 2544 | ||
2538 | static void pc_set_termios(struct tty_struct *tty, struct termios *old_termios) | 2545 | static void pc_set_termios(struct tty_struct *tty, struct ktermios *old_termios) |
2539 | { /* Begin pc_set_termios */ | 2546 | { /* Begin pc_set_termios */ |
2540 | 2547 | ||
2541 | struct channel *ch; | 2548 | struct channel *ch; |
@@ -2565,9 +2572,9 @@ static void pc_set_termios(struct tty_struct *tty, struct termios *old_termios) | |||
2565 | 2572 | ||
2566 | /* --------------------- Begin do_softint ----------------------- */ | 2573 | /* --------------------- Begin do_softint ----------------------- */ |
2567 | 2574 | ||
2568 | static void do_softint(void *private_) | 2575 | static void do_softint(struct work_struct *work) |
2569 | { /* Begin do_softint */ | 2576 | { /* Begin do_softint */ |
2570 | struct channel *ch = (struct channel *) private_; | 2577 | struct channel *ch = container_of(work, struct channel, tqueue); |
2571 | /* Called in response to a modem change event */ | 2578 | /* Called in response to a modem change event */ |
2572 | if (ch && ch->magic == EPCA_MAGIC) { /* Begin EPCA_MAGIC */ | 2579 | if (ch && ch->magic == EPCA_MAGIC) { /* Begin EPCA_MAGIC */ |
2573 | struct tty_struct *tty = ch->tty; | 2580 | struct tty_struct *tty = ch->tty; |