#include <linux/isapnp.h>
-#define DEV_IO(dev, index) (dev->resource[index].start)
-#define DEV_IRQ(dev, index) (dev->irq_resource[index].start)
-
-#define DEV_NAME(dev) (dev->bus->name ? dev->bus->name : "ISA PnP")
+#define DEV_NAME(dev) (dev->name)
#define GENERIC_HD_DATA 0
#define GENERIC_HD_ERROR 1
/* ISA PnP device table entry */
struct pnp_dev_t {
unsigned short card_vendor, card_device, vendor, device;
- int (*init_fn)(struct pci_dev *dev, int enable);
+ int (*init_fn)(struct pnp_dev *dev, int enable);
};
/* Generic initialisation function for ISA PnP IDE interface */
-static int __init pnpide_generic_init(struct pci_dev *dev, int enable)
+static int __init pnpide_generic_init(struct pnp_dev *dev, int enable)
{
hw_regs_t hw;
ide_hwif_t *hwif;
if (!enable)
return 0;
- if (!(DEV_IO(dev, 0) && DEV_IO(dev, 1) && DEV_IRQ(dev, 0)))
+ if (!(pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) && pnp_irq_valid(dev, 0)))
return 1;
- ide_setup_ports(&hw, (ide_ioreg_t) DEV_IO(dev, 0),
+ ide_setup_ports(&hw, (ide_ioreg_t) pnp_port_start(dev, 0),
generic_ide_offsets,
- (ide_ioreg_t) DEV_IO(dev, 1),
+ (ide_ioreg_t) pnp_port_start(dev, 1),
0, NULL,
// generic_pnp_ide_iops,
- DEV_IRQ(dev, 0));
+ pnp_irq(dev, 0));
index = ide_register_hw(&hw, &hwif);
if (index != -1) {
printk(KERN_INFO "ide%d: %s IDE interface\n", index, DEV_NAME(dev));
- hwif->pci_dev = dev;
+ hwif->pnp_dev = dev;
return 0;
}
#define NR_PNP_DEVICES 8
struct pnp_dev_inst {
- struct pci_dev *dev;
+ struct pnp_dev *dev;
struct pnp_dev_t *dev_type;
};
static struct pnp_dev_inst devices[NR_PNP_DEVICES];
void __init pnpide_init(int enable)
{
- struct pci_dev *dev = NULL;
+ struct pnp_dev *dev = NULL;
struct pnp_dev_t *dev_type;
if (!isapnp_present())
for (i = 0; i < pnp_ide_dev_idx; i++) {
dev = devices[i].dev;
devices[i].dev_type->init_fn(dev, 0);
- if (dev->deactivate)
- dev->deactivate(dev);
+ pnp_device_detach(dev);
}
return;
}
for (dev_type = idepnp_devices; dev_type->vendor; dev_type++) {
- while ((dev = isapnp_find_dev(NULL, dev_type->vendor,
+ while ((dev = pnp_find_dev(NULL, dev_type->vendor,
dev_type->device, dev))) {
-
- if (dev->active)
- continue;
-
- if (dev->prepare && dev->prepare(dev) < 0) {
- printk(KERN_ERR"ide-pnp: %s prepare failed\n", DEV_NAME(dev));
+
+ if (pnp_device_attach(dev) < 0)
continue;
- }
-
- if (dev->activate && dev->activate(dev) < 0) {
+
+ if (pnp_activate_dev(dev, NULL) < 0) {
printk(KERN_ERR"ide: %s activate failed\n", DEV_NAME(dev));
continue;
}
/* Call device initialization function */
if (dev_type->init_fn(dev, 1)) {
- if (dev->deactivate(dev))
- dev->deactivate(dev);
+ pnp_device_detach(dev);
} else {
#ifdef MODULE
/*
#include <linux/init.h>
#include <linux/gameport.h>
#include <linux/slab.h>
-#include <linux/isapnp.h>
#include <linux/stddef.h>
#include <linux/delay.h>
int ioport, iolen;
struct ns558 *port;
- if (!(dev->resource[0].flags & IORESOURCE_IO)) {
+ if (!pnp_port_valid(dev, 0)) {
printk(KERN_WARNING "ns558: No i/o ports on a gameport? Weird\n");
return -ENODEV;
}
};
static struct isapnp_device_id *adev = &asus_ids[0];
-static struct pci_bus *pnp_c __devinitdata = NULL;
+static struct pnp_card *pnp_c __devinitdata = NULL;
#endif
int __init
return (0);
#ifdef __ISAPNP__
if (!card->para[1] && isapnp_present()) {
- struct pci_bus *pb;
- struct pci_dev *pd;
+ struct pnp_card *pb;
+ struct pnp_dev *pd;
while(adev->card_vendor) {
- if ((pb = isapnp_find_card(adev->card_vendor,
- adev->card_device, pnp_c))) {
+ if ((pb = pnp_find_card(adev->card_vendor,
+ adev->card_device,
+ pnp_c))) {
pnp_c = pb;
pd = NULL;
- if ((pd = isapnp_find_dev(pnp_c,
- adev->vendor, adev->function, pd))) {
+ if ((pd = pnp_find_dev(pnp_c,
+ adev->vendor,
+ adev->function,
+ pd))) {
printk(KERN_INFO "HiSax: %s detected\n",
(char *)adev->driver_data);
- pd->prepare(pd);
- pd->deactivate(pd);
- pd->activate(pd);
- card->para[1] = pd->resource[0].start;
- card->para[0] = pd->irq_resource[0].start;
- if (!card->para[0] || !card->para[1]) {
+ if (pnp_device_attach(pd) < 0) {
+ printk(KERN_ERR "AsusPnP: attach failed\n");
+ return 0;
+ }
+ if (pnp_activate_dev(pd, NULL) < 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",
- card->para[0], card->para[1]);
- pd->deactivate(pd);
+ 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");
static struct pci_dev *dev_avm __initdata = NULL;
#ifdef __ISAPNP__
-static struct pci_bus *bus_avm __initdata = NULL;
-static struct pci_dev *pnp_avm __initdata = NULL;
+static struct pnp_card *card_avm __initdata = NULL;
+static struct pnp_dev *pnp_avm __initdata = NULL;
#endif
int __init
} else {
#ifdef __ISAPNP__
if (isapnp_present()) {
- struct pci_bus *ba;
- if ((ba = isapnp_find_card(
+ struct pnp_card *ba;
+ if ((ba = pnp_find_card(
ISAPNP_VENDOR('A', 'V', 'M'),
- ISAPNP_FUNCTION(0x0900), bus_avm))) {
- bus_avm = ba;
+ ISAPNP_FUNCTION(0x0900), card_avm))) {
+ card_avm = ba;
pnp_avm = NULL;
- if ((pnp_avm = isapnp_find_dev(bus_avm,
+ if ((pnp_avm = pnp_find_dev(card_avm,
ISAPNP_VENDOR('A', 'V', 'M'),
ISAPNP_FUNCTION(0x0900), pnp_avm))) {
- pnp_avm->prepare(pnp_avm);
- pnp_avm->deactivate(pnp_avm);
- pnp_avm->activate(pnp_avm);
- cs->hw.avm.cfg_reg =
- pnp_avm->resource[0].start;
- cs->irq =
- pnp_avm->irq_resource[0].start;
- if (!cs->irq) {
+ if (pnp_device_attach(pnp_avm) < 0) {
+ printk(KERN_ERR "FritzPnP: attach failed\n");
+ return 0;
+ }
+ if (pnp_activate_dev(pnp_avm, NULL) < 0) {
+ printk(KERN_ERR "FritzPnP: activate failed\n");
+ pnp_device_detach(pnp_avm);
+ return 0;
+ }
+ if (!pnp_irq_valid(pnp_avm, 0)) {
printk(KERN_ERR "FritzPnP:No IRQ\n");
- pnp_avm->deactivate(pnp_avm);
+ pnp_device_detach(pnp_avm);
return(0);
}
- if (!cs->hw.avm.cfg_reg) {
+ if (!pnp_port_valid(pnp_avm, 0)) {
printk(KERN_ERR "FritzPnP:No IO address\n");
- pnp_avm->deactivate(pnp_avm);
+ pnp_device_detach(pnp_avm);
return(0);
}
+ cs->hw.avm.cfg_reg = pnp_port_start(pnp_avm, 0);
+ cs->irq = pnp_irq(pnp_avm, 0);
cs->subtyp = AVM_FRITZ_PNP;
goto ready;
}
};
static struct isapnp_device_id *pdev = &diva_ids[0];
-static struct pci_bus *pnp_c __devinitdata = NULL;
+static struct pnp_card *pnp_c __devinitdata = NULL;
#endif
} else {
#ifdef __ISAPNP__
if (isapnp_present()) {
- struct pci_bus *pb;
- struct pci_dev *pd;
+ struct pnp_card *pb;
+ struct pnp_dev *pd;
while(pdev->card_vendor) {
- if ((pb = isapnp_find_card(pdev->card_vendor,
- pdev->card_device, pnp_c))) {
+ if ((pb = pnp_find_card(pdev->card_vendor,
+ pdev->card_device,
+ pnp_c))) {
pnp_c = pb;
pd = NULL;
- if ((pd = isapnp_find_dev(pnp_c,
- pdev->vendor, pdev->function, pd))) {
+ if ((pd = pnp_find_dev(pnp_c,
+ pdev->vendor,
+ pdev->function,
+ pd))) {
printk(KERN_INFO "HiSax: %s detected\n",
(char *)pdev->driver_data);
- pd->prepare(pd);
- pd->deactivate(pd);
- pd->activate(pd);
- card->para[1] =
- pd->resource[0].start;
- card->para[0] =
- pd->irq_resource[0].start;
- if (!card->para[0] || !card->para[1]) {
+ if (pnp_device_attach(pd) < 0) {
+ printk(KERN_ERR "Diva PnP: attach failed\n");
+ return 0;
+ }
+ if (pnp_activate_dev(pd, NULL) < 0) {
+ printk(KERN_ERR "Diva PnP: activate failed\n");
+ pnp_device_detach(pd);
+ return 0;
+ }
+ if (!pnp_irq_valid(pd, 0) || !pnp_port_valid(pd, 0)) {
printk(KERN_ERR "Diva PnP:some resources are missing %ld/%lx\n",
- card->para[0], card->para[1]);
- pd->deactivate(pd);
+ 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);
cs->hw.diva.cfg_reg = card->para[1];
cs->irq = card->para[0];
if (pdev->function == ISAPNP_FUNCTION(0xA1)) {
};
static struct isapnp_device_id *pdev = &elsa_ids[0];
-static struct pci_bus *pnp_c __devinitdata = NULL;
+static struct pnp_card *pnp_c __devinitdata = NULL;
#endif
int __devinit
} else if (cs->typ == ISDN_CTYPE_ELSA_PNP) {
#ifdef __ISAPNP__
if (!card->para[1] && isapnp_present()) {
- struct pci_bus *pb;
- struct pci_dev *pd;
+ struct pnp_card *pb;
+ struct pnp_dev *pd;
while(pdev->card_vendor) {
- if ((pb = isapnp_find_card(pdev->card_vendor,
- pdev->card_device, pnp_c))) {
+ if ((pb = pnp_find_card(pdev->card_vendor,
+ pdev->card_device,
+ pnp_c))) {
pnp_c = pb;
pd = NULL;
- if ((pd = isapnp_find_dev(pnp_c,
- pdev->vendor, pdev->function, pd))) {
+ if ((pd = pnp_find_dev(pnp_c,
+ pdev->vendor,
+ pdev->function,
+ pd))) {
printk(KERN_INFO "HiSax: %s detected\n",
(char *)pdev->driver_data);
- pd->prepare(pd);
- pd->deactivate(pd);
- pd->activate(pd);
- card->para[1] =
- pd->resource[0].start;
- card->para[0] =
- pd->irq_resource[0].start;
- if (!card->para[0] || !card->para[1]) {
+ if (pnp_device_attach(pd) < 0) {
+ printk(KERN_ERR "Elsa PnP: attach failed\n");
+ return 0;
+ }
+ if (pnp_activate_dev(pd, NULL) < 0) {
+ pnp_device_detach(pd);
+ printk(KERN_ERR "Elsa PnP: activate failed\n");
+ return 0;
+ }
+ if (!pnp_port_valid(pd, 0) ||
+ !pnp_irq_valid(pd, 0)) {
printk(KERN_ERR "Elsa PnP:some resources are missing %ld/%lx\n",
- card->para[0], card->para[1]);
- pd->deactivate(pd);
+ 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);
if (pdev->function == ISAPNP_FUNCTION(0x133))
cs->subtyp = ELSA_QS1000;
else
};
static struct isapnp_device_id *hdev = &hfc_ids[0];
-static struct pci_bus *pnp_c __devinitdata = NULL;
+static struct pnp_card *pnp_c __devinitdata = NULL;
#endif
int __devinit
printk(KERN_INFO "HiSax: HFC-SX driver Rev. %s\n", HiSax_getrev(tmp));
#ifdef __ISAPNP__
if (!card->para[1] && isapnp_present()) {
- struct pci_bus *pb;
- struct pci_dev *pd;
+ struct pnp_card *pb;
+ struct pnp_dev *pd;
while(hdev->card_vendor) {
- if ((pb = isapnp_find_card(hdev->card_vendor,
- hdev->card_device, pnp_c))) {
+ if ((pb = pnp_find_card(hdev->card_vendor,
+ hdev->card_device,
+ pnp_c))) {
pnp_c = pb;
pd = NULL;
- if ((pd = isapnp_find_dev(pnp_c,
- hdev->vendor, hdev->function, pd))) {
+ if ((pd = pnp_find_dev(pnp_c,
+ hdev->vendor,
+ hdev->function,
+ pd))) {
printk(KERN_INFO "HiSax: %s detected\n",
(char *)hdev->driver_data);
- pd->prepare(pd);
- pd->deactivate(pd);
- pd->activate(pd);
- card->para[1] = pd->resource[0].start;
- card->para[0] = pd->irq_resource[0].start;
- if (!card->para[0] || !card->para[1]) {
+ if (pnp_device_attach(pd) < 0) {
+ printk(KERN_ERR "HFC PnP: attach failed\n");
+ return 0;
+ }
+ if (pnp_activate_dev(pd, NULL) < 0) {
+ printk(KERN_ERR "HFC PnP: activate failed\n");
+ pnp_device_detach(pd);
+ return 0;
+ }
+ if (!pnp_irq_valid(pd, 0) || !pnp_port_valid(pd, 0)) {
printk(KERN_ERR "HFC PnP:some resources are missing %ld/%lx\n",
- card->para[0], card->para[1]);
- pd->deactivate(pd);
+ 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 "HFC PnP: PnP error card found, no device\n");
};
static struct isapnp_device_id *hdev = &hfc_ids[0];
-static struct pci_bus *pnp_c __devinitdata = NULL;
+static struct pnp_card *pnp_c __devinitdata = NULL;
#endif
int __init
#ifdef __ISAPNP__
if (!card->para[1] && isapnp_present()) {
- struct pci_bus *pb;
- struct pci_dev *pd;
+ struct pnp_card *pb;
+ struct pnp_dev *pd;
while(hdev->card_vendor) {
- if ((pb = isapnp_find_card(hdev->card_vendor,
- hdev->card_device, pnp_c))) {
+ if ((pb = pnp_find_card(hdev->card_vendor,
+ hdev->card_device,
+ pnp_c))) {
pnp_c = pb;
pd = NULL;
- if ((pd = isapnp_find_dev(pnp_c,
- hdev->vendor, hdev->function, pd))) {
+ if ((pd = pnp_find_dev(pnp_c,
+ hdev->vendor,
+ hdev->function,
+ pd))) {
printk(KERN_INFO "HiSax: %s detected\n",
(char *)hdev->driver_data);
- pd->prepare(pd);
- pd->deactivate(pd);
- pd->activate(pd);
- card->para[1] = pd->resource[0].start;
- card->para[0] = pd->irq_resource[0].start;
- if (!card->para[0] || !card->para[1]) {
+ if (pnp_device_attach(pd) < 0) {
+ printk(KERN_ERR "HFC PnP: attach failed\n");
+ return 0;
+ }
+ if (pnp_activate_dev(pd, NULL) < 0) {
+ printk(KERN_ERR "HFC PnP: activate failed\n");
+ pnp_device_detach(pd);
+ return 0;
+ }
+ if (!pnp_irq_valid(pd, 0) || !pnp_port_valid(pd, 0)) {
printk(KERN_ERR "HFC PnP:some resources are missing %ld/%lx\n",
- card->para[0], card->para[1]);
- pd->deactivate(pd);
+ 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 "HFC PnP: PnP error card found, no device\n");
#include <linux/module.h>
#include <linux/init.h>
#include <linux/pci.h>
-#include <linux/isapnp.h>
+#include <linux/pnp.h>
#include <linux/kmod.h>
#include <linux/slab.h>
#include <linux/skbuff.h>
};
MODULE_DEVICE_TABLE(pci, fcpci_ids);
-static struct isapnp_device_id fcpnp_ids[] __devinitdata = {
- { ISAPNP_VENDOR('A', 'V', 'M'), ISAPNP_FUNCTION(0x0900),
- ISAPNP_VENDOR('A', 'V', 'M'), ISAPNP_FUNCTION(0x0900),
- (unsigned long) "Fritz!Card PnP" },
- { }
+static const struct pnp_card_id fcpnp_ids[] __devinitdata = {
+ { .id = "AVM0900", .driver_data = (unsigned long) "Fritz!Card PnP",
+ .devs = { { "AVM0900" } } }
};
-MODULE_DEVICE_TABLE(isapnp, fcpnp_ids);
+MODULE_DEVICE_TABLE(pnpc, fcpnp_ids);
static int protocol = 2; /* EURO-ISDN Default */
MODULE_PARM(protocol, "i");
#ifdef __ISAPNP__
-static int __devinit fcpnp_probe(struct pci_dev *pdev,
- const struct isapnp_device_id *ent)
+static int __devinit fcpnp_probe(struct pnp_card *card,
+ const struct pnp_card_id *card_id)
{
struct fritz_adapter *adapter;
- int retval;
+ struct pnp_dev *pnp_dev;
+
+ pnp_dev = pnp_request_card_device(card, card_id->devs[0], NULL);
+ if (pnp_dev == NULL)
+ return;
- retval = -ENOMEM;
adapter = new_adapter(pdev);
if (!adapter)
- goto err;
+ return -ENOMEM;
adapter->type = AVM_FRITZ_PNP;
- pdev->prepare(pdev);
- pdev->deactivate(pdev); // why?
- pdev->activate(pdev);
- adapter->io = pdev->resource[0].start;
- adapter->irq = pdev->irq_resource[0].start;
+ if (!pnp_port_valid(pnp_dev, 0) || !pnp_irq_valid(pnp_dev, 0)) {
+ delete_adapter(adapter);
+ adapter->io = pnp_port_start(pnp_dev, 0);
+ adapter->irq = pnp_irq(pnp_dev, 0);
printk(KERN_INFO "hisax_fcpcipnp: found adapter %s at IO %#x irq %d\n",
- (char *) ent->driver_data, adapter->io, adapter->irq);
+ (char *) card_id->driver_data, adapter->io, adapter->irq);
retval = fcpcipnp_setup(adapter);
- if (retval)
- goto err_free;
-
+ if (retval) {
+ delete_adapter(adapter);
+ return retval;
+ }
return 0;
-
- err_free:
- delete_adapter(adapter);
- err:
- return retval;
}
-static void __devexit fcpnp_remove(struct pci_dev *pdev)
+static void __devexit fcpnp_remove(struct pnp_card *pcard)
{
- struct fritz_adapter *adapter = pci_get_drvdata(pdev);
+ struct fritz_adapter *adapter = pci_get_drvdata(pcard);
fcpcipnp_release(adapter);
- pdev->deactivate(pdev);
delete_adapter(adapter);
}
-static struct isapnp_driver fcpnp_driver = {
+static struct pnpc_driver fcpnp_driver = {
.name = "fcpnp",
.probe = fcpnp_probe,
.remove = __devexit_p(fcpnp_remove),
pci_nr_found = retval;
#ifdef __ISAPNP__
- retval = isapnp_register_driver(&fcpnp_driver);
+ retval = pnpc_register_driver(&fcpnp_driver);
#else
retval = 0;
#endif
#if !defined(CONFIG_HOTPLUG) || defined(MODULE)
out_unregister_isapnp:
#ifdef __ISAPNP__
- isapnp_unregister_driver(&fcpnp_driver);
+ pnpc_unregister_driver(&fcpnp_driver);
#endif
#endif
out_unregister_pci:
#include <linux/module.h>
#include <linux/init.h>
#include <linux/pci.h>
-#include <linux/isapnp.h>
#include <linux/kmod.h>
#include <linux/slab.h>
#include <linux/skbuff.h>
};
#ifdef __ISAPNP__
-static struct pci_bus *pnp_surf __devinitdata = NULL;
+static struct pnp_card *pnp_surf __devinitdata = NULL;
#endif
int __init
cs->irq = card->para[0];
} else {
#ifdef __ISAPNP__
- struct pci_bus *pb;
- struct pci_dev *pd;
+ struct pnp_card *pb;
+ struct pnp_dev *pd;
if (isapnp_present()) {
cs->subtyp = 0;
- if ((pb = isapnp_find_card(
+ if ((pb = pnp_find_card(
ISAPNP_VENDOR('S', 'I', 'E'),
ISAPNP_FUNCTION(0x0010), pnp_surf))) {
pnp_surf = pb;
pd = NULL;
- if (!(pd = isapnp_find_dev(pnp_surf,
+ if (!(pd = pnp_find_dev(pnp_surf,
ISAPNP_VENDOR('S', 'I', 'E'),
ISAPNP_FUNCTION(0x0010), pd))) {
printk(KERN_ERR "ISurfPnP: PnP error card found, no device\n");
return (0);
}
- pd->prepare(pd);
- pd->deactivate(pd);
- pd->activate(pd);
- cs->hw.isurf.reset = pd->resource[0].start;
- cs->hw.isurf.phymem = pd->resource[1].start;
- cs->irq = pd->irq_resource[0].start;
- if (!cs->irq || !cs->hw.isurf.reset || !cs->hw.isurf.phymem) {
- printk(KERN_ERR "ISurfPnP:some resources are missing %d/%x/%lx\n",
- cs->irq, cs->hw.isurf.reset, cs->hw.isurf.phymem);
- pd->deactivate(pd);
+ if (pnp_device_attach(pd) < 0) {
+ printk(KERN_ERR "ISurfPnP: attach failed\n");
+ return 0;
+ }
+ if (pnp_activate_dev(pd, NULL) < 0) {
+ printk(KERN_ERR "ISurfPnP: 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 "ISurfPnP: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);
}
+ cs->hw.isurf.reset = pnp_port_start(pd, 0);
+ cs->hw.isurf.phymem = pnp_port_start(pd, 1);
+ cs->irq = pnp_irq(pd, 0);
} else {
printk(KERN_INFO "ISurfPnP: no ISAPnP card found\n");
return(0);
};
static struct isapnp_device_id *idev = &itk_ids[0];
-static struct pci_bus *pnp_c __devinitdata = NULL;
+static struct pnp_card *pnp_c __devinitdata = NULL;
#endif
#ifdef __ISAPNP__
if (!card->para[1] && isapnp_present()) {
- struct pci_bus *pb;
- struct pci_dev *pd;
+ struct pnp_card *pb;
+ struct pnp_dev *pd;
while(idev->card_vendor) {
- if ((pb = isapnp_find_card(idev->card_vendor,
- idev->card_device, pnp_c))) {
+ if ((pb = pnp_find_card(idev->card_vendor,
+ idev->card_device,
+ pnp_c))) {
pnp_c = pb;
pd = NULL;
- if ((pd = isapnp_find_dev(pnp_c,
- idev->vendor, idev->function, pd))) {
+ if ((pd = pnp_find_dev(pnp_c,
+ idev->vendor,
+ idev->function,
+ pd))) {
printk(KERN_INFO "HiSax: %s detected\n",
(char *)idev->driver_data);
- pd->prepare(pd);
- pd->deactivate(pd);
- pd->activate(pd);
- card->para[1] = pd->resource[0].start;
- card->para[0] = pd->irq_resource[0].start;
- if (!card->para[0] || !card->para[1]) {
+ if (pnp_device_attach(pd) < 0) {
+ printk(KERN_ERR "ITK PnP: attach failed\n");
+ return 0;
+ }
+ if (pnp_activate_dev(pd, NULL) < 0) {
+ printk(KERN_ERR "ITK PnP: activate failed\n");
+ pnp_device_detach(pd);
+ return 0;
+ }
+ if (!pnp_port_valid(pd, 0) || !pnp_irq_valid(pd, 0)) {
printk(KERN_ERR "ITK PnP:some resources are missing %ld/%lx\n",
- card->para[0], card->para[1]);
- pd->deactivate(pd);
+ 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 "ITK PnP: PnP error card found, no device\n");
static struct pci_dev *niccy_dev __initdata = NULL;
#ifdef __ISAPNP__
-static struct pci_bus *pnp_c __devinitdata = NULL;
+static struct pnp_card *pnp_c __devinitdata = NULL;
#endif
int __init
return (0);
#ifdef __ISAPNP__
if (!card->para[1] && isapnp_present()) {
- struct pci_bus *pb;
- struct pci_dev *pd;
+ struct pnp_card *pb;
+ struct pnp_dev *pd;
- if ((pb = isapnp_find_card(
+ if ((pb = pnp_find_card(
ISAPNP_VENDOR('S', 'D', 'A'),
ISAPNP_FUNCTION(0x0150), pnp_c))) {
pnp_c = pb;
pd = NULL;
- if (!(pd = isapnp_find_dev(pnp_c,
+ 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);
}
- pd->prepare(pd);
- pd->deactivate(pd);
- pd->activate(pd);
- card->para[1] = pd->resource[0].start;
- card->para[2] = pd->resource[1].start;
- card->para[0] = pd->irq_resource[0].start;
- if (!card->para[0] || !card->para[1] || !card->para[2]) {
+ if (pnp_device_attach(pd) < 0) {
+ printk(KERN_ERR "NiccyPnP: attach failed\n");
+ return 0;
+ }
+ if (pnp_activate_dev(pd, NULL) < 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",
- card->para[0], card->para[1], card->para[2]);
- pd->deactivate(pd);
+ 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");
}
};
static struct isapnp_device_id *pdev = &sedl_ids[0];
-static struct pci_bus *pnp_c __devinitdata = NULL;
+static struct pnp_card *pnp_c __devinitdata = NULL;
#endif
int __devinit
} else {
#ifdef __ISAPNP__
if (isapnp_present()) {
- struct pci_bus *pb;
- struct pci_dev *pd;
+ struct pnp_card *pb;
+ struct pnp_dev *pd;
while(pdev->card_vendor) {
- if ((pb = isapnp_find_card(pdev->card_vendor,
- pdev->card_device, pnp_c))) {
+ if ((pb = pnp_find_card(pdev->card_vendor,
+ pdev->card_device,
+ pnp_c))) {
pnp_c = pb;
pd = NULL;
- if ((pd = isapnp_find_dev(pnp_c,
- pdev->vendor, pdev->function, pd))) {
+ if ((pd = pnp_find_dev(pnp_c,
+ pdev->vendor,
+ pdev->function,
+ pd))) {
printk(KERN_INFO "HiSax: %s detected\n",
(char *)pdev->driver_data);
- pd->prepare(pd);
- pd->deactivate(pd);
- pd->activate(pd);
- card->para[1] =
- pd->resource[0].start;
- card->para[0] =
- pd->irq_resource[0].start;
- if (!card->para[0] || !card->para[1]) {
+ if (pnp_device_attach(pd) < 0) {
+ printk(KERN_ERR "Sedlbauer PnP: attach failed\n");
+ return 0;
+ }
+ if (pnp_activate_dev(pd, NULL) < 0) {
+ printk(KERN_ERR "Sedlbauer PnP: activate failed\n");
+ pnp_device_detach(pd);
+ return 0;
+ }
+ if (!pnp_irq_valid(pd, 0) || !pnp_port_valid(pd, 0)) {
printk(KERN_ERR "Sedlbauer PnP:some resources are missing %ld/%lx\n",
- card->para[0], card->para[1]);
- pd->deactivate(pd);
+ 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);
cs->hw.sedl.cfg_reg = card->para[1];
cs->irq = card->para[0];
if (pdev->function == ISAPNP_FUNCTION(0x2)) {
};
static struct isapnp_device_id *tdev = &teles_ids[0];
-static struct pci_bus *pnp_c __devinitdata = NULL;
+static struct pnp_card *pnp_c __devinitdata = NULL;
#endif
int __devinit
#ifdef __ISAPNP__
if (!card->para[1] && isapnp_present()) {
- struct pci_bus *pb;
- struct pci_dev *pd;
+ struct pnp_card *pnp_card;
+ struct pnp_dev *pnp_dev;
while(tdev->card_vendor) {
- if ((pb = isapnp_find_card(tdev->card_vendor,
- tdev->card_device, pnp_c))) {
- pnp_c = pb;
- pd = NULL;
- if ((pd = isapnp_find_dev(pnp_c,
- tdev->vendor, tdev->function, pd))) {
+ 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);
- pd->prepare(pd);
- pd->deactivate(pd);
- pd->activate(pd);
- card->para[3] = pd->resource[2].start;
- card->para[2] = pd->resource[1].start;
- card->para[1] = pd->resource[0].start;
- card->para[0] = pd->irq_resource[0].start;
- if (!card->para[0] || !card->para[1] || !card->para[2]) {
- printk(KERN_ERR "Teles PnP:some resources are missing %ld/%lx/%lx\n",
- card->para[0], card->para[1], card->para[2]);
- pd->deactivate(pd);
- return(0);
+ if (pnp_device_attach(pnp_dev) < 0) {
+ printk(KERN_ERR "Teles PnP: attach failed\n");
+ return 0;
}
+ if (pnp_activate_dev(pnp_dev, NULL) < 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");
static int cadet_lock=0;
static int cadet_probe(void);
-static struct pci_dev *dev;
+static struct pnp_dev *dev = NULL;
static int isapnp_cadet_probe(void);
/*
static int isapnp_cadet_probe(void)
{
- dev = isapnp_find_dev (NULL, ISAPNP_VENDOR('M','S','M'),
- ISAPNP_FUNCTION(0x0c24), NULL);
+ dev = pnp_find_dev (NULL, ISAPNP_VENDOR('M','S','M'),
+ ISAPNP_FUNCTION(0x0c24), NULL);
if (!dev)
return -ENODEV;
- if (dev->prepare(dev)<0)
+ if (pnp_device_attach(dev) < 0)
return -EAGAIN;
- if (!(dev->resource[0].flags & IORESOURCE_IO))
+ if (pnp_activate_dev(dev, NULL) < 0) {
+ printk ("radio-cadet: pnp configure failed (out of resources?)\n");
+ pnp_device_detach(dev);
+ return -EIO;
+ }
+ if (!pnp_port_valid(dev, 0)) {
+ pnp_device_detach(dev);
return -ENODEV;
- if (dev->activate(dev)<0) {
- printk ("radio-cadet: isapnp configure failed (out of resources?)\n");
- return -ENOMEM;
}
- io = dev->resource[0].start;
+ io = pnp_port_start(dev, 0);
- printk ("radio-cadet: ISAPnP reports card at %#x\n", io);
+ printk ("radio-cadet: PnP reports device at %#x\n", io);
return io;
}
release_region(io,2);
if (dev)
- dev->deactivate(dev);
+ pnp_device_detach(dev);
}
module_init(cadet_init);
static int io = -1;
static int radio_nr = -1;
-static struct pci_dev *dev = NULL;
+static struct pnp_dev *dev = NULL;
static struct semaphore lock;
/* freq is in 1/16 kHz to internal number, hw precision is 50 kHz */
int i = 0;
while (id_table[i].card_vendor != 0 && dev == NULL) {
- dev = isapnp_find_dev(NULL, id_table[i].vendor,
- id_table[i].function, NULL);
+ dev = pnp_find_dev(NULL, id_table[i].vendor,
+ id_table[i].function, NULL);
i++;
}
if (!dev)
return -ENODEV;
- if (dev->prepare(dev) < 0)
+ if (pnp_device_attach(dev) < 0)
return -EAGAIN;
- if (!(dev->resource[0].flags & IORESOURCE_IO))
- return -ENODEV;
- if (dev->activate(dev) < 0) {
- printk ("radio-sf16fmi: ISAPnP configure failed (out of resources?)\n");
+ if (pnp_activate_dev(dev, NULL) < 0) {
+ printk ("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 = dev->resource[0].start;
- printk ("radio-sf16fmi: ISAPnP reports card at %#x\n", i);
+ i = pnp_port_start(dev, 0);
+ printk ("radio-sf16fmi: PnP reports card at %#x\n", i);
return i;
}
video_unregister_device(&fmi_radio);
release_region(io, 2);
if (dev)
- dev->deactivate(dev);
+ pnp_device_detach(dev);
}
module_init(fmi_init);
#ifdef CONFIG_PM
struct pm_dev *pmdev;
#endif
+#ifdef __ISAPNP__
+ struct pnp_dev *pnpdev;
+#endif
};
static int id_port __initdata = 0x110; /* Start with 0x110 to avoid new sound cards.*/
static struct net_device *el3_root_dev;
int mca_slot = -1;
#ifdef __ISAPNP__
static int pnp_cards;
+ struct pnp_dev *idev = NULL;
#endif /* __ISAPNP__ */
if (dev) SET_MODULE_OWNER(dev);
goto no_pnp;
for (i=0; el3_isapnp_adapters[i].vendor != 0; i++) {
- struct pci_dev *idev = NULL;
int j;
- while ((idev = isapnp_find_dev(NULL,
- el3_isapnp_adapters[i].vendor,
- el3_isapnp_adapters[i].function,
- idev))) {
- idev->prepare(idev);
- /* Deactivation is needed if the driver was called
- with "nopnp=1" before, does not harm if not. */
- idev->deactivate(idev);
- idev->activate(idev);
- if (!idev->resource[0].start || check_region(idev->resource[0].start, EL3_IO_EXTENT))
+ while ((idev = pnp_find_dev(NULL,
+ el3_isapnp_adapters[i].vendor,
+ el3_isapnp_adapters[i].function,
+ idev))) {
+ if (pnp_device_attach(idev) < 0)
continue;
- ioaddr = idev->resource[0].start;
- if (!request_region(ioaddr, EL3_IO_EXTENT, "3c509 PnP"))
+ if (pnp_activate_dev(idev, NULL) < 0) {
+ __again:
+ pnp_device_detach(idev);
+ continue;
+ }
+ if (!pnp_port_valid(idev, 0) || !pnp_irq_valid(idev, 0))
+ goto __again;
+ ioaddr = pnp_port_start(idev, 0);
+ if (!request_region(ioaddr, EL3_IO_EXTENT, "3c509 PnP")) {
+ pnp_device_detach(idev);
return -EBUSY;
- irq = idev->irq_resource[0].start;
+ }
+ irq = pnp_irq(idev, 0);
if (el3_debug > 3)
printk ("ISAPnP reports %s at i/o 0x%x, irq %d\n",
(char*) el3_isapnp_adapters[i].driver_data, ioaddr, irq);
memset(dev->priv, 0, sizeof(struct el3_private));
lp = dev->priv;
+#ifdef __ISAPNP__
+ lp->pnpdev = idev;
+#endif
lp->mca_slot = mca_slot;
lp->next_dev = el3_root_dev;
spin_lock_init(&lp->lock);
next_dev = lp->next_dev;
unregister_netdev(el3_root_dev);
release_region(el3_root_dev->base_addr, EL3_IO_EXTENT);
+#ifdef __ISAPNP__
+ if (lp->pnpdev)
+ pnp_device_detach(lp->pnpdev);
+#endif
kfree(el3_root_dev);
el3_root_dev = next_dev;
}
if(nopnp == 1)
goto no_pnp;
for(i=0; corkscrew_isapnp_adapters[i].vendor != 0; i++) {
- struct pci_dev *idev = NULL;
+ struct pnp_dev *idev = NULL;
int irq;
- while((idev = isapnp_find_dev(NULL,
- corkscrew_isapnp_adapters[i].vendor,
- corkscrew_isapnp_adapters[i].function,
- idev))) {
+ while((idev = pnp_find_dev(NULL,
+ corkscrew_isapnp_adapters[i].vendor,
+ corkscrew_isapnp_adapters[i].function,
+ idev))) {
- if(idev->active) idev->deactivate(idev);
-
- if(idev->prepare(idev)<0)
- continue;
- if (!(idev->resource[0].flags & IORESOURCE_IO))
+ if (pnp_device_attach(idev) < 0)
continue;
- if(idev->activate(idev)<0) {
- printk("isapnp configure failed (out of resources?)\n");
+ if (pnp_activate_dev(idev, NULL) < 0) {
+ printk("pnp activate failed (out of resources?)\n");
+ pnp_device_detach(idev);
return -ENOMEM;
}
- if (!idev->resource[0].start || check_region(idev->resource[0].start,16))
+ if (!pnp_port_valid(idev, 0) || !pnp_irq_valid(idev, 0)) {
+ pnp_device_detach(idev);
continue;
- ioaddr = idev->resource[0].start;
- irq = idev->irq_resource[0].start;
+ }
+ ioaddr = pnp_port_start(idev, 0);
+ irq = pnp_irq(idev, 0);
if(corkscrew_debug)
printk ("ISAPNP reports %s at i/o 0x%x, irq %d\n",
(char*) corkscrew_isapnp_adapters[i].driver_data, ioaddr, irq);
- if ((inw(ioaddr + 0x2002) & 0x1f0) != (ioaddr & 0x1f0))
+ if ((inw(ioaddr + 0x2002) & 0x1f0) != (ioaddr & 0x1f0)) {
+ pnp_device_detach(idev);
continue;
+ }
/* Verify by reading the device ID from the EEPROM. */
{
int timer;
== 0)
break;
}
- if (inw(ioaddr + Wn0EepromData) != 0x6d50)
+ if (inw(ioaddr + Wn0EepromData) != 0x6d50) {
+ pnp_device_detach(idev);
continue;
+ }
}
printk(KERN_INFO "3c515 Resource configuration register %#4.4x, DCR %4.4x.\n",
inl(ioaddr + 0x2002), inw(ioaddr + 0x2000));
#include <linux/isapnp.h>
#define AIRONET4X00_IO_SIZE 0x40
-#define isapnp_logdev pci_dev
-#define isapnp_dev pci_bus
-#define isapnp_find_device isapnp_find_card
-#define isapnp_find_logdev isapnp_find_dev
-#define PNP_BUS bus
+#define isapnp_logdev pnp_dev
+#define isapnp_dev pnp_card
+#define isapnp_find_device pnp_find_card
+#define isapnp_find_logdev pnp_find_dev
+#define PNP_BUS card
#define PNP_BUS_NUMBER number
-#define PNP_DEV_NUMBER devfn
+#define PNP_DEV_NUMBER number
int awc4500_pnp_hw_reset(struct net_device *dev){
+
struct isapnp_logdev *logdev;
DEBUG(0, "awc_pnp_reset \n");
return -1;
};
- if (isapnp_cfg_begin(logdev->PNP_BUS->PNP_BUS_NUMBER, logdev->PNP_DEV_NUMBER)<0)
- printk("isapnp cfg failed at release \n");
- isapnp_deactivate(logdev->PNP_DEV_NUMBER);
- isapnp_cfg_end();
+ pnp_disable_dev(logdev);
udelay(100);
-
- if (isapnp_cfg_begin(logdev->PNP_BUS->PNP_BUS_NUMBER, logdev->PNP_DEV_NUMBER) < 0) {
+ if (pnp_activate_dev(logdev, NULL) < 0) {
printk("%s cfg begin failed in hw_reset for csn %x devnum %x \n",
dev->name, logdev->PNP_BUS->PNP_BUS_NUMBER, logdev->PNP_DEV_NUMBER);
return -EAGAIN;
}
- isapnp_activate(logdev->PNP_DEV_NUMBER); /* activate device */
- isapnp_cfg_end();
-
return 0;
}
isa_index++;
logdev = isapnp_find_logdev(pnp_dev, ISAPNP_VENDOR('A','W','L'),
- ISAPNP_FUNCTION(1),
- 0);
+ ISAPNP_FUNCTION(1),
+ 0);
if (!logdev){
printk("No logical device found on Aironet board \n");
return -ENODEV;
}
- if (isapnp_cfg_begin(logdev->PNP_BUS->PNP_BUS_NUMBER, logdev->PNP_DEV_NUMBER) < 0) {
- printk("cfg begin failed for csn %x devnum %x \n",
+ if (pnp_device_attach(logdev) < 0) {
+ printk("pnp_device_attach failed for csn %x devnum %x \n",
logdev->PNP_BUS->PNP_BUS_NUMBER, logdev->PNP_DEV_NUMBER);
return -EAGAIN;
}
- isapnp_activate(logdev->PNP_DEV_NUMBER); /* activate device */
- isapnp_cfg_end();
+ if (pnp_activate_dev(logdev, NULL) < 0) {
+ printk("pnp_activate_dev failed for csn %x devnum %x \n",
+ logdev->PNP_BUS->PNP_BUS_NUMBER, logdev->PNP_DEV_NUMBER);
+ pnp_device_detach(logdev);
+ return -EIO;
+ }
- isa_irq_line = logdev->irq;
- isa_ioaddr = logdev->resource[0].start;
+ isa_irq_line = pnp_irq(logdev, 0);
+ isa_ioaddr = pnp_port_start(logdev, 0);
request_region(isa_ioaddr, AIRONET4X00_IO_SIZE, "aironet4x00 ioaddr");
if (!dev) {
dev = init_etherdev(NULL, 0);
if (!dev) {
release_region(isa_ioaddr, AIRONET4X00_IO_SIZE);
- isapnp_cfg_begin(logdev->PNP_BUS->PNP_BUS_NUMBER,
- logdev->PNP_DEV_NUMBER);
- isapnp_deactivate(logdev->PNP_DEV_NUMBER);
- isapnp_cfg_end();
+ pnp_device_detach(logdev);
return -ENOMEM;
}
}
int i;
for (i = 0; isapnp_clone_list[i].vendor != 0; i++) {
- struct pci_dev *idev = NULL;
+ struct pnp_dev *idev = NULL;
- while ((idev = isapnp_find_dev(NULL,
- isapnp_clone_list[i].vendor,
- isapnp_clone_list[i].function,
- idev))) {
+ while ((idev = pnp_find_dev(NULL,
+ isapnp_clone_list[i].vendor,
+ isapnp_clone_list[i].function,
+ idev))) {
/* Avoid already found cards from previous calls */
- if (idev->prepare(idev))
- continue;
- if (idev->activate(idev))
- continue;
- /* if no irq, search for next */
- if (idev->irq_resource[0].start == 0)
+ if (pnp_device_attach(idev) < 0)
continue;
+ if (pnp_activate_dev(idev, NULL) < 0) {
+ __again:
+ pnp_device_detach(idev);
+ }
+ /* if no io and irq, search for next */
+ if (!pnp_port_valid(idev, 0) || !pnp_irq_valid(idev, 0))
+ goto __again;
/* found it */
- dev->base_addr = idev->resource[0].start;
- dev->irq = idev->irq_resource[0].start;
+ dev->base_addr = pnp_port_start(idev, 0);
+ dev->irq = pnp_irq(idev, 0);
printk(KERN_INFO "ne.c: ISAPnP reports %s at i/o %#lx, irq %d.\n",
(char *) isapnp_clone_list[i].driver_data,
-
dev->base_addr, dev->irq);
if (ne_probe1(dev, dev->base_addr) != 0) { /* Shouldn't happen. */
printk(KERN_ERR "ne.c: Probe of ISAPnP card at %#lx failed.\n", dev->base_addr);
+ pnp_device_detach(idev);
return -ENXIO;
}
ei_status.priv = (unsigned long)idev;
{
unsigned short ioaddr[2], irq;
- struct pci_dev *idev=NULL;
+ struct pnp_dev *idev=NULL;
unsigned int serial_number;
while(1)
* Find the card
*/
- idev=isapnp_find_dev(NULL, ISAPNP_VENDOR('G','I','C'),
+ idev=pnp_find_dev(NULL, ISAPNP_VENDOR('G','I','C'),
ISAPNP_FUNCTION(0x1000), idev);
/*
* No card
*/
- if(idev==NULL)
+ if(idev==NULL || idev->card == NULL)
return -ENODEV;
/*
* Bring it online
*/
- idev->prepare(idev);
- idev->activate(idev);
+ if (pnp_device_attach(idev) < 0)
+ continue;
+ if (pnp_activate_dev(idev, NULL) < 0) {
+ __again:
+ pnp_device_detach(idev);
+ continue;
+ }
/*
* Ports free ?
*/
- if(!idev->resource[0].start || check_region(idev->resource[0].start, 16))
- continue;
- if(!idev->resource[1].start || check_region(idev->resource[1].start, 16))
- continue;
+ if(!pnp_port_valid(idev, 0) || !pnp_port_valid(idev, 1) || !pnp_irq_valid(idev, 0))
+ goto __again;
- serial_number = idev->bus->serial;
+ serial_number = idev->card->serial;
- ioaddr[0]=idev->resource[0].start;
- ioaddr[1]=idev->resource[1].start;
+ ioaddr[0]=pnp_port_start(idev, 0);
+ ioaddr[1]=pnp_port_start(idev, 0);
- irq = idev->irq_resource[0].start;
+ irq = pnp_irq(idev, 0);
/* check I/O base and IRQ */
if (dev->base_addr != 0 && dev->base_addr != ioaddr[0])
- continue;
+ goto __again;
if (dev->mem_start != 0 && dev->mem_start != ioaddr[1])
- continue;
+ goto __again;
if (dev->irq != 0 && dev->irq != irq)
- continue;
+ goto __again;
/*
* Ok set it up.
*/
if (!request_region(ioaddr[0], 16, dev->name))
- continue;
+ goto __again;
if (!request_region(ioaddr[1], 16, dev->name)) {
release_region(ioaddr[0], 16);
- continue;
+ goto __again;
}
dev->base_addr = ioaddr[0];
dev->mem_start, serial_number, dev->irq);
dev = init_etherdev(dev, 0);
- if (!dev)
+ if (!dev) {
+ pnp_device_detach(idev);
+ release_region(ioaddr[1], 16);
+ release_region(ioaddr[0], 16);
return -ENOMEM;
+ }
SET_MODULE_OWNER(dev);
/* Make up a SB1000-specific-data structure. */
int i;
for (i = 0; ultra_device_ids[i].vendor != 0; i++) {
- struct pci_dev *idev = NULL;
+ struct pnp_dev *idev = NULL;
- while ((idev = isapnp_find_dev(NULL,
- ultra_device_ids[i].vendor,
- ultra_device_ids[i].function,
- idev))) {
+ while ((idev = pnp_find_dev(NULL,
+ ultra_device_ids[i].vendor,
+ ultra_device_ids[i].function,
+ idev))) {
/* Avoid already found cards from previous calls */
- if (idev->prepare(idev))
- continue;
- if (idev->activate(idev))
- continue;
- /* if no irq, search for next */
- if (idev->irq_resource[0].start == 0)
- continue;
+ if (pnp_device_attach(idev) < 0)
+ continue;
+ if (pnp_activate_dev(idev, NULL) < 0) {
+ __again:
+ pnp_device_detach(idev);
+ continue;
+ }
+ /* if no io and irq, search for next */
+ if (!pnp_port_valid(idev, 0) || !pnp_irq_valid(idev, 0))
+ goto __again;
/* found it */
- dev->base_addr = idev->resource[0].start;
- dev->irq = idev->irq_resource[0].start;
+ dev->base_addr = pnp_port_start(idev, 0);
+ dev->irq = pnp_irq(idev, 0);
printk(KERN_INFO "smc-ultra.c: ISAPnP reports %s at i/o %#lx, irq %d.\n",
(char *) ultra_device_ids[i].driver_data,
-
dev->base_addr, dev->irq);
if (ultra_probe1(dev, dev->base_addr) != 0) { /* Shouldn't happen. */
- printk(KERN_ERR "smc-ultra.c: Probe of ISAPnP card at %#lx failed.\n", dev->base_addr); return -ENXIO;
+ printk(KERN_ERR "smc-ultra.c: Probe of ISAPnP card at %#lx failed.\n", dev->base_addr);
+ pnp_device_detach(idev);
+ return -ENXIO;
}
ei_status.priv = (unsigned long)idev;
break;
for (devid = id_table; devid->vendor; devid++) {
if ((dev = pnp_find_dev(NULL, devid->vendor, devid->function, NULL))) {
+
+ if (pnp_device_attach(dev) < 0)
+ continue;
+
printk("PNP ");
-
+
if (pnp_activate_dev(dev, NULL) < 0) {
printk("activate failed\n");
+ pnp_device_detach(dev);
break;
}
- i365_base = pnp_port_start(dev, 0);
- if (i365_base) {
- printk("no resources ?\n");
+ if (pnp_port_valid(dev, 0)) {
+ printk("invalid resources ?\n");
+ pnp_device_detach(dev);
break;
}
+ i365_base = pnp_port_start(dev, 0);
i82365_pnpdev = dev;
break;
}
card->dev.parent = &card->protocol->dev;
card->dev.bus = &pnpc_bus_type;
card->dev.release = &pnp_release_card;
+ card->status = PNP_READY;
error = device_register(&card->dev);
if (error == 0){
struct list_head *pos;
}
}
+int pnpc_attach(struct pnp_card *pnp_card)
+{
+ spin_lock(&pnp_lock);
+ if(pnp_card->status != PNP_READY){
+ spin_unlock(&pnp_lock);
+ return -EBUSY;
+ }
+ pnp_card->status = PNP_ATTACHED;
+ spin_unlock(&pnp_lock);
+ return 0;
+}
+
+void pnpc_detach(struct pnp_card *pnp_card)
+{
+ spin_lock(&pnp_lock);
+ if (pnp_card->status == PNP_ATTACHED)
+ pnp_card->status = PNP_READY;
+ spin_unlock(&pnp_lock);
+ pnpc_recover_devices(pnp_card);
+}
+
static int pnpc_card_probe(struct device *dev)
{
int error = 0;
pnp_dbg("pnp: match found with the PnP card '%s' and the driver '%s'", dev->bus_id,drv->name);
+ error = pnpc_attach(card);
+ if (error < 0)
+ return error;
if (drv->probe) {
card_id = match_card(drv, card);
if (card_id != NULL)
card->driver = drv;
error = 0;
} else
- pnpc_recover_devices(card);
+ pnpc_detach(card);
}
return error;
}
drv->remove(card);
card->driver = NULL;
}
- pnpc_recover_devices(card);
+ pnpc_detach(card);
return 0;
}
EXPORT_SYMBOL(pnpc_register_driver);
EXPORT_SYMBOL(pnpc_unregister_driver);
EXPORT_SYMBOL(pnpc_add_id);
+EXPORT_SYMBOL(pnpc_attach);
+EXPORT_SYMBOL(pnpc_detach);
return NULL;
}
+int pnp_device_attach(struct pnp_dev *pnp_dev)
+{
+ spin_lock(&pnp_lock);
+ if(pnp_dev->status != PNP_READY){
+ spin_unlock(&pnp_lock);
+ return -EBUSY;
+ }
+ pnp_dev->status = PNP_ATTACHED;
+ spin_unlock(&pnp_lock);
+ return 0;
+}
+
+void pnp_device_detach(struct pnp_dev *pnp_dev)
+{
+ spin_lock(&pnp_lock);
+ if (pnp_dev->status == PNP_ATTACHED)
+ pnp_dev->status = PNP_READY;
+ spin_unlock(&pnp_lock);
+ pnp_disable_dev(pnp_dev);
+}
+
static int pnp_device_probe(struct device *dev)
{
int error;
pnp_dbg("pnp: match found with the PnP device '%s' and the driver '%s'", dev->bus_id,pnp_drv->name);
- spin_lock(&pnp_lock);
- if(pnp_dev->status != PNP_READY){
- spin_unlock(&pnp_lock);
- return -EBUSY;
- }
- pnp_dev->status = PNP_ATTACHED;
- spin_unlock(&pnp_lock);
+ error = pnp_device_attach(pnp_dev);
+ if (error < 0)
+ return error;
if (pnp_dev->active == 0) {
if (!(pnp_drv->flags & PNP_DRIVER_DO_NOT_ACTIVATE)) {
return error;
fail:
- pnp_dev->status = PNP_READY;
- pnp_disable_dev(pnp_dev);
+ pnp_device_detach(pnp_dev);
return error;
}
drv->remove(pnp_dev);
pnp_dev->driver = NULL;
}
- spin_lock(&pnp_lock);
- if (pnp_dev->status == PNP_ATTACHED)
- pnp_dev->status = PNP_READY;
- spin_unlock(&pnp_lock);
- pnp_disable_dev(pnp_dev);
+ pnp_device_detach(pnp_dev);
return 0;
}
EXPORT_SYMBOL(pnp_register_driver);
EXPORT_SYMBOL(pnp_unregister_driver);
EXPORT_SYMBOL(pnp_add_id);
+EXPORT_SYMBOL(pnp_device_attach);
+EXPORT_SYMBOL(pnp_device_detach);
str += sprintf(str,"DISABLED\n");
goto done;
}
- for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
- if (dev->resource[i].flags & IORESOURCE_IO){
- str += sprintf(str,"io");
- str += sprintf(str," 0x%lx-0x%lx \n",
- dev->resource[i].start,
- dev->resource[i].end);
- }
- if (dev->resource[i].flags & IORESOURCE_MEM){
- str += sprintf(str,"mem");
- str += sprintf(str," 0x%lx-0x%lx \n",
- dev->resource[i].start,
- dev->resource[i].end);
- }
+ for (i = 0; i < DEVICE_COUNT_IO; i++) {
+ if (pnp_port_valid(dev, i)) {
+ str += sprintf(str,"io");
+ str += sprintf(str," 0x%lx-0x%lx \n",
+ pnp_port_start(dev, i),
+ pnp_port_end(dev, i));
+ }
}
- for (i = 0; i < DEVICE_COUNT_IRQ && dev->irq_resource[i].flags
- & IORESOURCE_IRQ; i++) {
+ for (i = 0; i < DEVICE_COUNT_MEM; i++) {
+ if (pnp_mem_valid(dev, i)) {
+ str += sprintf(str,"mem");
+ str += sprintf(str," 0x%lx-0x%lx \n",
+ pnp_mem_start(dev, i),
+ pnp_mem_end(dev, i));
+ }
+ }
+ for (i = 0; i < DEVICE_COUNT_IRQ; i++) {
+ if (pnp_irq_valid(dev, i)) {
str += sprintf(str,"irq");
- str += sprintf(str," %ld \n", dev->irq_resource[i].start);
+ str += sprintf(str," %ld \n", pnp_irq(dev, i));
+ }
}
- for (i = 0; i < DEVICE_COUNT_DMA && dev->dma_resource[i].flags
- & IORESOURCE_DMA; i++) {
+ for (i = 0; i < DEVICE_COUNT_DMA; i++) {
+ if (pnp_dma_valid(dev, i)) {
str += sprintf(str,"dma");
- str += sprintf(str," %ld \n", dev->dma_resource[i].start);
+ str += sprintf(str," %ld \n", pnp_dma(dev, i));
+ }
}
done:
return (str - buf);
/* TODO: see if more isapnp functions are needed here */
-#include <linux/pnp.h>
+#include <linux/config.h>
+#include <linux/version.h>
+#include <linux/module.h>
#include <linux/isapnp.h>
#include <linux/string.h>
-#include <linux/module.h>
static void pnp_convert_id(char *buf, unsigned short vendor, unsigned short device)
{
unsigned short device,
struct pnp_card *from)
{
- char id[7];
- char any[7];
+ char id[8];
+ char any[8];
struct list_head *list;
pnp_convert_id(id, vendor, device);
pnp_convert_id(any, ISAPNP_ANY_ID, ISAPNP_ANY_ID);
unsigned short function,
struct pnp_dev *from)
{
- char id[7];
- char any[7];
+ char id[8];
+ char any[8];
pnp_convert_id(id, vendor, function);
pnp_convert_id(any, ISAPNP_ANY_ID, ISAPNP_ANY_ID);
if (card == NULL) { /* look for a logical device from all cards */
dev->irq_resource[idx].name = NULL;
dev->irq_resource[idx].start = -1;
dev->irq_resource[idx].end = -1;
- dev->irq_resource[idx].flags = 0;
+ dev->irq_resource[idx].flags = IORESOURCE_IRQ|IORESOURCE_UNSET;
}
for (idx = 0; idx < DEVICE_COUNT_DMA; idx++) {
dev->dma_resource[idx].name = NULL;
dev->dma_resource[idx].start = -1;
dev->dma_resource[idx].end = -1;
- dev->dma_resource[idx].flags = 0;
+ dev->dma_resource[idx].flags = IORESOURCE_DMA|IORESOURCE_UNSET;
}
- for (idx = 0; idx < DEVICE_COUNT_RESOURCE; idx++) {
- dev->resource[idx].name = NULL;
- dev->resource[idx].start = 0;
- dev->resource[idx].end = 0;
- dev->resource[idx].flags = 0;
+ for (idx = 0; idx < DEVICE_COUNT_IO; idx++) {
+ dev->io_resource[idx].name = NULL;
+ dev->io_resource[idx].start = 0;
+ dev->io_resource[idx].end = 0;
+ dev->io_resource[idx].flags = IORESOURCE_IO|IORESOURCE_UNSET;
+ }
+ for (idx = 0; idx < DEVICE_COUNT_MEM; idx++) {
+ dev->mem_resource[idx].name = NULL;
+ dev->mem_resource[idx].start = 0;
+ dev->mem_resource[idx].end = 0;
+ dev->mem_resource[idx].flags = IORESOURCE_MEM|IORESOURCE_UNSET;
}
return 0;
}
static int isapnp_get_resources(struct pnp_dev *dev)
{
/* We don't need to do anything but this, the rest is taken care of */
- if ((dev->resource[0].start == 0) &&
- (dev->irq_resource[0].start == -1) &&
- (dev->dma_resource[0].start == -1))
+ if (pnp_port_valid(dev, 0) == 0 &&
+ pnp_mem_valid(dev, 0) == 0 &&
+ pnp_irq_valid(dev, 0) == 0 &&
+ pnp_dma_valid(dev, 0) == 0)
dev->active = 0;
else
dev->active = 1;
dev->irq_resource[1] = cfg->request.irq_resource[1];
dev->dma_resource[0] = cfg->request.dma_resource[0];
dev->dma_resource[1] = cfg->request.dma_resource[1];
- for (tmp = 0; tmp < 12; tmp++) {
- dev->resource[tmp] = cfg->request.resource[tmp];
- }
- for (tmp = 0; tmp < 8 && dev->resource[tmp].flags; tmp++)
- isapnp_write_word(ISAPNP_CFG_PORT+(tmp<<1), dev->resource[tmp].start);
- for (tmp = 0; tmp < 2 && dev->irq_resource[tmp].flags; tmp++) {
- int irq = dev->irq_resource[tmp].start;
+ for (tmp = 0; tmp < DEVICE_COUNT_IO; tmp++)
+ dev->io_resource[tmp] = cfg->request.io_resource[tmp];
+ for (tmp = 0; tmp < DEVICE_COUNT_MEM; tmp++)
+ dev->mem_resource[tmp] = cfg->request.mem_resource[tmp];
+ for (tmp = 0; tmp < 8 && pnp_port_valid(dev, tmp); tmp++)
+ isapnp_write_word(ISAPNP_CFG_PORT+(tmp<<1), pnp_port_start(dev, tmp));
+ for (tmp = 0; tmp < 2 && pnp_irq_valid(dev, tmp); tmp++) {
+ int irq = pnp_irq(dev, tmp);
if (irq == 2)
irq = 9;
isapnp_write_byte(ISAPNP_CFG_IRQ+(tmp<<1), irq);
}
- for (tmp = 0; tmp < 2 && dev->dma_resource[tmp].flags; tmp++)
- isapnp_write_byte(ISAPNP_CFG_DMA+tmp, dev->dma_resource[tmp].start);
- for (tmp = 0; tmp < 4 && dev->resource[tmp+8].flags; tmp++)
- isapnp_write_word(ISAPNP_CFG_MEM+(tmp<<2), (dev->resource[tmp + 8].start >> 8) & 0xffff);
+ for (tmp = 0; tmp < 2 && pnp_dma_valid(dev, tmp); tmp++)
+ isapnp_write_byte(ISAPNP_CFG_DMA+tmp, pnp_dma(dev, tmp));
+ for (tmp = 0; tmp < 4 && pnp_mem_valid(dev, tmp); tmp++)
+ isapnp_write_word(ISAPNP_CFG_MEM+(tmp<<2), (pnp_mem_start(dev, tmp) >> 8) & 0xffff);
isapnp_activate(dev->number);
isapnp_cfg_end();
return 0;
*
*/
-
+#include <linux/config.h>
+#include <linux/version.h>
+#include <linux/module.h>
#include <linux/isapnp.h>
-#include <linux/pnp.h>
#include <linux/proc_fs.h>
#include <linux/init.h>
-#include <linux/module.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h>
static void add_irqresource(struct pnp_dev *dev, int irq)
{
int i = 0;
- while (!(dev->irq_resource[i].flags & IORESOURCE_UNSET) && i < DEVICE_COUNT_IRQ) i++;
+ while (pnp_irq_valid(dev, i) && i < DEVICE_COUNT_IRQ) i++;
if (i < DEVICE_COUNT_IRQ) {
- dev->irq_resource[i].start = (unsigned long) irq;
+ dev->irq_resource[i].start =
+ dev->irq_resource[i].end = (unsigned long) irq;
dev->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag
}
}
static void add_dmaresource(struct pnp_dev *dev, int dma)
{
int i = 0;
- while (!(dev->dma_resource[i].flags & IORESOURCE_UNSET) && i < DEVICE_COUNT_DMA) i++;
+ while (pnp_dma_valid(dev, i) && i < DEVICE_COUNT_DMA) i++;
if (i < DEVICE_COUNT_DMA) {
- dev->dma_resource[i].start = (unsigned long) dma;
+ dev->dma_resource[i].start =
+ dev->dma_resource[i].end = (unsigned long) dma;
dev->dma_resource[i].flags = IORESOURCE_DMA; // Also clears _UNSET flag
}
}
static void add_ioresource(struct pnp_dev *dev, int io, int len)
{
int i = 0;
- while (!(dev->resource[i].flags & IORESOURCE_UNSET) && i < DEVICE_COUNT_RESOURCE) i++;
+ while (pnp_port_valid(dev, i) && i < DEVICE_COUNT_IO) i++;
if (i < DEVICE_COUNT_RESOURCE) {
- dev->resource[i].start = (unsigned long) io;
- dev->resource[i].end = (unsigned long)(io + len - 1);
- dev->resource[i].flags = IORESOURCE_IO; // Also clears _UNSET flag
+ dev->io_resource[i].start = (unsigned long) io;
+ dev->io_resource[i].end = (unsigned long)(io + len - 1);
+ dev->io_resource[i].flags = IORESOURCE_IO; // Also clears _UNSET flag
}
}
static void add_memresource(struct pnp_dev *dev, int mem, int len)
{
- int i = 8;
- while (!(dev->resource[i].flags & IORESOURCE_UNSET) && i < DEVICE_COUNT_RESOURCE) i++;
+ int i = 0;
+ while (pnp_mem_valid(dev, i) && i < DEVICE_COUNT_MEM) i++;
if (i < DEVICE_COUNT_RESOURCE) {
- dev->resource[i].start = (unsigned long) mem;
- dev->resource[i].end = (unsigned long)(mem + len - 1);
- dev->resource[i].flags = IORESOURCE_MEM; // Also clears _UNSET flag
+ dev->mem_resource[i].start = (unsigned long) mem;
+ dev->mem_resource[i].end = (unsigned long)(mem + len - 1);
+ dev->mem_resource[i].flags = IORESOURCE_MEM; // Also clears _UNSET flag
}
}
/*
* First, set resource info to default values
*/
- for (i=0;i<DEVICE_COUNT_RESOURCE;i++) {
- dev->resource[i].start = 0; // "disabled"
- dev->resource[i].flags = IORESOURCE_UNSET;
+ for (i=0;i<DEVICE_COUNT_IO;i++) {
+ dev->io_resource[i].start = 0;
+ dev->io_resource[i].end = 0;
+ dev->io_resource[i].flags = IORESOURCE_IO|IORESOURCE_UNSET;
+ }
+ for (i=0;i<DEVICE_COUNT_MEM;i++) {
+ dev->mem_resource[i].start = 0;
+ dev->mem_resource[i].end = 0;
+ dev->mem_resource[i].flags = IORESOURCE_MEM|IORESOURCE_UNSET;
}
for (i=0;i<DEVICE_COUNT_IRQ;i++) {
- dev->irq_resource[i].start = (unsigned long)-1; // "disabled"
- dev->irq_resource[i].flags = IORESOURCE_UNSET;
+ dev->irq_resource[i].start = (unsigned long)-1;
+ dev->irq_resource[i].end = (unsigned long)-1;
+ dev->irq_resource[i].flags = IORESOURCE_IRQ|IORESOURCE_UNSET;
}
for (i=0;i<DEVICE_COUNT_DMA;i++) {
- dev->dma_resource[i].start = (unsigned long)-1; // "disabled"
- dev->dma_resource[i].flags = IORESOURCE_UNSET;
+ dev->dma_resource[i].start = (unsigned long)-1;
+ dev->dma_resource[i].end = (unsigned long)-1;
+ dev->dma_resource[i].flags = IORESOURCE_DMA|IORESOURCE_UNSET;
}
/*
} /* while */
end:
- if ((dev->resource[0].start == 0) &&
- (dev->resource[8].start == 0) &&
- (dev->irq_resource[0].start == -1) &&
- (dev->dma_resource[0].start == -1))
+ if (pnp_port_valid(dev, 0) == 0 &&
+ pnp_mem_valid(dev, 0) == 0 &&
+ pnp_irq_valid(dev, 0) == 0 &&
+ pnp_dma_valid(dev, 0) == 0)
dev->active = 0;
else
dev->active = 1;
pnp_for_each_dev(dev) {
if (dev->active) {
for (tmp = 0; tmp < 8; tmp++) {
- if (dev->resource[tmp].flags) {
- rport = dev->resource[tmp].start;
- rsize = (dev->resource[tmp].end - rport) + 1;
+ if (pnp_port_valid(dev, tmp)) {
+ rport = pnp_port_start(dev, tmp);
+ rsize = pnp_port_len(dev, tmp);
if (port >= rport && port < rport + rsize)
return 1;
if (port + size > rport && port + size < (rport + rsize) - 1)
}
}
for (tmp = 0; tmp < 8 && tmp != idx; tmp++) {
- if (dev->resource[tmp].flags) {
- rport = config->request.resource[tmp].start;
- rsize = (config->request.resource[tmp].end - rport) + 1;
+ if (pnp_port_valid(dev, tmp) &&
+ pnp_flags_valid(&config->request.io_resource[tmp])) {
+ rport = config->request.io_resource[tmp].start;
+ rsize = (config->request.io_resource[tmp].end - rport) + 1;
if (port >= rport && port < rport + rsize)
return 1;
if (port + size > rport && port + size < (rport + rsize) - 1)
pnp_for_each_dev(dev) {
if (dev->active) {
for (tmp = 0; tmp < 4; tmp++) {
- if (dev->resource[tmp + 8].flags) {
- raddr = dev->resource[tmp + 8].start;
- rsize = (dev->resource[tmp + 8].end - raddr) + 1;
+ if (pnp_mem_valid(dev, tmp)) {
+ raddr = pnp_mem_start(dev, tmp);
+ rsize = pnp_mem_len(dev, tmp);
if (addr >= raddr && addr < raddr + rsize)
return 1;
if (addr + size > raddr && addr + size < (raddr + rsize) - 1)
}
}
for (tmp = 0; tmp < 4 && tmp != idx; tmp++) {
- if (dev->resource[tmp + 8].flags) {
- raddr = config->request.resource[tmp + 8].start;
- rsize = (config->request.resource[tmp + 8].end - raddr) + 1;
+ if (pnp_mem_valid(dev, tmp) &&
+ pnp_flags_valid(&config->request.mem_resource[tmp])) {
+ raddr = config->request.mem_resource[tmp].start;
+ rsize = (config->request.mem_resource[tmp].end - raddr) + 1;
if (addr >= raddr && addr < raddr + rsize)
return 1;
if (addr + size > raddr && addr + size < (raddr + rsize) - 1)
}
pnp_for_each_dev(dev) {
if (dev->active) {
- if ((dev->irq_resource[0].flags && dev->irq_resource[0].start == irq) ||
- (dev->irq_resource[1].flags && dev->irq_resource[1].start == irq))
+ if ((pnp_irq_valid(dev, 0) && dev->irq_resource[0].start == irq) ||
+ (pnp_irq_valid(dev, 1) && dev->irq_resource[1].start == irq))
return 1;
}
}
- if (config->request.irq_resource[0].flags && config->request.irq_resource[1].flags &&
- (config->request.irq_resource[0].start == irq))
+ if (pnp_flags_valid(&config->request.irq_resource[0]) &&
+ pnp_flags_valid(&config->request.irq_resource[1]) &&
+ (config->request.irq_resource[0].start == irq))
return 1;
#ifdef CONFIG_PCI
if (!pnp_skip_pci_scan) {
}
pnp_for_each_dev(dev) {
if (dev->active) {
- if ((dev->dma_resource[0].flags && dev->dma_resource[0].start == dma) ||
- (dev->dma_resource[1].flags && dev->dma_resource[1].start == dma))
+ if ((pnp_dma_valid(dev, 0) && pnp_dma(dev, 0) == dma) ||
+ (pnp_dma_valid(dev, 1) && pnp_dma(dev, 1) == dma))
return 1;
}
}
- if (config->request.dma_resource[0].flags && config->request.dma_resource[1].flags &&
- (config->request.dma_resource[0].start == dma))
+ if (pnp_flags_valid(&config->request.dma_resource[0]) &&
+ pnp_flags_valid(&config->request.dma_resource[1]) &&
+ (config->request.dma_resource[0].start == dma))
return 1;
if (request_dma(dma, "pnp"))
return 1;
port = config->port[num];
if (!port)
return 0;
- value1 = &config->request.resource[num].start;
- value2 = &config->request.resource[num].end;
- value3 = &config->request.resource[num].flags;
+ value1 = &config->request.io_resource[num].start;
+ value2 = &config->request.io_resource[num].end;
+ value3 = &config->request.io_resource[num].flags;
*value1 = port->min;
- *value2 = *value1 + port->size -1;
+ *value2 = *value1 + port->size - 1;
*value3 = port->flags | IORESOURCE_IO;
while (pnp_check_port(*value1, port->size, num, config)) {
*value1 += port->align;
mem = config->mem[num];
if (!mem)
return 0;
- value1 = &config->request.resource[num + 8].start;
- value2 = &config->request.resource[num + 8].end;
- value3 = &config->request.resource[num].flags;
+ value1 = &config->request.mem_resource[num].start;
+ value2 = &config->request.mem_resource[num].end;
+ value3 = &config->request.mem_resource[num].flags;
*value1 = mem->min;
- *value2 = *value1 + mem->size -1;
+ *value2 = *value1 + mem->size - 1;
*value3 = mem->flags | IORESOURCE_MEM;
if (!(mem->flags & IORESOURCE_MEM_WRITEABLE))
*value3 |= IORESOURCE_READONLY;
for (idx = 0; idx < DEVICE_COUNT_IRQ; idx++) {
res_config->irq_resource[idx].start = -1;
res_config->irq_resource[idx].end = -1;
- res_config->irq_resource[idx].flags = 0;
+ res_config->irq_resource[idx].flags = IORESOURCE_IRQ|IORESOURCE_UNSET;
}
for (idx = 0; idx < DEVICE_COUNT_DMA; idx++) {
res_config->dma_resource[idx].name = NULL;
res_config->dma_resource[idx].start = -1;
res_config->dma_resource[idx].end = -1;
- res_config->dma_resource[idx].flags = 0;
+ res_config->dma_resource[idx].flags = IORESOURCE_DMA|IORESOURCE_UNSET;
}
- for (idx = 0; idx < DEVICE_COUNT_RESOURCE; idx++) {
- res_config->resource[idx].name = NULL;
- res_config->resource[idx].start = 0;
- res_config->resource[idx].end = 0;
- res_config->resource[idx].flags = 0;
+ for (idx = 0; idx < DEVICE_COUNT_IO; idx++) {
+ res_config->io_resource[idx].name = NULL;
+ res_config->io_resource[idx].start = 0;
+ res_config->io_resource[idx].end = 0;
+ res_config->io_resource[idx].flags = IORESOURCE_IO|IORESOURCE_UNSET;
+ }
+ for (idx = 0; idx < DEVICE_COUNT_MEM; idx++) {
+ res_config->mem_resource[idx].name = NULL;
+ res_config->mem_resource[idx].start = 0;
+ res_config->mem_resource[idx].end = 0;
+ res_config->mem_resource[idx].flags = IORESOURCE_MEM|IORESOURCE_UNSET;
}
return 0;
}
if (!template)
return 0;
for (idx = 0; idx < DEVICE_COUNT_IRQ; idx++)
- if (template->irq_resource[idx].start >= 0)
+ if (pnp_flags_valid(&template->irq_resource[idx]))
config->request.irq_resource[idx] = template->irq_resource[idx];
for (idx = 0; idx < DEVICE_COUNT_DMA; idx++)
- if (template->dma_resource[idx].start >= 0)
+ if (pnp_flags_valid(&template->dma_resource[idx]))
config->request.dma_resource[idx] = template->dma_resource[idx];
- for (idx = 0; idx < DEVICE_COUNT_RESOURCE; idx++)
- if (template->resource[idx].start > 0)
- config->request.resource[idx] = template->resource[idx];
+ for (idx = 0; idx < DEVICE_COUNT_IO; idx++)
+ if (pnp_flags_valid(&template->io_resource[idx]))
+ config->request.io_resource[idx] = template->io_resource[idx];
+ for (idx = 0; idx < DEVICE_COUNT_MEM; idx++)
+ if (pnp_flags_valid(&template->io_resource[idx]))
+ config->request.mem_resource[idx] = template->mem_resource[idx];
return 0;
}
{
if (resource == NULL)
return;
- resource->flags &= ~IORESOURCE_AUTO;
+ resource->flags &= ~(IORESOURCE_AUTO|IORESOURCE_UNSET);
resource->start = start;
resource->end = start + size - 1;
}
{
int i;
- for (i=0;i<DEVICE_COUNT_RESOURCE;i++) {
- if ( dev->resource[i].flags & IORESOURCE_UNSET )
+ for (i=0;i<DEVICE_COUNT_IO;i++) {
+ if (pnp_port_valid(dev, i))
/* end of resources */
- break;
- if (dev->resource[i].flags & IORESOURCE_IO) {
- /* ioport */
- if ( dev->resource[i].start == 0 )
- /* disabled */
- /* Do nothing */
- continue;
- if ( dev->resource[i].start < 0x100 )
- /*
- * Below 0x100 is only standard PC hardware
- * (pics, kbd, timer, dma, ...)
- * We should not get resource conflicts there,
- * and the kernel reserves these anyway
- * (see arch/i386/kernel/setup.c).
- * So, do nothing
- */
- continue;
- if ( dev->resource[i].end < dev->resource[i].start )
- /* invalid endpoint */
- /* Do nothing */
- continue;
- reserve_ioport_range(
- dev->dev.bus_id,
- dev->resource[i].start,
- dev->resource[i].end
- );
- } else if (dev->resource[i].flags & IORESOURCE_MEM) {
- /* iomem */
- /* For now do nothing */
continue;
- } else {
- /* Neither ioport nor iomem */
+ if (pnp_port_start(dev, i) == 0)
+ /* disabled */
/* Do nothing */
continue;
- }
+ if (pnp_port_start(dev, i) < 0x100)
+ /*
+ * Below 0x100 is only standard PC hardware
+ * (pics, kbd, timer, dma, ...)
+ * We should not get resource conflicts there,
+ * and the kernel reserves these anyway
+ * (see arch/i386/kernel/setup.c).
+ * So, do nothing
+ */
+ continue;
+ if (pnp_port_end(dev, i) < pnp_port_start(dev, i))
+ /* invalid endpoint */
+ /* Do nothing */
+ continue;
+ reserve_ioport_range(
+ dev->dev.bus_id,
+ pnp_port_start(dev, i),
+ pnp_port_end(dev, i)
+ );
}
return;
}
#ifdef __ISAPNP__
-static struct pci_dev *pnpdev[2];
+static struct pnp_dev *pnpdev[2];
static int num_pnpdevs;
#endif
int aha152x_detect(Scsi_Host_Template * tpnt)
#if defined(AUTOCONF)
aha152x_config conf;
#ifdef __ISAPNP__
- struct pci_dev *dev = NULL;
+ struct pnp_dev *dev = NULL;
#endif
#endif
tpnt->proc_name = "aha152x";
#endif
#ifdef __ISAPNP__
- while ( setup_count<ARRAY_SIZE(setup) && (dev=isapnp_find_dev(NULL, ISAPNP_VENDOR('A','D','P'), ISAPNP_FUNCTION(0x1505), dev)) ) {
- if (dev->prepare(dev) < 0)
+ while ( setup_count<ARRAY_SIZE(setup) && (dev=pnp_find_dev(NULL, ISAPNP_VENDOR('A','D','P'), ISAPNP_FUNCTION(0x1505), dev)) ) {
+ if (pnp_device_attach(dev) < 0)
continue;
- if (dev->active)
+ if (pnp_activate_dev(dev, NULL) < 0) {
+ pnp_device_detach(dev);
continue;
- if (!(dev->resource[0].flags & IORESOURCE_IO))
- continue;
- dev->resource[0].flags |= IORESOURCE_AUTO;
- if (dev->activate(dev) < 0)
+ }
+ if (!pnp_port_valid(dev, 0)) {
+ pnp_device_detach(dev);
continue;
- if ( setup_count==1 && dev->resource[0].start==setup[0].io_port) {
- dev->deactivate(dev);
+ }
+ if (setup_count==1 && pnp_port_start(dev, 0)==setup[0].io_port) {
+ pnp_device_detach(dev);
continue;
}
- setup[setup_count].io_port = dev->resource[0].start;
- setup[setup_count].irq = dev->irq_resource[0].start;
+ setup[setup_count].io_port = pnp_port_start(dev, 0);
+ setup[setup_count].irq = pnp_irq(dev, 0);
setup[setup_count].scsiid = 7;
setup[setup_count].reconnect = 1;
setup[setup_count].parity = 1;
#ifdef __ISAPNP__
while (num_pnpdevs--)
- pnpdev[num_pnpdevs]->deactivate(pnpdev[num_pnpdevs]);
+ pnp_device_detach(pnpdev[num_pnpdevs]);
#endif
scsi_unregister(shpnt);
if(isapnp)
{
- struct pci_dev *pdev = NULL;
+ struct pnp_dev *pdev = NULL;
for(indx = 0; indx <sizeof(bases)/sizeof(bases[0]);indx++)
{
if(bases[indx])
continue;
- pdev = isapnp_find_dev(NULL, ISAPNP_VENDOR('A', 'D', 'P'),
+ pdev = pnp_find_dev(NULL, ISAPNP_VENDOR('A', 'D', 'P'),
ISAPNP_FUNCTION(0x1542), pdev);
if(pdev==NULL)
break;
* Activate the PnP card
*/
- if(pdev->prepare(pdev)<0)
+ if(pnp_device_attach(pdev)<0)
continue;
-
- if(!(pdev->resource[0].flags&IORESOURCE_IO))
+
+ if(pnp_activate_dev(pdev, NULL)<0) {
+ pnp_device_detach(pdev);
continue;
-
- pdev->resource[0].flags|=IORESOURCE_AUTO;
-
- if(pdev->activate(pdev)<0)
+ }
+
+ if(!pnp_port_valid(pdev, 0)) {
+ pnp_device_detach(pdev);
continue;
+ }
- bases[indx] = pdev->resource[0].start;
+ bases[indx] = pnp_port_start(pdev, 0);
/* The card can be queried for its DMA, we have
the DMA set up that is enough */
overrides[0].board = BOARD_DTC3181E;
if (!current_override && isapnp_present()) {
- struct pci_dev *dev = NULL;
+ struct pnp_dev *dev = NULL;
count = 0;
- while ((dev = isapnp_find_dev(NULL, ISAPNP_VENDOR('D', 'T', 'C'), ISAPNP_FUNCTION(0x436e), dev))) {
+ while ((dev = pnp_find_dev(NULL, ISAPNP_VENDOR('D', 'T', 'C'), ISAPNP_FUNCTION(0x436e), dev))) {
if (count >= NO_OVERRIDES)
break;
- if (!dev->active && dev->prepare(dev) < 0) {
- printk(KERN_ERR "dtc436e probe: prepare failed\n");
+ if (pnp_device_attach(dev) < 0) {
+ printk(KERN_ERR "dtc436e probe: attach failed\n");
continue;
}
- if (!(dev->resource[0].flags & IORESOURCE_IO))
- continue;
- if (!dev->active && dev->activate(dev) < 0) {
+ if (pnp_activate_dev(dev, NULL) < 0) {
printk(KERN_ERR "dtc436e probe: activate failed\n");
+ pnp_device_detach(dev);
+ continue;
+ }
+ if (!pnp_port_valid(dev, 0)) {
+ printk(KERN_ERR "dtc436e probe: no valid port\n");
+ pnp_device_detach(dev);
continue;
}
- if (dev->irq_resource[0].flags & IORESOURCE_IRQ)
- overrides[count].irq = dev->irq_resource[0].start;
+ if (pnp_irq_valid(dev, 0))
+ overrides[count].irq = pnp_irq(dev, 0);
else
overrides[count].irq = IRQ_NONE;
- if (dev->dma_resource[0].flags & IORESOURCE_DMA)
- overrides[count].dma = dev->dma_resource[0].start;
+ if (pnp_dma_valid(dev, 0))
+ overrides[count].dma = pnp_dma(dev, 0);
else
overrides[count].dma = DMA_NONE;
- overrides[count].NCR5380_map_name = (NCR5380_map_type) dev->resource[0].start;
+ overrides[count].NCR5380_map_name = (NCR5380_map_type) pnp_port_start(dev, 0);
overrides[count].board = BOARD_DTC3181E;
count++;
}
struct Scsi_Host * shpnt = NULL;
int i;
int count;
- struct pci_dev *idev = NULL;
+ struct pnp_dev *idev = NULL;
#ifdef MODULE
int ints[3];
printk(KERN_INFO "sym53c416.c: %s\n", VERSION_STRING);
for (i=0; id_table[i].vendor != 0; i++) {
- while((idev=isapnp_find_dev(NULL, id_table[i].vendor,
+ while((idev=pnp_find_dev(NULL, id_table[i].vendor,
id_table[i].function, idev))!=NULL)
{
int i[3];
- if(idev->prepare(idev)<0)
+ if(pnp_device_attach(idev)<0)
{
- printk(KERN_WARNING "sym53c416: unable to prepare PnP card.\n");
+ printk(KERN_WARNING "sym53c416: unable to attach PnP device.\n");
continue;
}
- if(idev->activate(idev)<0)
+ if(pnp_activate_dev(idev, NULL)<0)
{
- printk(KERN_WARNING "sym53c416: unable to activate PnP card.\n");
+ printk(KERN_WARNING "sym53c416: unable to activate PnP device.\n");
+ pnp_device_detach(idev);
continue;
}
i[0] = 2;
- i[1] = idev->resource[0].start;
- i[2] = idev->irq_resource[0].start;
+ i[1] = pnp_port_start(idev, 0);
+ i[2] = pnp_irq(idev, 0);
printk(KERN_INFO "sym53c416: ISAPnP card found and configured at 0x%X, IRQ %d.\n",
i[1], i[2]);
kfree(j->read_buffer);
if (j->write_buffer)
kfree(j->write_buffer);
- if (j->dev && j->dev->deactivate)
- j->dev->deactivate(j->dev);
+ if (j->dev)
+ pnp_device_detach(j->dev);
if (ixjdebug & 0x0002)
printk(KERN_INFO "IXJ: Unregistering /dev/phone%d from LTAPI\n", cnt);
phone_unregister_device(&j->p);
{
int probe = 0;
int func = 0x110;
- struct pci_dev *dev = NULL, *old_dev = NULL;
+ struct pnp_dev *dev = NULL, *old_dev = NULL;
while (1) {
do {
int result;
old_dev = dev;
- dev = isapnp_find_dev(NULL, ISAPNP_VENDOR('Q', 'T', 'I'),
+ dev = pnp_find_dev(NULL, ISAPNP_VENDOR('Q', 'T', 'I'),
ISAPNP_FUNCTION(func), old_dev);
- if (!dev)
+ if (!dev || !dev->card)
break;
- result = dev->prepare(dev);
+ result = pnp_device_attach(dev);
if (result < 0) {
- printk("preparing failed %d \n", result);
+ printk("pnp attach failed %d \n", result);
break;
}
+ if (pnp_activate_dev(dev, NULL) < 0) {
+ printk("pnp activate failed (out of resources?)\n");
+ pnp_device_detach(dev);
+ return -ENOMEM;
+ }
- if (!(dev->resource[0].flags & IORESOURCE_IO))
+ if (!pnp_port_valid(dev, 0)) {
+ pnp_device_detach(dev);
return -ENODEV;
-
- dev->resource[0].flags |= IORESOURCE_AUTO;
- if (func != 0x110)
- dev->resource[1].flags |= IORESOURCE_AUTO;
- if (dev->activate(dev) < 0) {
- printk("isapnp configure failed (out of resources?)\n");
- return -ENOMEM;
}
- result = check_region(dev->resource[0].start, 16);
+ result = check_region(pnp_port_start(dev, 0), 16);
if (result) {
- printk(KERN_INFO "ixj: can't get I/O address 0x%lx\n", dev->resource[0].start);
+ printk(KERN_INFO "ixj: can't get I/O address 0x%lx\n", pnp_port_start(dev, 0));
break;
}
request_region(j->DSPbase, 16, "ixj DSP");
if (func != 0x110)
- j->XILINXbase = dev->resource[1].start; /* get real port */
+ j->XILINXbase = pnp_port_start(dev, 1); /* get real port */
switch (func) {
case (0x110):
j->board = *cnt;
probe = ixj_selfprobe(j);
if(!probe) {
- j->serial = dev->bus->serial;
+ j->serial = dev->card->serial;
j->dev = dev;
switch (func) {
case 0x110:
atomic_t DSPWrite;
struct phone_capability caplist[30];
unsigned int caps;
-#if LINUX_VERSION_CODE < 0x020400
struct pnp_dev *dev;
-#else
- struct pci_dev *dev;
-#endif
unsigned int cardtype;
unsigned int rec_codec;
unsigned int cid_rec_codec;
struct pci_dev *pci_dev; /* for pci chipsets */
struct ide_pci_device_s *cds; /* chipset device struct */
+
+ struct pnp_dev *pnp_dev; /* for PnP devices */
#if 0
ide_hwif_ops_t *hwifops;
/* init/main.c */
int isapnp_init(void);
+/* compat */
+struct pnp_card *pnp_find_card(unsigned short vendor,
+ unsigned short device,
+ struct pnp_card *from);
+struct pnp_dev *pnp_find_dev(struct pnp_card *card,
+ unsigned short vendor,
+ unsigned short function,
+ struct pnp_dev *from);
+
#else /* !CONFIG_ISAPNP */
/* lowlevel configuration */
static inline void isapnp_activate(unsigned char device) { ; }
static inline void isapnp_deactivate(unsigned char device) { ; }
+static inline struct pnp_card *pnp_find_card(unsigned short vendor,
+ unsigned short device,
+ struct pnp_card *from) { return NULL; }
+static inline struct pnp_dev *pnp_find_dev(struct pnp_card *card,
+ unsigned short vendor,
+ unsigned short function,
+ struct pnp_dev *from) { return NULL; }
+
#endif /* CONFIG_ISAPNP */
#endif /* __KERNEL__ */
#define DEVICE_COUNT_IRQ 2
#define DEVICE_COUNT_DMA 2
-#define DEVICE_COUNT_RESOURCE 12
+#define DEVICE_COUNT_IO 8
+#define DEVICE_COUNT_MEM 4
#define MAX_DEVICES 8
struct pnp_resource;
struct pnp_card {
char name[80];
+ int status; /* status of the card */
unsigned char number; /* card number */
struct list_head global_list; /* node in global list of cards */
struct list_head protocol_list; /* node in protocol's list of cards */
struct pnp_resources *res; /* possible resource information */
int lock_resources; /* resources are locked */
- struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */
+ struct resource io_resource[DEVICE_COUNT_IO]; /* port regions */
+ struct resource mem_resource[DEVICE_COUNT_MEM]; /* memory regions + expansion ROMs */
struct resource dma_resource[DEVICE_COUNT_DMA];
struct resource irq_resource[DEVICE_COUNT_IRQ];
* Resource Management
*/
+#define pnp_flags_valid(resrc) (((resrc)->flags & IORESOURCE_UNSET) == 0 && \
+ ((resrc)->flags & (IORESOURCE_IO|IORESOURCE_MEM|IORESOURCE_IRQ|IORESOURCE_DMA)) != 0)
+
/* Use these instead of directly reading pnp_dev to get resource information */
-#define pnp_port_start(dev,bar) ((dev)->resource[(bar)].start)
-#define pnp_port_end(dev,bar) ((dev)->resource[(bar)].end)
-#define pnp_port_flags(dev,bar) ((dev)->resource[(bar)].flags)
+#define pnp_port_start(dev,bar) ((dev)->io_resource[(bar)].start)
+#define pnp_port_end(dev,bar) ((dev)->io_resource[(bar)].end)
+#define pnp_port_flags(dev,bar) ((dev)->io_resource[(bar)].flags)
+#define pnp_port_valid(dev,bar) pnp_flags_valid(&(dev)->io_resource[(bar)])
#define pnp_port_len(dev,bar) \
((pnp_port_start((dev),(bar)) == 0 && \
pnp_port_end((dev),(bar)) == \
(pnp_port_end((dev),(bar)) - \
pnp_port_start((dev),(bar)) + 1))
-#define pnp_mem_start(dev,bar) ((dev)->resource[(bar+8)].start)
-#define pnp_mem_end(dev,bar) ((dev)->resource[(bar+8)].end)
-#define pnp_mem_flags(dev,bar) ((dev)->resource[(bar+8)].flags)
+#define pnp_mem_start(dev,bar) ((dev)->mem_resource[(bar)].start)
+#define pnp_mem_end(dev,bar) ((dev)->mem_resource[(bar)].end)
+#define pnp_mem_flags(dev,bar) ((dev)->mem_resource[(bar)].flags)
+#define pnp_mem_valid(dev,bar) pnp_flags_valid(&(dev)->mem_resource[(bar)])
#define pnp_mem_len(dev,bar) \
((pnp_mem_start((dev),(bar)) == 0 && \
pnp_mem_end((dev),(bar)) == \
(pnp_mem_end((dev),(bar)) - \
pnp_mem_start((dev),(bar)) + 1))
-#define pnp_irq(dev,bar) ((dev)->irq_resource[(bar)].start)
-#define pnp_irq_flags(dev,bar) ((dev)->irq_resource[(bar)].flags)
+#define pnp_irq(dev,bar) ((dev)->irq_resource[(bar)].start)
+#define pnp_irq_flags(dev,bar) ((dev)->irq_resource[(bar)].flags)
+#define pnp_irq_valid(dev,bar) pnp_flags_valid(&(dev)->irq_resource[(bar)])
-#define pnp_dma(dev,bar) ((dev)->dma_resource[(bar)].start)
-#define pnp_dma_flags(dev,bar) ((dev)->dma_resource[(bar)].flags)
+#define pnp_dma(dev,bar) ((dev)->dma_resource[(bar)].start)
+#define pnp_dma_flags(dev,bar) ((dev)->dma_resource[(bar)].flags)
+#define pnp_dma_valid(dev,bar) pnp_flags_valid(&(dev)->dma_resource[(bar)])
#define PNP_PORT_FLAG_16BITADDR (1<<0)
#define PNP_PORT_FLAG_FIXED (1<<1)
};
struct pnp_res_cfg {
- struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */
+ struct resource io_resource[DEVICE_COUNT_IO]; /* I/O ports */
+ struct resource mem_resource[DEVICE_COUNT_MEM]; /* memory regions + expansion ROMs */
struct resource dma_resource[DEVICE_COUNT_DMA];
struct resource irq_resource[DEVICE_COUNT_IRQ];
};
int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev);
int pnp_register_driver(struct pnp_driver *drv);
void pnp_unregister_driver(struct pnp_driver *drv);
+int pnp_device_attach(struct pnp_dev *pnp_dev);
+void pnp_device_detach(struct pnp_dev *pnp_dev);
#else
static inline int pnp_activate_dev(struct pnp_dev *dev, struct pnp_res_cfg *template) { return -ENODEV; }
static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; }
static inline int pnp_raw_set_dev(struct pnp_dev *dev, int depnum, struct pnp_res_cfg *template) { return -ENODEV; }
+static inline void pnp_resource_change(struct resource *resource, unsigned long start, unsigned long size) { ; }
static inline int compare_pnp_id(struct list_head * id_list, const char * id) { return -ENODEV; }
static inline int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev) { return -ENODEV; }
static inline int pnp_register_driver(struct pnp_driver *drv) { return -ENODEV; }
static inline void pnp_unregister_driver(struct pnp_driver *drv) { ; }
+static inline int pnp_device_attach(struct pnp_dev *pnp_dev) { return -ENODEV; }
+static inline void pnp_device_detach(struct pnp_dev *pnp_dev) { ; }
+
#endif /* CONFIG_PNP */
void pnpc_unregister_driver(struct pnpc_driver *drv);
int pnpc_add_id(struct pnp_id *id, struct pnp_card *card);
extern struct list_head pnp_cards;
+int pnpc_attach(struct pnp_card *card);
+void pnpc_detach(struct pnp_card *card);
#else
static inline int pnpc_register_driver(struct pnpc_driver *drv) { return -ENODEV; }
static inline void pnpc_unregister_driver(struct pnpc_driver *drv) { ; }
static inline int pnpc_add_id(struct pnp_id *id, struct pnp_card *card) { return -ENODEV; }
+static inline int pnpc_attach(struct pnp_card *card) { return -ENODEV; }
+static inline void pnpc_detach(struct pnp_card *card) { ; }
#endif /* CONFIG_PNP_CARD */
-#if defined(CONFIG_ISAPNP)
-
-/* compat */
-struct pnp_card *pnp_find_card(unsigned short vendor,
- unsigned short device,
- struct pnp_card *from);
-struct pnp_dev *pnp_find_dev(struct pnp_card *card,
- unsigned short vendor,
- unsigned short function,
- struct pnp_dev *from);
-
-#else
-
-static inline struct pnp_card *pnp_find_card(unsigned short vendor,
- unsigned short device,
- struct pnp_card *from) { return NULL; }
-static inline struct pnp_dev *pnp_find_dev(struct pnp_card *card,
- unsigned short vendor,
- unsigned short function,
- struct pnp_dev *from) { return NULL; }
-
-#endif /* CONFIG_ISAPNP */
-
-
#ifdef DEBUG
#define pnp_dbg(format, arg...) printk(KERN_DEBUG "pnp: " format "\n" , ## arg)
#else