aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2007-05-08 03:36:22 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:15:24 -0400
commit6ad1ccc196f76833f41b187e01a28a024fe11f8b (patch)
treeb4089748a6d5305fc6338b5adbe83dbb4766ec25 /drivers/char
parent9dacf3b2f0cc657a5621e7f6d67ed27ce598f405 (diff)
Char: cyclades, tty_register_device separately for each device
Do not register all tty devices at the init time, delay it for the time until some device is found. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/cyclades.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 970d99a69a2b..4434c1347221 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -4841,6 +4841,9 @@ static int __init cy_detect_isa(void)
4841 cy_isa_irq); 4841 cy_isa_irq);
4842 printk("%d channels starting from port %d.\n", 4842 printk("%d channels starting from port %d.\n",
4843 cy_isa_nchan, cy_next_channel); 4843 cy_isa_nchan, cy_next_channel);
4844 for (j = cy_next_channel;
4845 j < cy_next_channel + cy_isa_nchan; j++)
4846 tty_register_device(cy_serial_driver, j, NULL);
4844 cy_next_channel += cy_isa_nchan; 4847 cy_next_channel += cy_isa_nchan;
4845 } 4848 }
4846 return nboard; 4849 return nboard;
@@ -4948,6 +4951,8 @@ static int __devinit cy_init_Ze(unsigned long cy_pci_phys0,
4948 4951
4949 printk("%d channels starting from port %d.\n", 4952 printk("%d channels starting from port %d.\n",
4950 cy_pci_nchan, cy_next_channel); 4953 cy_pci_nchan, cy_next_channel);
4954 for (j = cy_next_channel; j < cy_next_channel + cy_pci_nchan; j++)
4955 tty_register_device(cy_serial_driver, j, &pdev->dev);
4951 cy_next_channel += cy_pci_nchan; 4956 cy_next_channel += cy_pci_nchan;
4952 4957
4953 return 0; 4958 return 0;
@@ -5115,6 +5120,9 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
5115 (int)cy_pci_irq); 5120 (int)cy_pci_irq);
5116 printk("%d channels starting from port %d.\n", 5121 printk("%d channels starting from port %d.\n",
5117 cy_pci_nchan, cy_next_channel); 5122 cy_pci_nchan, cy_next_channel);
5123 for (j = cy_next_channel;
5124 j < cy_next_channel + cy_pci_nchan; j++)
5125 tty_register_device(cy_serial_driver, j, &pdev->dev);
5118 5126
5119 cy_next_channel += cy_pci_nchan; 5127 cy_next_channel += cy_pci_nchan;
5120 } else if (device_id == PCI_DEVICE_ID_CYCLOM_Z_Lo) { 5128 } else if (device_id == PCI_DEVICE_ID_CYCLOM_Z_Lo) {
@@ -5282,6 +5290,9 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
5282 5290
5283 printk("%d channels starting from port %d.\n", 5291 printk("%d channels starting from port %d.\n",
5284 cy_pci_nchan, cy_next_channel); 5292 cy_pci_nchan, cy_next_channel);
5293 for (j = cy_next_channel;
5294 j < cy_next_channel + cy_pci_nchan; j++)
5295 tty_register_device(cy_serial_driver, j, &pdev->dev);
5285 cy_next_channel += cy_pci_nchan; 5296 cy_next_channel += cy_pci_nchan;
5286 } 5297 }
5287 5298
@@ -5346,6 +5357,9 @@ static void __devexit cy_pci_release(struct pci_dev *pdev)
5346 cy_port[i].line = -1; 5357 cy_port[i].line = -1;
5347 cy_port[i].magic = -1; 5358 cy_port[i].magic = -1;
5348 } 5359 }
5360 for (i = cinfo->first_line; i < cinfo->first_line +
5361 cinfo->nports; i++)
5362 tty_unregister_device(cy_serial_driver, i);
5349#endif 5363#endif
5350} 5364}
5351 5365
@@ -5479,7 +5493,7 @@ static int __init cy_init(void)
5479 cy_serial_driver->init_termios = tty_std_termios; 5493 cy_serial_driver->init_termios = tty_std_termios;
5480 cy_serial_driver->init_termios.c_cflag = 5494 cy_serial_driver->init_termios.c_cflag =
5481 B9600 | CS8 | CREAD | HUPCL | CLOCAL; 5495 B9600 | CS8 | CREAD | HUPCL | CLOCAL;
5482 cy_serial_driver->flags = TTY_DRIVER_REAL_RAW; 5496 cy_serial_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
5483 tty_set_operations(cy_serial_driver, &cy_ops); 5497 tty_set_operations(cy_serial_driver, &cy_ops);
5484 5498
5485 retval = tty_register_driver(cy_serial_driver); 5499 retval = tty_register_driver(cy_serial_driver);
@@ -5555,6 +5569,10 @@ static void __exit cy_cleanup_module(void)
5555#endif /* CONFIG_CYZ_INTR */ 5569#endif /* CONFIG_CYZ_INTR */
5556 ) 5570 )
5557 free_irq(cy_card[i].irq, &cy_card[i]); 5571 free_irq(cy_card[i].irq, &cy_card[i]);
5572 for (e1 = cy_card[i].first_line;
5573 e1 < cy_card[i].first_line +
5574 cy_card[i].nports; e1++)
5575 tty_unregister_device(cy_serial_driver, e1);
5558 } 5576 }
5559 } 5577 }
5560} /* cy_cleanup_module */ 5578} /* cy_cleanup_module */