mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-13 20:33:15 +00:00
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>
This commit is contained in:
parent
cef2cf0727
commit
62eb5b1f3b
@ -3415,6 +3415,9 @@ static void device_init(int adapter_num, struct pci_dev *pdev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i=0; i < port_count; ++i)
|
||||||
|
tty_register_device(serial_driver, port_array[i]->line, &(port_array[i]->pdev->dev));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __devinit init_one(struct pci_dev *dev,
|
static int __devinit init_one(struct pci_dev *dev,
|
||||||
@ -3466,6 +3469,8 @@ static void slgt_cleanup(void)
|
|||||||
printk("unload %s %s\n", driver_name, driver_version);
|
printk("unload %s %s\n", driver_name, driver_version);
|
||||||
|
|
||||||
if (serial_driver) {
|
if (serial_driver) {
|
||||||
|
for (info=slgt_device_list ; info != NULL ; info=info->next_device)
|
||||||
|
tty_unregister_device(serial_driver, info->line);
|
||||||
if ((rc = tty_unregister_driver(serial_driver)))
|
if ((rc = tty_unregister_driver(serial_driver)))
|
||||||
DBGERR(("tty_unregister_driver error=%d\n", rc));
|
DBGERR(("tty_unregister_driver error=%d\n", rc));
|
||||||
put_tty_driver(serial_driver);
|
put_tty_driver(serial_driver);
|
||||||
@ -3506,23 +3511,10 @@ static int __init slgt_init(void)
|
|||||||
|
|
||||||
printk("%s %s\n", driver_name, driver_version);
|
printk("%s %s\n", driver_name, driver_version);
|
||||||
|
|
||||||
slgt_device_count = 0;
|
|
||||||
if ((rc = pci_register_driver(&pci_driver)) < 0) {
|
|
||||||
printk("%s pci_register_driver error=%d\n", driver_name, rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
pci_registered = 1;
|
|
||||||
|
|
||||||
if (!slgt_device_list) {
|
|
||||||
printk("%s no devices found\n",driver_name);
|
|
||||||
pci_unregister_driver(&pci_driver);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
serial_driver = alloc_tty_driver(MAX_DEVICES);
|
serial_driver = alloc_tty_driver(MAX_DEVICES);
|
||||||
if (!serial_driver) {
|
if (!serial_driver) {
|
||||||
rc = -ENOMEM;
|
printk("%s can't allocate tty driver\n", driver_name);
|
||||||
goto error;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the tty_driver structure */
|
/* Initialize the tty_driver structure */
|
||||||
@ -3539,7 +3531,7 @@ static int __init slgt_init(void)
|
|||||||
B9600 | CS8 | CREAD | HUPCL | CLOCAL;
|
B9600 | CS8 | CREAD | HUPCL | CLOCAL;
|
||||||
serial_driver->init_termios.c_ispeed = 9600;
|
serial_driver->init_termios.c_ispeed = 9600;
|
||||||
serial_driver->init_termios.c_ospeed = 9600;
|
serial_driver->init_termios.c_ospeed = 9600;
|
||||||
serial_driver->flags = TTY_DRIVER_REAL_RAW;
|
serial_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
|
||||||
tty_set_operations(serial_driver, &ops);
|
tty_set_operations(serial_driver, &ops);
|
||||||
if ((rc = tty_register_driver(serial_driver)) < 0) {
|
if ((rc = tty_register_driver(serial_driver)) < 0) {
|
||||||
DBGERR(("%s can't register serial driver\n", driver_name));
|
DBGERR(("%s can't register serial driver\n", driver_name));
|
||||||
@ -3552,6 +3544,16 @@ static int __init slgt_init(void)
|
|||||||
driver_name, driver_version,
|
driver_name, driver_version,
|
||||||
serial_driver->major);
|
serial_driver->major);
|
||||||
|
|
||||||
|
slgt_device_count = 0;
|
||||||
|
if ((rc = pci_register_driver(&pci_driver)) < 0) {
|
||||||
|
printk("%s pci_register_driver error=%d\n", driver_name, rc);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
pci_registered = 1;
|
||||||
|
|
||||||
|
if (!slgt_device_list)
|
||||||
|
printk("%s no devices found\n",driver_name);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
Loading…
Reference in New Issue
Block a user