Commit 938a7023 authored by Jiri Slaby's avatar Jiri Slaby Committed by Linus Torvalds

[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: default avatarJiri Slaby <jirislaby@gmail.com>
Cc: Alan Cox <alan@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8acef8fc
...@@ -195,6 +195,7 @@ struct isi_board { ...@@ -195,6 +195,7 @@ struct isi_board {
signed char count; signed char count;
spinlock_t card_lock; /* Card wide lock 11/5/00 -sameer */ spinlock_t card_lock; /* Card wide lock 11/5/00 -sameer */
unsigned long flags; unsigned long flags;
unsigned int index;
}; };
struct isi_port { struct isi_port {
...@@ -1781,6 +1782,7 @@ static int __devinit isicom_probe(struct pci_dev *pdev, ...@@ -1781,6 +1782,7 @@ static int __devinit isicom_probe(struct pci_dev *pdev,
break; break;
} }
board->index = index;
board->base = ioaddr; board->base = ioaddr;
board->irq = pciirq; board->irq = pciirq;
card++; card++;
...@@ -1811,6 +1813,10 @@ static int __devinit isicom_probe(struct pci_dev *pdev, ...@@ -1811,6 +1813,10 @@ static int __devinit isicom_probe(struct pci_dev *pdev,
if (retval < 0) if (retval < 0)
goto errunri; goto errunri;
for (index = 0; index < board->port_count; index++)
tty_register_device(isicom_normal, board->index * 16 + index,
&pdev->dev);
return 0; return 0;
errunri: errunri:
...@@ -1825,6 +1831,10 @@ static int __devinit isicom_probe(struct pci_dev *pdev, ...@@ -1825,6 +1831,10 @@ static int __devinit isicom_probe(struct pci_dev *pdev,
static void __devexit isicom_remove(struct pci_dev *pdev) static void __devexit isicom_remove(struct pci_dev *pdev)
{ {
struct isi_board *board = pci_get_drvdata(pdev); struct isi_board *board = pci_get_drvdata(pdev);
unsigned int i;
for (i = 0; i < board->port_count; i++)
tty_unregister_device(isicom_normal, board->index * 16 + i);
free_irq(board->irq, board); free_irq(board->irq, board);
release_region(board->base, 16); release_region(board->base, 16);
...@@ -1874,7 +1884,8 @@ static int __init isicom_init(void) ...@@ -1874,7 +1884,8 @@ static int __init isicom_init(void)
isicom_normal->init_termios = tty_std_termios; isicom_normal->init_termios = tty_std_termios;
isicom_normal->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | isicom_normal->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL |
CLOCAL; CLOCAL;
isicom_normal->flags = TTY_DRIVER_REAL_RAW; isicom_normal->flags = TTY_DRIVER_REAL_RAW |
TTY_DRIVER_DYNAMIC_DEV;
tty_set_operations(isicom_normal, &isicom_ops); tty_set_operations(isicom_normal, &isicom_ops);
retval = tty_register_driver(isicom_normal); retval = tty_register_driver(isicom_normal);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment