diff options
Diffstat (limited to 'drivers/tty/isicom.c')
-rw-r--r-- | drivers/tty/isicom.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/drivers/tty/isicom.c b/drivers/tty/isicom.c index 3205b2e9090..db1cf9c328d 100644 --- a/drivers/tty/isicom.c +++ b/drivers/tty/isicom.c | |||
@@ -102,7 +102,7 @@ | |||
102 | * You can find the original tools for this direct from Multitech | 102 | * You can find the original tools for this direct from Multitech |
103 | * ftp://ftp.multitech.com/ISI-Cards/ | 103 | * ftp://ftp.multitech.com/ISI-Cards/ |
104 | * | 104 | * |
105 | * Having installed the cards the module options (/etc/modprobe.d/) | 105 | * Having installed the cards the module options (/etc/modprobe.conf) |
106 | * | 106 | * |
107 | * options isicom io=card1,card2,card3,card4 irq=card1,card2,card3,card4 | 107 | * options isicom io=card1,card2,card3,card4 irq=card1,card2,card3,card4 |
108 | * | 108 | * |
@@ -133,6 +133,7 @@ | |||
133 | 133 | ||
134 | #include <linux/uaccess.h> | 134 | #include <linux/uaccess.h> |
135 | #include <linux/io.h> | 135 | #include <linux/io.h> |
136 | #include <asm/system.h> | ||
136 | 137 | ||
137 | #include <linux/pci.h> | 138 | #include <linux/pci.h> |
138 | 139 | ||
@@ -148,7 +149,7 @@ | |||
148 | #endif | 149 | #endif |
149 | 150 | ||
150 | static int isicom_probe(struct pci_dev *, const struct pci_device_id *); | 151 | static int isicom_probe(struct pci_dev *, const struct pci_device_id *); |
151 | static void isicom_remove(struct pci_dev *); | 152 | static void __devexit isicom_remove(struct pci_dev *); |
152 | 153 | ||
153 | static struct pci_device_id isicom_pci_tbl[] = { | 154 | static struct pci_device_id isicom_pci_tbl[] = { |
154 | { PCI_DEVICE(VENDOR_ID, 0x2028) }, | 155 | { PCI_DEVICE(VENDOR_ID, 0x2028) }, |
@@ -168,7 +169,7 @@ static struct pci_driver isicom_driver = { | |||
168 | .name = "isicom", | 169 | .name = "isicom", |
169 | .id_table = isicom_pci_tbl, | 170 | .id_table = isicom_pci_tbl, |
170 | .probe = isicom_probe, | 171 | .probe = isicom_probe, |
171 | .remove = isicom_remove | 172 | .remove = __devexit_p(isicom_remove) |
172 | }; | 173 | }; |
173 | 174 | ||
174 | static int prev_card = 3; /* start servicing isi_card[0] */ | 175 | static int prev_card = 3; /* start servicing isi_card[0] */ |
@@ -600,10 +601,10 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id) | |||
600 | port->status &= ~ISI_DCD; | 601 | port->status &= ~ISI_DCD; |
601 | } | 602 | } |
602 | 603 | ||
603 | if (tty_port_cts_enabled(&port->port)) { | 604 | if (port->port.flags & ASYNC_CTS_FLOW) { |
604 | if (tty->hw_stopped) { | 605 | if (tty->hw_stopped) { |
605 | if (header & ISI_CTS) { | 606 | if (header & ISI_CTS) { |
606 | tty->hw_stopped = 0; | 607 | port->port.tty->hw_stopped = 0; |
607 | /* start tx ing */ | 608 | /* start tx ing */ |
608 | port->status |= (ISI_TXOK | 609 | port->status |= (ISI_TXOK |
609 | | ISI_CTS); | 610 | | ISI_CTS); |
@@ -702,7 +703,7 @@ static void isicom_config_port(struct tty_struct *tty) | |||
702 | 703 | ||
703 | /* 1,2,3,4 => 57.6, 115.2, 230, 460 kbps resp. */ | 704 | /* 1,2,3,4 => 57.6, 115.2, 230, 460 kbps resp. */ |
704 | if (baud < 1 || baud > 4) | 705 | if (baud < 1 || baud > 4) |
705 | tty->termios.c_cflag &= ~CBAUDEX; | 706 | tty->termios->c_cflag &= ~CBAUDEX; |
706 | else | 707 | else |
707 | baud += 15; | 708 | baud += 15; |
708 | } | 709 | } |
@@ -848,6 +849,8 @@ static struct tty_port *isicom_find_port(struct tty_struct *tty) | |||
848 | unsigned int board; | 849 | unsigned int board; |
849 | int line = tty->index; | 850 | int line = tty->index; |
850 | 851 | ||
852 | if (line < 0 || line > PORT_COUNT-1) | ||
853 | return NULL; | ||
851 | board = BOARD(line); | 854 | board = BOARD(line); |
852 | card = &isi_card[board]; | 855 | card = &isi_card[board]; |
853 | 856 | ||
@@ -1196,8 +1199,8 @@ static void isicom_set_termios(struct tty_struct *tty, | |||
1196 | if (isicom_paranoia_check(port, tty->name, "isicom_set_termios")) | 1199 | if (isicom_paranoia_check(port, tty->name, "isicom_set_termios")) |
1197 | return; | 1200 | return; |
1198 | 1201 | ||
1199 | if (tty->termios.c_cflag == old_termios->c_cflag && | 1202 | if (tty->termios->c_cflag == old_termios->c_cflag && |
1200 | tty->termios.c_iflag == old_termios->c_iflag) | 1203 | tty->termios->c_iflag == old_termios->c_iflag) |
1201 | return; | 1204 | return; |
1202 | 1205 | ||
1203 | spin_lock_irqsave(&port->card->card_lock, flags); | 1206 | spin_lock_irqsave(&port->card->card_lock, flags); |
@@ -1205,7 +1208,7 @@ static void isicom_set_termios(struct tty_struct *tty, | |||
1205 | spin_unlock_irqrestore(&port->card->card_lock, flags); | 1208 | spin_unlock_irqrestore(&port->card->card_lock, flags); |
1206 | 1209 | ||
1207 | if ((old_termios->c_cflag & CRTSCTS) && | 1210 | if ((old_termios->c_cflag & CRTSCTS) && |
1208 | !(tty->termios.c_cflag & CRTSCTS)) { | 1211 | !(tty->termios->c_cflag & CRTSCTS)) { |
1209 | tty->hw_stopped = 0; | 1212 | tty->hw_stopped = 0; |
1210 | isicom_start(tty); | 1213 | isicom_start(tty); |
1211 | } | 1214 | } |
@@ -1307,7 +1310,7 @@ static const struct tty_port_operations isicom_port_ops = { | |||
1307 | .shutdown = isicom_shutdown, | 1310 | .shutdown = isicom_shutdown, |
1308 | }; | 1311 | }; |
1309 | 1312 | ||
1310 | static int reset_card(struct pci_dev *pdev, | 1313 | static int __devinit reset_card(struct pci_dev *pdev, |
1311 | const unsigned int card, unsigned int *signature) | 1314 | const unsigned int card, unsigned int *signature) |
1312 | { | 1315 | { |
1313 | struct isi_board *board = pci_get_drvdata(pdev); | 1316 | struct isi_board *board = pci_get_drvdata(pdev); |
@@ -1368,7 +1371,7 @@ end: | |||
1368 | return retval; | 1371 | return retval; |
1369 | } | 1372 | } |
1370 | 1373 | ||
1371 | static int load_firmware(struct pci_dev *pdev, | 1374 | static int __devinit load_firmware(struct pci_dev *pdev, |
1372 | const unsigned int index, const unsigned int signature) | 1375 | const unsigned int index, const unsigned int signature) |
1373 | { | 1376 | { |
1374 | struct isi_board *board = pci_get_drvdata(pdev); | 1377 | struct isi_board *board = pci_get_drvdata(pdev); |
@@ -1548,7 +1551,7 @@ end: | |||
1548 | */ | 1551 | */ |
1549 | static unsigned int card_count; | 1552 | static unsigned int card_count; |
1550 | 1553 | ||
1551 | static int isicom_probe(struct pci_dev *pdev, | 1554 | static int __devinit isicom_probe(struct pci_dev *pdev, |
1552 | const struct pci_device_id *ent) | 1555 | const struct pci_device_id *ent) |
1553 | { | 1556 | { |
1554 | unsigned int uninitialized_var(signature), index; | 1557 | unsigned int uninitialized_var(signature), index; |
@@ -1595,7 +1598,7 @@ static int isicom_probe(struct pci_dev *pdev, | |||
1595 | } | 1598 | } |
1596 | 1599 | ||
1597 | retval = request_irq(board->irq, isicom_interrupt, | 1600 | retval = request_irq(board->irq, isicom_interrupt, |
1598 | IRQF_SHARED, ISICOM_NAME, board); | 1601 | IRQF_SHARED | IRQF_DISABLED, ISICOM_NAME, board); |
1599 | if (retval < 0) { | 1602 | if (retval < 0) { |
1600 | dev_err(&pdev->dev, "Could not install handler at Irq %d. " | 1603 | dev_err(&pdev->dev, "Could not install handler at Irq %d. " |
1601 | "Card%d will be disabled.\n", board->irq, index + 1); | 1604 | "Card%d will be disabled.\n", board->irq, index + 1); |
@@ -1610,15 +1613,9 @@ static int isicom_probe(struct pci_dev *pdev, | |||
1610 | if (retval < 0) | 1613 | if (retval < 0) |
1611 | goto errunri; | 1614 | goto errunri; |
1612 | 1615 | ||
1613 | for (index = 0; index < board->port_count; index++) { | 1616 | for (index = 0; index < board->port_count; index++) |
1614 | struct tty_port *tport = &board->ports[index].port; | 1617 | tty_register_device(isicom_normal, board->index * 16 + index, |
1615 | tty_port_init(tport); | 1618 | &pdev->dev); |
1616 | tport->ops = &isicom_port_ops; | ||
1617 | tport->close_delay = 50 * HZ/100; | ||
1618 | tport->closing_wait = 3000 * HZ/100; | ||
1619 | tty_port_register_device(tport, isicom_normal, | ||
1620 | board->index * 16 + index, &pdev->dev); | ||
1621 | } | ||
1622 | 1619 | ||
1623 | return 0; | 1620 | return 0; |
1624 | 1621 | ||
@@ -1635,15 +1632,13 @@ err: | |||
1635 | return retval; | 1632 | return retval; |
1636 | } | 1633 | } |
1637 | 1634 | ||
1638 | static void isicom_remove(struct pci_dev *pdev) | 1635 | static void __devexit isicom_remove(struct pci_dev *pdev) |
1639 | { | 1636 | { |
1640 | struct isi_board *board = pci_get_drvdata(pdev); | 1637 | struct isi_board *board = pci_get_drvdata(pdev); |
1641 | unsigned int i; | 1638 | unsigned int i; |
1642 | 1639 | ||
1643 | for (i = 0; i < board->port_count; i++) { | 1640 | for (i = 0; i < board->port_count; i++) |
1644 | tty_unregister_device(isicom_normal, board->index * 16 + i); | 1641 | tty_unregister_device(isicom_normal, board->index * 16 + i); |
1645 | tty_port_destroy(&board->ports[i].port); | ||
1646 | } | ||
1647 | 1642 | ||
1648 | free_irq(board->irq, board); | 1643 | free_irq(board->irq, board); |
1649 | pci_release_region(pdev, 3); | 1644 | pci_release_region(pdev, 3); |
@@ -1662,9 +1657,13 @@ static int __init isicom_init(void) | |||
1662 | isi_card[idx].ports = port; | 1657 | isi_card[idx].ports = port; |
1663 | spin_lock_init(&isi_card[idx].card_lock); | 1658 | spin_lock_init(&isi_card[idx].card_lock); |
1664 | for (channel = 0; channel < 16; channel++, port++) { | 1659 | for (channel = 0; channel < 16; channel++, port++) { |
1660 | tty_port_init(&port->port); | ||
1661 | port->port.ops = &isicom_port_ops; | ||
1665 | port->magic = ISICOM_MAGIC; | 1662 | port->magic = ISICOM_MAGIC; |
1666 | port->card = &isi_card[idx]; | 1663 | port->card = &isi_card[idx]; |
1667 | port->channel = channel; | 1664 | port->channel = channel; |
1665 | port->port.close_delay = 50 * HZ/100; | ||
1666 | port->port.closing_wait = 3000 * HZ/100; | ||
1668 | port->status = 0; | 1667 | port->status = 0; |
1669 | /* . . . */ | 1668 | /* . . . */ |
1670 | } | 1669 | } |
@@ -1679,6 +1678,7 @@ static int __init isicom_init(void) | |||
1679 | goto error; | 1678 | goto error; |
1680 | } | 1679 | } |
1681 | 1680 | ||
1681 | isicom_normal->owner = THIS_MODULE; | ||
1682 | isicom_normal->name = "ttyM"; | 1682 | isicom_normal->name = "ttyM"; |
1683 | isicom_normal->major = ISICOM_NMAJOR; | 1683 | isicom_normal->major = ISICOM_NMAJOR; |
1684 | isicom_normal->minor_start = 0; | 1684 | isicom_normal->minor_start = 0; |