case CYGETRTSDTR_INV:
ret_val = info->rtsdtr_inv;
break;
- case CYGETCARDINFO:
- if (copy_to_user(argp, &cy_card[info->card],
- sizeof(struct cyclades_card))) {
- ret_val = -EFAULT;
- break;
- }
- ret_val = 0;
- break;
case CYGETCD1400VER:
ret_val = info->chip_rev;
break;
#endif /* CONFIG_CYZ_INTR */
/* set cy_card */
- cy_card[j].base_phys = cy_pci_phys2;
- cy_card[j].ctl_phys = cy_pci_phys0;
cy_card[j].base_addr = cy_pci_addr2;
cy_card[j].ctl_addr = cy_pci_addr0;
cy_card[j].irq = (int)cy_pci_irq;
cy_card[j].bus_index = 1;
cy_card[j].first_line = cy_next_channel;
cy_card[j].num_chips = -1;
- cy_card[j].pdev = pdev;
cy_init_card(&cy_card[j], j);
pci_set_drvdata(pdev, &cy_card[j]);
}
/* set cy_card */
- cy_card[j].base_phys = (ulong) cy_pci_phys2;
- cy_card[j].ctl_phys = (ulong) cy_pci_phys0;
cy_card[j].base_addr = cy_pci_addr2;
cy_card[j].ctl_addr = cy_pci_addr0;
cy_card[j].irq = (int)cy_pci_irq;
cy_card[j].bus_index = 1;
cy_card[j].first_line = cy_next_channel;
cy_card[j].num_chips = cy_pci_nchan / 4;
- cy_card[j].pdev = pdev;
cy_init_card(&cy_card[j], j);
pci_set_drvdata(pdev, &cy_card[j]);
#endif /* CONFIG_CYZ_INTR */
/* set cy_card */
- cy_card[j].base_phys = cy_pci_phys2;
- cy_card[j].ctl_phys = cy_pci_phys0;
cy_card[j].base_addr = cy_pci_addr2;
cy_card[j].ctl_addr = cy_pci_addr0;
cy_card[j].irq = (int)cy_pci_irq;
cy_card[j].bus_index = 1;
cy_card[j].first_line = cy_next_channel;
cy_card[j].num_chips = -1;
- cy_card[j].pdev = pdev;
cy_init_card(&cy_card[j], j);
pci_set_drvdata(pdev, &cy_card[j]);
return 0;
}
-#endif
-/*
- * ---------------------------------------------------------------------
- * cy_detect_pci() - Test PCI bus presence and Cyclom-Ye/PCI.
- * sets global variables and return the number of PCI boards found.
- * ---------------------------------------------------------------------
- */
-static int __init cy_detect_pci(void)
+static void __devexit cy_pci_remove(struct pci_dev *pdev)
{
-#ifdef CONFIG_PCI
- struct pci_dev *pdev = NULL;
- unsigned int i, device_id, dev_index = 0;
-
- for (i = 0; i < NR_CARDS; i++) {
- /* look for a Cyclades card by vendor and device id */
- while ((device_id = cy_pci_dev_id[dev_index].device) != 0) {
- if ((pdev = pci_get_device(PCI_VENDOR_ID_CYCLADES,
- device_id, pdev)) == NULL) {
- dev_index++; /* try next device id */
- } else {
- break; /* found a board */
- }
- }
-
- if (device_id == 0)
- break;
-
- i -= !!cy_pci_probe(pdev, &cy_pci_dev_id[dev_index]);
- }
-
- return i;
-#else
- return 0;
-#endif /* ifdef CONFIG_PCI */
-} /* cy_detect_pci */
-
-static void __devexit cy_pci_release(struct pci_dev *pdev)
-{
-#ifdef CONFIG_PCI
struct cyclades_card *cinfo = pci_get_drvdata(pdev);
unsigned int i;
for (i = cinfo->first_line; i < cinfo->first_line +
cinfo->nports; i++)
tty_unregister_device(cy_serial_driver, i);
-#endif
}
+static struct pci_driver cy_pci_driver = {
+ .name = "cyclades",
+ .id_table = cy_pci_dev_id,
+ .probe = cy_pci_probe,
+ .remove = __devexit_p(cy_pci_remove)
+};
+#endif
+
/*
* This routine prints out the appropriate serial driver version number
* and identifies which options were configured into this driver.
/* look for isa boards */
nboards = cy_detect_isa();
+#ifdef CONFIG_PCI
/* look for pci boards */
- nboards += cy_detect_pci();
-
- if (nboards == 0) {
- retval = -ENODEV;
+ retval = pci_register_driver(&cy_pci_driver);
+ if (retval && !nboards)
goto err_unr;
- }
+#endif
return 0;
err_unr:
put_tty_driver(cy_serial_driver);
+#ifdef CONFIG_PCI
+ pci_unregister_driver(&cy_pci_driver);
+#endif
+
for (i = 0; i < NR_CARDS; i++) {
if (cy_card[i].base_addr) {
- if (cy_card[i].pdev) {
- cy_pci_release(cy_card[i].pdev);
- continue;
- }
/* clear interrupt */
cy_writeb(cy_card[i].base_addr + Cy_ClrIntr, 0);
iounmap(cy_card[i].base_addr);