aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPaul Fulghum <paulkf@microgate.com>2007-05-08 03:31:48 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:15:15 -0400
commit62eb5b1f3bb842d4ea112a5dbae0ce94aab088c4 (patch)
tree64e06239c13a90201c54c33e4c0f7a945fcb0401 /drivers
parentcef2cf07273d12ac3453d2baff096423f17b7403 (diff)
synclink_gt use dynamic tty device registration
Change synclink_gt driver to use dynamic tty device registration. Signed-off-by: Paul Fulghum <paulkf@microgate.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/synclink_gt.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
index 0a367cd4121f..2a7736b5f2f7 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/char/synclink_gt.c
@@ -3415,6 +3415,9 @@ static void device_init(int adapter_num, struct pci_dev *pdev)
3415 } 3415 }
3416 } 3416 }
3417 } 3417 }
3418
3419 for (i=0; i < port_count; ++i)
3420 tty_register_device(serial_driver, port_array[i]->line, &(port_array[i]->pdev->dev));
3418} 3421}
3419 3422
3420static int __devinit init_one(struct pci_dev *dev, 3423static int __devinit init_one(struct pci_dev *dev,
@@ -3466,6 +3469,8 @@ static void slgt_cleanup(void)
3466 printk("unload %s %s\n", driver_name, driver_version); 3469 printk("unload %s %s\n", driver_name, driver_version);
3467 3470
3468 if (serial_driver) { 3471 if (serial_driver) {
3472 for (info=slgt_device_list ; info != NULL ; info=info->next_device)
3473 tty_unregister_device(serial_driver, info->line);
3469 if ((rc = tty_unregister_driver(serial_driver))) 3474 if ((rc = tty_unregister_driver(serial_driver)))
3470 DBGERR(("tty_unregister_driver error=%d\n", rc)); 3475 DBGERR(("tty_unregister_driver error=%d\n", rc));
3471 put_tty_driver(serial_driver); 3476 put_tty_driver(serial_driver);
@@ -3506,23 +3511,10 @@ static int __init slgt_init(void)
3506 3511
3507 printk("%s %s\n", driver_name, driver_version); 3512 printk("%s %s\n", driver_name, driver_version);
3508 3513
3509 slgt_device_count = 0;
3510 if ((rc = pci_register_driver(&pci_driver)) < 0) {
3511 printk("%s pci_register_driver error=%d\n", driver_name, rc);
3512 return rc;
3513 }
3514 pci_registered = 1;
3515
3516 if (!slgt_device_list) {
3517 printk("%s no devices found\n",driver_name);
3518 pci_unregister_driver(&pci_driver);
3519 return -ENODEV;
3520 }
3521
3522 serial_driver = alloc_tty_driver(MAX_DEVICES); 3514 serial_driver = alloc_tty_driver(MAX_DEVICES);
3523 if (!serial_driver) { 3515 if (!serial_driver) {
3524 rc = -ENOMEM; 3516 printk("%s can't allocate tty driver\n", driver_name);
3525 goto error; 3517 return -ENOMEM;
3526 } 3518 }
3527 3519
3528 /* Initialize the tty_driver structure */ 3520 /* Initialize the tty_driver structure */
@@ -3539,7 +3531,7 @@ static int __init slgt_init(void)
3539 B9600 | CS8 | CREAD | HUPCL | CLOCAL; 3531 B9600 | CS8 | CREAD | HUPCL | CLOCAL;
3540 serial_driver->init_termios.c_ispeed = 9600; 3532 serial_driver->init_termios.c_ispeed = 9600;
3541 serial_driver->init_termios.c_ospeed = 9600; 3533 serial_driver->init_termios.c_ospeed = 9600;
3542 serial_driver->flags = TTY_DRIVER_REAL_RAW; 3534 serial_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
3543 tty_set_operations(serial_driver, &ops); 3535 tty_set_operations(serial_driver, &ops);
3544 if ((rc = tty_register_driver(serial_driver)) < 0) { 3536 if ((rc = tty_register_driver(serial_driver)) < 0) {
3545 DBGERR(("%s can't register serial driver\n", driver_name)); 3537 DBGERR(("%s can't register serial driver\n", driver_name));
@@ -3552,6 +3544,16 @@ static int __init slgt_init(void)
3552 driver_name, driver_version, 3544 driver_name, driver_version,
3553 serial_driver->major); 3545 serial_driver->major);
3554 3546
3547 slgt_device_count = 0;
3548 if ((rc = pci_register_driver(&pci_driver)) < 0) {
3549 printk("%s pci_register_driver error=%d\n", driver_name, rc);
3550 goto error;
3551 }
3552 pci_registered = 1;
3553
3554 if (!slgt_device_list)
3555 printk("%s no devices found\n",driver_name);
3556
3555 return 0; 3557 return 0;
3556 3558
3557error: 3559error: