static int __init isapnp_fmi_probe(void) { int i = 0; while (id_table[i].card_vendor != 0 && dev == NULL) { dev = pnp_find_dev(NULL, id_table[i].vendor, id_table[i].function, NULL); i++; } if (!dev) return -ENODEV; if (pnp_device_attach(dev) < 0) return -EAGAIN; if (pnp_activate_dev(dev) < 0) { printk(KERN_ERR "radio-sf16fmi: PnP configure failed (out of resources?)\n"); pnp_device_detach(dev); return -ENOMEM; } if (!pnp_port_valid(dev, 0)) { pnp_device_detach(dev); return -ENODEV; } i = pnp_port_start(dev, 0); printk(KERN_INFO "radio-sf16fmi: PnP reports card at %#x\n", i); return i; }
static int ni_isapnp_find_board(struct pnp_dev **dev) { struct pnp_dev *isapnp_dev = NULL; int i; for (i = 0; i < ARRAY_SIZE(ni_boards); i++) { isapnp_dev = pnp_find_dev(NULL, ISAPNP_VENDOR('N', 'I', 'C'), ISAPNP_FUNCTION(ni_boards[i]. isapnp_id), NULL); if (!isapnp_dev || !isapnp_dev->card) continue; if (pnp_device_attach(isapnp_dev) < 0) continue; if (pnp_activate_dev(isapnp_dev) < 0) { pnp_device_detach(isapnp_dev); return -EAGAIN; } if (!pnp_port_valid(isapnp_dev, 0) || !pnp_irq_valid(isapnp_dev, 0)) { pnp_device_detach(isapnp_dev); return -ENOMEM; } break; } if (i == ARRAY_SIZE(ni_boards)) return -ENODEV; *dev = isapnp_dev; return 0; }
int __init setup_asuscom(struct IsdnCard *card) { char tmp[64]; strcpy(tmp, Asuscom_revision); printk(KERN_INFO "HiSax: Asuscom ISDNLink driver Rev. %s\n", HiSax_getrev(tmp)); #ifdef __ISAPNP__ if (!card->para[1] && isapnp_present()) { struct pnp_card *pb; struct pnp_dev *pd; while(adev->card_vendor) { if ((pb = pnp_find_card(adev->card_vendor, adev->card_device, pnp_c))) { pnp_c = pb; pd = NULL; if ((pd = pnp_find_dev(pnp_c, adev->vendor, adev->function, pd))) { printk(KERN_INFO "HiSax: %s detected\n", (char *)adev->driver_data); if (pnp_device_attach(pd) < 0) { printk(KERN_ERR "AsusPnP: attach failed\n"); return 0; } if (pnp_activate_dev(pd) < 0) { printk(KERN_ERR "AsusPnP: activate failed\n"); pnp_device_detach(pd); return 0; } if (!pnp_irq_valid(pd, 0) || !pnp_port_valid(pd, 0)) { printk(KERN_ERR "AsusPnP:some resources are missing %ld/%lx\n", pnp_irq(pd, 0), pnp_port_start(pd, 0)); pnp_device_detach(pd); return(0); } card->para[1] = pnp_port_start(pd, 0); card->para[0] = pnp_irq(pd, 0); break; } else { printk(KERN_ERR "AsusPnP: PnP error card found, no device\n"); } } adev++; pnp_c=NULL; } if (!adev->card_vendor) { printk(KERN_INFO "AsusPnP: no ISAPnP card found\n"); return(0); } } #endif if (asuscom_probe(card->cs, card) < 0) return 0; return 1; }
static int pnp_device_probe(struct device *dev) { int error; struct pnp_driver *pnp_drv; struct pnp_dev *pnp_dev; const struct pnp_device_id *dev_id = NULL; pnp_dev = to_pnp_dev(dev); pnp_drv = to_pnp_driver(dev->driver); pnp_dbg("match found with the PnP device '%s' and the driver '%s'", dev->bus_id, pnp_drv->name); error = pnp_device_attach(pnp_dev); if (error < 0) return error; if (pnp_dev->active == 0) { if (!(pnp_drv->flags & PNP_DRIVER_RES_DO_NOT_CHANGE)) { error = pnp_activate_dev(pnp_dev); if (error < 0) return error; } } else if ((pnp_drv->flags & PNP_DRIVER_RES_DISABLE) == PNP_DRIVER_RES_DISABLE) { error = pnp_disable_dev(pnp_dev); if (error < 0) return error; } error = 0; if (pnp_drv->probe) { dev_id = match_device(pnp_drv, pnp_dev); if (dev_id != NULL) error = pnp_drv->probe(pnp_dev, dev_id); } if (error >= 0) { pnp_dev->driver = pnp_drv; error = 0; } else goto fail; return error; fail: pnp_device_detach(pnp_dev); return error; }
static int ni_isapnp_find_board(struct pnp_dev **dev) { struct pnp_dev *isapnp_dev = NULL; int i; for (i = 0; i < n_ni_boards; i++) { isapnp_dev = pnp_find_dev(NULL, ISAPNP_VENDOR('N', 'I', 'C'), ISAPNP_FUNCTION(ni_boards[i]. isapnp_id), NULL); if (isapnp_dev == NULL || isapnp_dev->card == NULL) continue; if (pnp_device_attach(isapnp_dev) < 0) { printk ("ni_atmio: %s found but already active, skipping.\n", ni_boards[i].name); continue; } if (pnp_activate_dev(isapnp_dev) < 0) { pnp_device_detach(isapnp_dev); return -EAGAIN; } if (!pnp_port_valid(isapnp_dev, 0) || !pnp_irq_valid(isapnp_dev, 0)) { pnp_device_detach(isapnp_dev); printk("ni_atmio: pnp invalid port or irq, aborting\n"); return -ENOMEM; } break; } if (i == n_ni_boards) return -ENODEV; *dev = isapnp_dev; return 0; }
static int sb1000_probe_one(struct pnp_dev *pdev, const struct pnp_device_id *id) { struct net_device *dev; unsigned short ioaddr[2], irq; unsigned int serial_number; int error = -ENODEV; if (pnp_device_attach(pdev) < 0) return -ENODEV; if (pnp_activate_dev(pdev) < 0) goto out_detach; if (!pnp_port_valid(pdev, 0) || !pnp_port_valid(pdev, 1)) goto out_disable; if (!pnp_irq_valid(pdev, 0)) goto out_disable; serial_number = pdev->card->serial; ioaddr[0] = pnp_port_start(pdev, 0); ioaddr[1] = pnp_port_start(pdev, 0); irq = pnp_irq(pdev, 0); if (!request_region(ioaddr[0], 16, "sb1000")) goto out_disable; if (!request_region(ioaddr[1], 16, "sb1000")) goto out_release_region0; dev = alloc_etherdev(sizeof(struct sb1000_private)); if (!dev) { error = -ENOMEM; goto out_release_regions; } dev->base_addr = ioaddr[0]; /* mem_start holds the second I/O address */ dev->mem_start = ioaddr[1]; dev->irq = irq; if (sb1000_debug > 0) printk(KERN_NOTICE "%s: sb1000 at (%#3.3lx,%#3.3lx), " "S/N %#8.8x, IRQ %d.\n", dev->name, dev->base_addr, dev->mem_start, serial_number, dev->irq); /* * The SB1000 is an rx-only cable modem device. The uplink is a modem * and we do not want to arp on it. */ dev->flags = IFF_POINTOPOINT|IFF_NOARP; SET_NETDEV_DEV(dev, &pdev->dev); if (sb1000_debug > 0) printk(KERN_NOTICE "%s", version); dev->netdev_ops = &sb1000_netdev_ops; /* hardware address is 0:0:serial_number */ dev->dev_addr[2] = serial_number >> 24 & 0xff; dev->dev_addr[3] = serial_number >> 16 & 0xff; dev->dev_addr[4] = serial_number >> 8 & 0xff; dev->dev_addr[5] = serial_number >> 0 & 0xff; pnp_set_drvdata(pdev, dev); error = register_netdev(dev); if (error) goto out_free_netdev; return 0; out_free_netdev: free_netdev(dev); out_release_regions: release_region(ioaddr[1], 16); out_release_region0: release_region(ioaddr[0], 16); out_disable: pnp_disable_dev(pdev); out_detach: pnp_device_detach(pdev); return error; }
int __devinit setup_teles3(struct IsdnCard *card) { char tmp[64]; strcpy(tmp, teles3_revision); printk(KERN_INFO "HiSax: Teles IO driver Rev. %s\n", HiSax_getrev(tmp)); #ifdef __ISAPNP__ if (!card->para[1] && isapnp_present()) { struct pnp_card *pnp_card; struct pnp_dev *pnp_dev; while(tdev->card_vendor) { if ((pnp_card = pnp_find_card(tdev->card_vendor, tdev->card_device, pnp_c))) { pnp_c = pnp_card; pnp_dev = NULL; if ((pnp_dev = pnp_find_dev(pnp_card, tdev->vendor, tdev->function, pnp_dev))) { printk(KERN_INFO "HiSax: %s detected\n", (char *)tdev->driver_data); if (pnp_device_attach(pnp_dev) < 0) { printk(KERN_ERR "Teles PnP: attach failed\n"); return 0; } if (pnp_activate_dev(pnp_dev) < 0) { printk(KERN_ERR "Teles PnP: activate failed\n"); pnp_device_detach(pnp_dev); return 0; } if (!pnp_irq_valid(pnp_dev, 0) || !pnp_port_valid(pnp_dev, 0) || !pnp_port_valid(pnp_dev, 1)) { printk(KERN_ERR "Teles PnP: some resources are missing %ld/%lx/%lx\n", pnp_irq(pnp_dev, 0), pnp_port_start(pnp_dev, 0), pnp_port_start(pnp_dev, 1)); pnp_device_detach(pnp_dev); return 0; } card->para[3] = pnp_port_start(pnp_dev, 2); card->para[2] = pnp_port_start(pnp_dev, 1); card->para[1] = pnp_port_start(pnp_dev, 0); card->para[0] = pnp_irq(pnp_dev, 0); break; } else { printk(KERN_ERR "Teles PnP: PnP error card found, no device\n"); } } tdev++; pnp_c=NULL; } if (!tdev->card_vendor) { printk(KERN_INFO "Teles PnP: no ISAPnP card found\n"); return(0); } } #endif if (card->cs->typ == ISDN_CTYPE_16_3) { if (teles16_3_probe(card->cs, card) < 0) return 0; } else if (card->cs->typ == ISDN_CTYPE_TELESPCMCIA) { if (telespcmcia_probe(card->cs, card) < 0) return 0; } else if (card->cs->typ == ISDN_CTYPE_COMPAQ_ISA) { if (compaq_probe(card->cs, card) < 0) return 0; } else { /* PNP */ if (telespnp_probe(card->cs, card) < 0) return 0; } return 1; }
int __init setup_niccy(struct IsdnCard *card) { char tmp[64]; strcpy(tmp, niccy_revision); printk(KERN_INFO "HiSax: Niccy driver Rev. %s\n", HiSax_getrev(tmp)); #ifdef __ISAPNP__ if (!card->para[1] && isapnp_present()) { struct pnp_card *pb; struct pnp_dev *pd; if ((pb = pnp_find_card( ISAPNP_VENDOR('S', 'D', 'A'), ISAPNP_FUNCTION(0x0150), pnp_c))) { pnp_c = pb; pd = NULL; if (!(pd = pnp_find_dev(pnp_c, ISAPNP_VENDOR('S', 'D', 'A'), ISAPNP_FUNCTION(0x0150), pd))) { printk(KERN_ERR "NiccyPnP: PnP error card found, no device\n"); return (0); } if (pnp_device_attach(pd) < 0) { printk(KERN_ERR "NiccyPnP: attach failed\n"); return 0; } if (pnp_activate_dev(pd) < 0) { printk(KERN_ERR "NiccyPnP: activate failed\n"); pnp_device_detach(pd); return 0; } if (!pnp_irq_valid(pd, 0) || !pnp_port_valid(pd, 0) || !pnp_port_valid(pd, 1)) { printk(KERN_ERR "NiccyPnP:some resources are missing %ld/%lx/%lx\n", pnp_irq(pd, 0), pnp_port_start(pd, 0), pnp_port_start(pd, 1)); pnp_device_detach(pd); return(0); } card->para[1] = pnp_port_start(pd, 0); card->para[2] = pnp_port_start(pd, 1); card->para[0] = pnp_irq(pd, 0); } else { printk(KERN_INFO "NiccyPnP: no ISAPnP card found\n"); } } #endif if (card->para[1]) { if (niccy_pnp_probe(card->cs, card) < 0) return 0; return 1; } else { #ifdef CONFIG_PCI if ((niccy_dev = pci_find_device(PCI_VENDOR_ID_SATSAGEM, PCI_DEVICE_ID_SATSAGEM_NICCY, niccy_dev))) { if (niccy_pci_probe(card->cs, niccy_dev) < 0) return 0; return 1; } #endif /* CONFIG_PCI */ } return 0; }