TTY: use tty_port_register_device

Currently we have no way to assign tty->port while performing tty
installation. There are two ways to provide the link tty_struct =>
tty_port. Either by calling tty_port_install from tty->ops->install or
tty_port_register_device called instead of tty_register_device when
the device is being set up after connected.

In this patch we modify most of the drivers to do the latter. When the
drivers use tty_register_device and we have tty_port already, we
switch to tty_port_register_device. So we have the tty_struct =>
tty_port link for free for those.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Jiri Slaby
2012-08-07 21:47:47 +02:00
committed by Greg Kroah-Hartman
부모 7e73eca6a7
커밋 734cc17838
20개의 변경된 파일58개의 추가작업 그리고 40개의 파일을 삭제

파일 보기

@@ -3289,7 +3289,7 @@ static int __init cy_detect_isa(void)
struct cyclades_card *card;
unsigned short cy_isa_irq, nboard;
void __iomem *cy_isa_address;
unsigned short i, j, cy_isa_nchan;
unsigned short i, j, k, cy_isa_nchan;
int isparam = 0;
nboard = 0;
@@ -3392,9 +3392,10 @@ static int __init cy_detect_isa(void)
(unsigned long)(cy_isa_address + (CyISA_Ywin - 1)),
cy_isa_irq, cy_isa_nchan, cy_next_channel);
for (j = cy_next_channel;
j < cy_next_channel + cy_isa_nchan; j++)
tty_register_device(cy_serial_driver, j, NULL);
for (k = 0, j = cy_next_channel;
j < cy_next_channel + cy_isa_nchan; j++, k++)
tty_port_register_device(&card->ports[k].port,
cy_serial_driver, j, NULL);
cy_next_channel += cy_isa_nchan;
}
return nboard;
@@ -3698,7 +3699,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
void __iomem *addr0 = NULL, *addr2 = NULL;
char *card_name = NULL;
u32 uninitialized_var(mailbox);
unsigned int device_id, nchan = 0, card_no, i;
unsigned int device_id, nchan = 0, card_no, i, j;
unsigned char plx_ver;
int retval, irq;
@@ -3909,8 +3910,9 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
dev_info(&pdev->dev, "%s/PCI #%d found: %d channels starting from "
"port %d.\n", card_name, card_no + 1, nchan, cy_next_channel);
for (i = cy_next_channel; i < cy_next_channel + nchan; i++)
tty_register_device(cy_serial_driver, i, &pdev->dev);
for (j = 0, i = cy_next_channel; i < cy_next_channel + nchan; i++, j++)
tty_port_register_device(&card->ports[j].port,
cy_serial_driver, i, &pdev->dev);
cy_next_channel += nchan;
return 0;