};
MODULE_DEVICE_TABLE(pci, fcpci_ids);
-static const struct pnp_card_id fcpnp_ids[] __devinitdata = {
+static const struct pnp_card_device_id fcpnp_ids[] __devinitdata = {
{ .id = "AVM0900", .driver_data = (unsigned long) "Fritz!Card PnP",
.devs = { { "AVM0900" } } }
};
-MODULE_DEVICE_TABLE(pnpc, fcpnp_ids);
+MODULE_DEVICE_TABLE(pnp_card, fcpnp_ids);
static int protocol = 2; /* EURO-ISDN Default */
MODULE_PARM(protocol, "i");
#ifdef __ISAPNP__
static int __devinit fcpnp_probe(struct pnp_card *card,
- const struct pnp_card_id *card_id)
+ const struct pnp_card_device_id *card_id)
{
struct fritz_adapter *adapter;
struct pnp_dev *pnp_dev;
if (awc_proc_unset_fun)
awc_proc_unset_fun(i);
- 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_device_detach(logdev);
release_region(aironet4500_devices[i]->base_addr, AIRONET4X00_IO_SIZE);
// release_region(isa_cisaddr, AIRONET4X00_CIS_SIZE, "aironet4x00 cis");
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;
+ if (!pnp_port_valid(idev, 0) || !pnp_irq_valid(idev, 0)) {
+ pnp_device_detach(idev);
+ continue;
+ }
/* found it */
dev->base_addr = pnp_port_start(idev, 0);
dev->irq = pnp_irq(idev, 0);
struct net_device *dev = &dev_ne[this_dev];
if (dev->priv != NULL) {
void *priv = dev->priv;
- struct pci_dev *idev = (struct pci_dev *)ei_status.priv;
+ struct pnp_dev *idev = (struct pnp_dev *)ei_status.priv;
if (idev)
- idev->deactivate(idev);
+ pnp_device_detach(idev);
free_irq(dev->irq, dev);
release_region(dev->base_addr, NE_IO_EXTENT);
unregister_netdev(dev);
int ioaddr = dev->base_addr - ULTRA_NIC_OFFSET;
#ifdef __ISAPNP__
- struct pci_dev *idev = (struct pci_dev *)ei_status.priv;
+ struct pnp_dev *idev = (struct pnp_dev *)ei_status.priv;
if (idev)
- idev->deactivate(idev);
+ pnp_device_detach(idev);
#endif
unregister_netdev(dev);
LIST_HEAD(pnp_cards);
-static const struct pnp_card_id * match_card(struct pnpc_driver *drv, struct pnp_card *card)
+static const struct pnp_card_device_id * match_card(struct pnpc_driver *drv, struct pnp_card *card)
{
- const struct pnp_card_id *drv_id = drv->id_table;
+ const struct pnp_card_device_id *drv_id = drv->id_table;
while (*drv_id->id){
if (compare_pnp_id(card->id,drv_id->id))
return drv_id;
return NULL;
found:
- spin_lock(&pnp_lock);
- if(dev->status != PNP_READY){
- spin_unlock(&pnp_lock);
+ if (pnp_device_attach(dev) < 0)
return NULL;
- }
- dev->status = PNP_ATTACHED;
- spin_unlock(&pnp_lock);
cdrv = to_pnpc_driver(card->dev.driver);
if (dev->active == 0) {
if (!(cdrv->flags & PNPC_DRIVER_DO_NOT_ACTIVATE)) {
- if(pnp_activate_dev(dev,NULL)<0)
+ if(pnp_activate_dev(dev,NULL)<0) {
+ pnp_device_detach(dev);
return NULL;
+ }
}
} else {
if ((cdrv->flags & PNPC_DRIVER_DO_NOT_ACTIVATE))
{
spin_lock(&pnp_lock);
list_del(&dev->rdev_list);
- if (dev->status == PNP_ATTACHED)
- dev->status = PNP_READY;
spin_unlock(&pnp_lock);
- pnp_disable_dev(dev);
+ pnp_device_detach(dev);
}
static void pnpc_recover_devices(struct pnp_card *card)
int error = 0;
struct pnpc_driver *drv = to_pnpc_driver(dev->driver);
struct pnp_card *card = to_pnp_card(dev);
- const struct pnp_card_id *card_id = NULL;
+ const struct pnp_card_device_id *card_id = NULL;
pnp_dbg("pnp: match found with the PnP card '%s' and the driver '%s'", dev->bus_id,drv->name);
/* some prototypes */
static int isapnp_config_prepare(struct pnp_dev *dev);
-extern struct pnp_protocol isapnp_card_protocol;
extern struct pnp_protocol isapnp_protocol;
static inline void write_data(unsigned char x)
isapnp_build_device_list();
cards = 0;
- protocol_for_each_card(&isapnp_card_protocol,card) {
+ protocol_for_each_card(&isapnp_protocol,card) {
cards++;
if (isapnp_verbose) {
printk(KERN_INFO "isapnp: Card '%s'\n", card->name[0]?card->name:"Unknown");
unsigned long driver_data; /* data private to the driver */
};
-struct pnp_card_id {
+struct pnp_card_device_id {
char id[7];
unsigned long driver_data; /* data private to the driver */
struct {
struct pnpc_driver {
struct list_head node;
char *name;
- const struct pnp_card_id *id_table;
+ const struct pnp_card_device_id *id_table;
unsigned int flags;
- int (*probe) (struct pnp_card *card, const struct pnp_card_id *card_id);
+ int (*probe) (struct pnp_card *card, const struct pnp_card_device_id *card_id);
void (*remove) (struct pnp_card *card);
struct device_driver driver;
};
{
int err;
- /* Device already active? Let's use it */
- if(dev->active)
- return(dev);
+ err = pnp_device_attach(dev);
+ if (err < 0)
+ return(NULL);
if((err = pnp_activate_dev(dev,NULL)) < 0) {
printk(KERN_ERR "ad1848: %s %s config failed (out of resources?)[%d]\n", devname, resname, err);
- pnp_disable_dev(dev);
+ pnp_device_detach(dev);
return(NULL);
}
{
if((ad1848_dev = activate_dev(ad1848_isapnp_list[slot].name, "ad1848", ad1848_dev)))
{
- get_device(&ad1848_dev->dev);
- hw_config->io_base = ad1848_dev->resource[ad1848_isapnp_list[slot].mss_io].start;
- hw_config->irq = ad1848_dev->irq_resource[ad1848_isapnp_list[slot].irq].start;
- hw_config->dma = ad1848_dev->dma_resource[ad1848_isapnp_list[slot].dma].start;
+ hw_config->io_base = pnp_port_start(ad1848_dev, ad1848_isapnp_list[slot].mss_io);
+ hw_config->irq = pnp_irq(ad1848_dev, ad1848_isapnp_list[slot].irq);
+ hw_config->dma = pnp_dma(ad1848_dev, ad1848_isapnp_list[slot].dma);
if(ad1848_isapnp_list[slot].dma2 != -1)
- hw_config->dma2 = ad1848_dev->dma_resource[ad1848_isapnp_list[slot].dma2].start;
+ hw_config->dma2 = pnp_dma(ad1848_dev, ad1848_isapnp_list[slot].dma2);
else
hw_config->dma2 = -1;
hw_config->card_subtype = ad1848_isapnp_list[slot].type;
if(ad1848_init_generic(bus, hw_config, slot)) {
/* We got it. */
- printk(KERN_NOTICE "ad1848: ISAPnP reports '%s' at i/o %#x, irq %d, dma %d, %d\n",
+ printk(KERN_NOTICE "ad1848: PnP reports '%s' at i/o %#x, irq %d, dma %d, %d\n",
busname,
hw_config->io_base, hw_config->irq, hw_config->dma,
hw_config->dma2);
#ifdef CONFIG_PNP
if(ad1848_dev){
if(audio_activated)
- pnp_disable_dev(ad1848_dev);
- put_device(&ad1848_dev->dev);
+ pnp_device_detach(ad1848_dev);
}
#endif
}
/* All cs4232 based cards have the main ad1848 card either as CSC0000 or
* CSC0100. */
-static const struct pnp_id cs4232_pnp_table[] = {
+static const struct pnp_device_id cs4232_pnp_table[] = {
{ .id = "CSC0100", .driver_data = 0 },
{ .id = "CSC0000", .driver_data = 0 },
/* Guillemot Turtlebeach something appears to be cs4232 compatible
{ .id = ""}
};
-/*MODULE_DEVICE_TABLE(isapnp, isapnp_cs4232_list);*/
+MODULE_DEVICE_TABLE(pnp, cs4232_pnp_table);
-static int cs4232_pnp_probe(struct pnp_dev *dev, const struct pnp_id *card_id, const struct pnp_id *dev_id)
+static int cs4232_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
{
struct address_info *isapnpcfg;
if (!isapnpcfg)
return -ENOMEM;
- isapnpcfg->irq = dev->irq_resource[0].start;
- isapnpcfg->dma = dev->dma_resource[0].start;
- isapnpcfg->dma2 = dev->dma_resource[1].start;
- isapnpcfg->io_base = dev->resource[0].start;
+ isapnpcfg->irq = pnp_irq(dev, 0);
+ isapnpcfg->dma = pnp_dma(dev, 0);
+ isapnpcfg->dma2 = pnp_dma(dev, 1);
+ isapnpcfg->io_base = pnp_port_start(dev, 0);
if (probe_cs4232(isapnpcfg,TRUE) == 0) {
printk(KERN_ERR "cs4232: ISA PnP card found, but not detected?\n");
kfree(isapnpcfg);
return -ENODEV;
}
attach_cs4232(isapnpcfg);
- pci_set_drvdata(dev,isapnpcfg);
+ pnp_set_drvdata(dev,isapnpcfg);
return 0;
}
static void cs4232_pnp_remove(struct pnp_dev *dev)
{
- struct address_info *cfg = (struct address_info*) dev->driver_data;
- if (cfg)
+ struct address_info *cfg = pnp_get_drvdata(dev);
+ if (cfg) {
unload_cs4232(cfg);
+ kfree(cfg);
+ }
}
static struct pnp_driver cs4232_driver = {
.name = "cs4232",
- .card_id_table = NULL,
.id_table = cs4232_pnp_table,
.probe = cs4232_pnp_probe,
.remove = cs4232_pnp_remove,