aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/stallion.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c
index 97c7dc9c0cf0..e45113a7a472 100644
--- a/drivers/char/stallion.c
+++ b/drivers/char/stallion.c
@@ -2348,7 +2348,7 @@ static int __devinit stl_pciprobe(struct pci_dev *pdev,
2348 const struct pci_device_id *ent) 2348 const struct pci_device_id *ent)
2349{ 2349{
2350 struct stlbrd *brdp; 2350 struct stlbrd *brdp;
2351 unsigned int brdtype = ent->driver_data; 2351 unsigned int i, brdtype = ent->driver_data;
2352 int brdnr, retval = -ENODEV; 2352 int brdnr, retval = -ENODEV;
2353 2353
2354 if ((pdev->class >> 8) == PCI_CLASS_STORAGE_IDE) 2354 if ((pdev->class >> 8) == PCI_CLASS_STORAGE_IDE)
@@ -2409,6 +2409,10 @@ static int __devinit stl_pciprobe(struct pci_dev *pdev,
2409 2409
2410 pci_set_drvdata(pdev, brdp); 2410 pci_set_drvdata(pdev, brdp);
2411 2411
2412 for (i = 0; i < brdp->nrports; i++)
2413 tty_register_device(stl_serial,
2414 brdp->brdnr * STL_MAXPORTS + i, &pdev->dev);
2415
2412 return 0; 2416 return 0;
2413err_null: 2417err_null:
2414 stl_brds[brdp->brdnr] = NULL; 2418 stl_brds[brdp->brdnr] = NULL;
@@ -2421,6 +2425,7 @@ err:
2421static void __devexit stl_pciremove(struct pci_dev *pdev) 2425static void __devexit stl_pciremove(struct pci_dev *pdev)
2422{ 2426{
2423 struct stlbrd *brdp = pci_get_drvdata(pdev); 2427 struct stlbrd *brdp = pci_get_drvdata(pdev);
2428 unsigned int i;
2424 2429
2425 free_irq(brdp->irq, brdp); 2430 free_irq(brdp->irq, brdp);
2426 2431
@@ -2430,6 +2435,10 @@ static void __devexit stl_pciremove(struct pci_dev *pdev)
2430 if (brdp->iosize2 > 0) 2435 if (brdp->iosize2 > 0)
2431 release_region(brdp->ioaddr2, brdp->iosize2); 2436 release_region(brdp->ioaddr2, brdp->iosize2);
2432 2437
2438 for (i = 0; i < brdp->nrports; i++)
2439 tty_unregister_device(stl_serial,
2440 brdp->brdnr * STL_MAXPORTS + i);
2441
2433 stl_brds[brdp->brdnr] = NULL; 2442 stl_brds[brdp->brdnr] = NULL;
2434 kfree(brdp); 2443 kfree(brdp);
2435} 2444}
@@ -4693,7 +4702,7 @@ static int __init stallion_module_init(void)
4693{ 4702{
4694 struct stlbrd *brdp; 4703 struct stlbrd *brdp;
4695 struct stlconf conf; 4704 struct stlconf conf;
4696 unsigned int i; 4705 unsigned int i, j;
4697 int retval; 4706 int retval;
4698 4707
4699 printk(KERN_INFO "%s: version %s\n", stl_drvtitle, stl_drvversion); 4708 printk(KERN_INFO "%s: version %s\n", stl_drvtitle, stl_drvversion);
@@ -4720,6 +4729,9 @@ static int __init stallion_module_init(void)
4720 if (stl_brdinit(brdp)) 4729 if (stl_brdinit(brdp))
4721 kfree(brdp); 4730 kfree(brdp);
4722 else { 4731 else {
4732 for (j = 0; j < brdp->nrports; j++)
4733 tty_register_device(stl_serial,
4734 brdp->brdnr * STL_MAXPORTS + j, NULL);
4723 stl_brds[brdp->brdnr] = brdp; 4735 stl_brds[brdp->brdnr] = brdp;
4724 stl_nrbrds = i + 1; 4736 stl_nrbrds = i + 1;
4725 } 4737 }
@@ -4761,7 +4773,7 @@ static int __init stallion_module_init(void)
4761 stl_serial->type = TTY_DRIVER_TYPE_SERIAL; 4773 stl_serial->type = TTY_DRIVER_TYPE_SERIAL;
4762 stl_serial->subtype = SERIAL_TYPE_NORMAL; 4774 stl_serial->subtype = SERIAL_TYPE_NORMAL;
4763 stl_serial->init_termios = stl_deftermios; 4775 stl_serial->init_termios = stl_deftermios;
4764 stl_serial->flags = TTY_DRIVER_REAL_RAW; 4776 stl_serial->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
4765 tty_set_operations(stl_serial, &stl_ops); 4777 tty_set_operations(stl_serial, &stl_ops);
4766 4778
4767 retval = tty_register_driver(stl_serial); 4779 retval = tty_register_driver(stl_serial);
@@ -4787,7 +4799,9 @@ err:
4787 4799
4788static void __exit stallion_module_exit(void) 4800static void __exit stallion_module_exit(void)
4789{ 4801{
4790 int i; 4802 struct stlbrd *brdp;
4803 unsigned int i, j;
4804 int retval;
4791 4805
4792 pr_debug("cleanup_module()\n"); 4806 pr_debug("cleanup_module()\n");
4793 4807
@@ -4800,14 +4814,21 @@ static void __exit stallion_module_exit(void)
4800 * a hangup on every open port - to try to flush out any processes 4814 * a hangup on every open port - to try to flush out any processes
4801 * hanging onto ports. 4815 * hanging onto ports.
4802 */ 4816 */
4817 for (i = 0; i < stl_nrbrds; i++) {
4818 if ((brdp = stl_brds[i]) == NULL || (brdp->state & STL_PROBED))
4819 continue;
4820 for (j = 0; j < brdp->nrports; j++)
4821 tty_unregister_device(stl_serial,
4822 brdp->brdnr * STL_MAXPORTS + j);
4823 }
4803 tty_unregister_driver(stl_serial); 4824 tty_unregister_driver(stl_serial);
4804 put_tty_driver(stl_serial); 4825 put_tty_driver(stl_serial);
4805 4826
4806 for (i = 0; i < 4; i++) 4827 for (i = 0; i < 4; i++)
4807 class_device_destroy(stallion_class, MKDEV(STL_SIOMEMMAJOR, i)); 4828 class_device_destroy(stallion_class, MKDEV(STL_SIOMEMMAJOR, i));
4808 if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem"))) 4829 if ((retval = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem")))
4809 printk("STALLION: failed to un-register serial memory device, " 4830 printk("STALLION: failed to un-register serial memory device, "
4810 "errno=%d\n", -i); 4831 "errno=%d\n", -retval);
4811 class_destroy(stallion_class); 4832 class_destroy(stallion_class);
4812 4833
4813 pci_unregister_driver(&stl_pcidriver); 4834 pci_unregister_driver(&stl_pcidriver);