Commit ec3dde57 authored by Jiri Slaby's avatar Jiri Slaby Committed by Linus Torvalds

[PATCH] Char: istallion, dynamic tty device

register tty device dynamically according to the count of board ports.
Signed-off-by: default avatarJiri Slaby <jirislaby@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f2362c94
...@@ -3846,6 +3846,10 @@ static int stli_findeisabrds(void) ...@@ -3846,6 +3846,10 @@ static int stli_findeisabrds(void)
stli_brds[brdp->brdnr] = brdp; stli_brds[brdp->brdnr] = brdp;
found++; found++;
for (i = 0; i < brdp->nrports; i++)
tty_register_device(stli_serial,
brdp->brdnr * STL_MAXPORTS + i, NULL);
} }
return found; return found;
...@@ -3872,6 +3876,7 @@ static int __devinit stli_pciprobe(struct pci_dev *pdev, ...@@ -3872,6 +3876,7 @@ static int __devinit stli_pciprobe(struct pci_dev *pdev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
struct stlibrd *brdp; struct stlibrd *brdp;
unsigned int i;
int brdnr, retval = -EIO; int brdnr, retval = -EIO;
retval = pci_enable_device(pdev); retval = pci_enable_device(pdev);
...@@ -3912,6 +3917,10 @@ static int __devinit stli_pciprobe(struct pci_dev *pdev, ...@@ -3912,6 +3917,10 @@ static int __devinit stli_pciprobe(struct pci_dev *pdev,
brdp->enable = NULL; brdp->enable = NULL;
brdp->disable = NULL; brdp->disable = NULL;
for (i = 0; i < brdp->nrports; i++)
tty_register_device(stli_serial, brdp->brdnr * STL_MAXPORTS + i,
&pdev->dev);
return 0; return 0;
err_null: err_null:
stli_brds[brdp->brdnr] = NULL; stli_brds[brdp->brdnr] = NULL;
...@@ -3992,6 +4001,10 @@ static int stli_initbrds(void) ...@@ -3992,6 +4001,10 @@ static int stli_initbrds(void)
} }
stli_brds[brdp->brdnr] = brdp; stli_brds[brdp->brdnr] = brdp;
found++; found++;
for (i = 0; i < brdp->nrports; i++)
tty_register_device(stli_serial,
brdp->brdnr * STL_MAXPORTS + i, NULL);
} }
retval = stli_findeisabrds(); retval = stli_findeisabrds();
...@@ -4596,7 +4609,7 @@ static int __init istallion_module_init(void) ...@@ -4596,7 +4609,7 @@ static int __init istallion_module_init(void)
stli_serial->type = TTY_DRIVER_TYPE_SERIAL; stli_serial->type = TTY_DRIVER_TYPE_SERIAL;
stli_serial->subtype = SERIAL_TYPE_NORMAL; stli_serial->subtype = SERIAL_TYPE_NORMAL;
stli_serial->init_termios = stli_deftermios; stli_serial->init_termios = stli_deftermios;
stli_serial->flags = TTY_DRIVER_REAL_RAW; stli_serial->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
tty_set_operations(stli_serial, &stli_ops); tty_set_operations(stli_serial, &stli_ops);
retval = tty_register_driver(stli_serial); retval = tty_register_driver(stli_serial);
......
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