diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2006-12-08 05:38:52 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-08 11:28:57 -0500 |
commit | 938a7023bbbc626b0ab7ece13fe8cb26cfcc486b (patch) | |
tree | 15049a85d2cebd0cb504c93ed890a989bfda5d2c /drivers/char/isicom.c | |
parent | 8acef8fcab2d824c1c445857f457fb04facc765d (diff) |
[PATCH] Char: isicom, move to tty_register_device
Instead of registering all devices in register_tty_driver, register devices in
probe function and register only port_count devices.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/isicom.c')
-rw-r--r-- | drivers/char/isicom.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index c5cb2a9e68ba..604882dac2d2 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c | |||
@@ -195,6 +195,7 @@ struct isi_board { | |||
195 | signed char count; | 195 | signed char count; |
196 | spinlock_t card_lock; /* Card wide lock 11/5/00 -sameer */ | 196 | spinlock_t card_lock; /* Card wide lock 11/5/00 -sameer */ |
197 | unsigned long flags; | 197 | unsigned long flags; |
198 | unsigned int index; | ||
198 | }; | 199 | }; |
199 | 200 | ||
200 | struct isi_port { | 201 | struct isi_port { |
@@ -1781,6 +1782,7 @@ static int __devinit isicom_probe(struct pci_dev *pdev, | |||
1781 | break; | 1782 | break; |
1782 | } | 1783 | } |
1783 | 1784 | ||
1785 | board->index = index; | ||
1784 | board->base = ioaddr; | 1786 | board->base = ioaddr; |
1785 | board->irq = pciirq; | 1787 | board->irq = pciirq; |
1786 | card++; | 1788 | card++; |
@@ -1811,6 +1813,10 @@ static int __devinit isicom_probe(struct pci_dev *pdev, | |||
1811 | if (retval < 0) | 1813 | if (retval < 0) |
1812 | goto errunri; | 1814 | goto errunri; |
1813 | 1815 | ||
1816 | for (index = 0; index < board->port_count; index++) | ||
1817 | tty_register_device(isicom_normal, board->index * 16 + index, | ||
1818 | &pdev->dev); | ||
1819 | |||
1814 | return 0; | 1820 | return 0; |
1815 | 1821 | ||
1816 | errunri: | 1822 | errunri: |
@@ -1825,6 +1831,10 @@ err: | |||
1825 | static void __devexit isicom_remove(struct pci_dev *pdev) | 1831 | static void __devexit isicom_remove(struct pci_dev *pdev) |
1826 | { | 1832 | { |
1827 | struct isi_board *board = pci_get_drvdata(pdev); | 1833 | struct isi_board *board = pci_get_drvdata(pdev); |
1834 | unsigned int i; | ||
1835 | |||
1836 | for (i = 0; i < board->port_count; i++) | ||
1837 | tty_unregister_device(isicom_normal, board->index * 16 + i); | ||
1828 | 1838 | ||
1829 | free_irq(board->irq, board); | 1839 | free_irq(board->irq, board); |
1830 | release_region(board->base, 16); | 1840 | release_region(board->base, 16); |
@@ -1874,7 +1884,8 @@ static int __init isicom_init(void) | |||
1874 | isicom_normal->init_termios = tty_std_termios; | 1884 | isicom_normal->init_termios = tty_std_termios; |
1875 | isicom_normal->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | | 1885 | isicom_normal->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | |
1876 | CLOCAL; | 1886 | CLOCAL; |
1877 | isicom_normal->flags = TTY_DRIVER_REAL_RAW; | 1887 | isicom_normal->flags = TTY_DRIVER_REAL_RAW | |
1888 | TTY_DRIVER_DYNAMIC_DEV; | ||
1878 | tty_set_operations(isicom_normal, &isicom_ops); | 1889 | tty_set_operations(isicom_normal, &isicom_ops); |
1879 | 1890 | ||
1880 | retval = tty_register_driver(isicom_normal); | 1891 | retval = tty_register_driver(isicom_normal); |