Commit dd62ebc4 authored by Jaroslav Kysela's avatar Jaroslav Kysela

PnP update

  - ISA PnP - removed isapnp_card_protocol reference
  - NE1000/2000 - fixed exit sequence and bugs in PnP code
  - aironet4500 - fixed exit sequence
  - ISDN - hisax_fcpcipnp - fixed compilation
  - OSS sound drivers - ad1848, cs4232 - updated to latest PnP code
parent 291b901b
...@@ -55,11 +55,11 @@ static struct pci_device_id fcpci_ids[] __devinitdata = { ...@@ -55,11 +55,11 @@ static struct pci_device_id fcpci_ids[] __devinitdata = {
}; };
MODULE_DEVICE_TABLE(pci, fcpci_ids); 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", { .id = "AVM0900", .driver_data = (unsigned long) "Fritz!Card PnP",
.devs = { { "AVM0900" } } } .devs = { { "AVM0900" } } }
}; };
MODULE_DEVICE_TABLE(pnpc, fcpnp_ids); MODULE_DEVICE_TABLE(pnp_card, fcpnp_ids);
static int protocol = 2; /* EURO-ISDN Default */ static int protocol = 2; /* EURO-ISDN Default */
MODULE_PARM(protocol, "i"); MODULE_PARM(protocol, "i");
...@@ -907,7 +907,7 @@ static struct pci_driver fcpci_driver = { ...@@ -907,7 +907,7 @@ static struct pci_driver fcpci_driver = {
#ifdef __ISAPNP__ #ifdef __ISAPNP__
static int __devinit fcpnp_probe(struct pnp_card *card, 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 fritz_adapter *adapter;
struct pnp_dev *pnp_dev; struct pnp_dev *pnp_dev;
......
...@@ -455,10 +455,7 @@ static void awc_pnp_release(void) { ...@@ -455,10 +455,7 @@ static void awc_pnp_release(void) {
if (awc_proc_unset_fun) if (awc_proc_unset_fun)
awc_proc_unset_fun(i); awc_proc_unset_fun(i);
if (isapnp_cfg_begin(logdev->PNP_BUS->PNP_BUS_NUMBER, logdev->PNP_DEV_NUMBER)<0) pnp_device_detach(logdev);
printk("isapnp cfg failed at release \n");
isapnp_deactivate(logdev->PNP_DEV_NUMBER);
isapnp_cfg_end();
release_region(aironet4500_devices[i]->base_addr, AIRONET4X00_IO_SIZE); release_region(aironet4500_devices[i]->base_addr, AIRONET4X00_IO_SIZE);
// release_region(isa_cisaddr, AIRONET4X00_CIS_SIZE, "aironet4x00 cis"); // release_region(isa_cisaddr, AIRONET4X00_CIS_SIZE, "aironet4x00 cis");
......
...@@ -206,12 +206,14 @@ static int __init ne_probe_isapnp(struct net_device *dev) ...@@ -206,12 +206,14 @@ static int __init ne_probe_isapnp(struct net_device *dev)
if (pnp_device_attach(idev) < 0) if (pnp_device_attach(idev) < 0)
continue; continue;
if (pnp_activate_dev(idev, NULL) < 0) { if (pnp_activate_dev(idev, NULL) < 0) {
__again:
pnp_device_detach(idev); pnp_device_detach(idev);
continue;
} }
/* if no io and irq, search for next */ /* if no io and irq, search for next */
if (!pnp_port_valid(idev, 0) || !pnp_irq_valid(idev, 0)) if (!pnp_port_valid(idev, 0) || !pnp_irq_valid(idev, 0)) {
goto __again; pnp_device_detach(idev);
continue;
}
/* found it */ /* found it */
dev->base_addr = pnp_port_start(idev, 0); dev->base_addr = pnp_port_start(idev, 0);
dev->irq = pnp_irq(idev, 0); dev->irq = pnp_irq(idev, 0);
...@@ -785,9 +787,9 @@ void cleanup_module(void) ...@@ -785,9 +787,9 @@ void cleanup_module(void)
struct net_device *dev = &dev_ne[this_dev]; struct net_device *dev = &dev_ne[this_dev];
if (dev->priv != NULL) { if (dev->priv != NULL) {
void *priv = dev->priv; 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) if (idev)
idev->deactivate(idev); pnp_device_detach(idev);
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
release_region(dev->base_addr, NE_IO_EXTENT); release_region(dev->base_addr, NE_IO_EXTENT);
unregister_netdev(dev); unregister_netdev(dev);
......
...@@ -550,9 +550,9 @@ cleanup_module(void) ...@@ -550,9 +550,9 @@ cleanup_module(void)
int ioaddr = dev->base_addr - ULTRA_NIC_OFFSET; int ioaddr = dev->base_addr - ULTRA_NIC_OFFSET;
#ifdef __ISAPNP__ #ifdef __ISAPNP__
struct pci_dev *idev = (struct pci_dev *)ei_status.priv; struct pnp_dev *idev = (struct pnp_dev *)ei_status.priv;
if (idev) if (idev)
idev->deactivate(idev); pnp_device_detach(idev);
#endif #endif
unregister_netdev(dev); unregister_netdev(dev);
......
...@@ -22,9 +22,9 @@ ...@@ -22,9 +22,9 @@
LIST_HEAD(pnp_cards); 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){ while (*drv_id->id){
if (compare_pnp_id(card->id,drv_id->id)) if (compare_pnp_id(card->id,drv_id->id))
return drv_id; return drv_id;
...@@ -216,19 +216,16 @@ struct pnp_dev * pnp_request_card_device(struct pnp_card *card, const char *id, ...@@ -216,19 +216,16 @@ struct pnp_dev * pnp_request_card_device(struct pnp_card *card, const char *id,
return NULL; return NULL;
found: found:
spin_lock(&pnp_lock); if (pnp_device_attach(dev) < 0)
if(dev->status != PNP_READY){
spin_unlock(&pnp_lock);
return NULL; return NULL;
}
dev->status = PNP_ATTACHED;
spin_unlock(&pnp_lock);
cdrv = to_pnpc_driver(card->dev.driver); cdrv = to_pnpc_driver(card->dev.driver);
if (dev->active == 0) { if (dev->active == 0) {
if (!(cdrv->flags & PNPC_DRIVER_DO_NOT_ACTIVATE)) { 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; return NULL;
} }
}
} else { } else {
if ((cdrv->flags & PNPC_DRIVER_DO_NOT_ACTIVATE)) if ((cdrv->flags & PNPC_DRIVER_DO_NOT_ACTIVATE))
pnp_disable_dev(dev); pnp_disable_dev(dev);
...@@ -250,10 +247,8 @@ void pnp_release_card_device(struct pnp_dev *dev) ...@@ -250,10 +247,8 @@ void pnp_release_card_device(struct pnp_dev *dev)
{ {
spin_lock(&pnp_lock); spin_lock(&pnp_lock);
list_del(&dev->rdev_list); list_del(&dev->rdev_list);
if (dev->status == PNP_ATTACHED)
dev->status = PNP_READY;
spin_unlock(&pnp_lock); spin_unlock(&pnp_lock);
pnp_disable_dev(dev); pnp_device_detach(dev);
} }
static void pnpc_recover_devices(struct pnp_card *card) static void pnpc_recover_devices(struct pnp_card *card)
...@@ -291,7 +286,7 @@ static int pnpc_card_probe(struct device *dev) ...@@ -291,7 +286,7 @@ static int pnpc_card_probe(struct device *dev)
int error = 0; int error = 0;
struct pnpc_driver *drv = to_pnpc_driver(dev->driver); struct pnpc_driver *drv = to_pnpc_driver(dev->driver);
struct pnp_card *card = to_pnp_card(dev); 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); pnp_dbg("pnp: match found with the PnP card '%s' and the driver '%s'", dev->bus_id,drv->name);
......
...@@ -102,7 +102,6 @@ static int isapnp_detected; ...@@ -102,7 +102,6 @@ static int isapnp_detected;
/* some prototypes */ /* some prototypes */
static int isapnp_config_prepare(struct pnp_dev *dev); static int isapnp_config_prepare(struct pnp_dev *dev);
extern struct pnp_protocol isapnp_card_protocol;
extern struct pnp_protocol isapnp_protocol; extern struct pnp_protocol isapnp_protocol;
static inline void write_data(unsigned char x) static inline void write_data(unsigned char x)
...@@ -1125,7 +1124,7 @@ int __init isapnp_init(void) ...@@ -1125,7 +1124,7 @@ int __init isapnp_init(void)
isapnp_build_device_list(); isapnp_build_device_list();
cards = 0; cards = 0;
protocol_for_each_card(&isapnp_card_protocol,card) { protocol_for_each_card(&isapnp_protocol,card) {
cards++; cards++;
if (isapnp_verbose) { if (isapnp_verbose) {
printk(KERN_INFO "isapnp: Card '%s'\n", card->name[0]?card->name:"Unknown"); printk(KERN_INFO "isapnp: Card '%s'\n", card->name[0]?card->name:"Unknown");
......
...@@ -189,7 +189,7 @@ struct pnp_device_id { ...@@ -189,7 +189,7 @@ struct pnp_device_id {
unsigned long driver_data; /* data private to the driver */ unsigned long driver_data; /* data private to the driver */
}; };
struct pnp_card_id { struct pnp_card_device_id {
char id[7]; char id[7];
unsigned long driver_data; /* data private to the driver */ unsigned long driver_data; /* data private to the driver */
struct { struct {
...@@ -216,9 +216,9 @@ struct pnp_driver { ...@@ -216,9 +216,9 @@ struct pnp_driver {
struct pnpc_driver { struct pnpc_driver {
struct list_head node; struct list_head node;
char *name; char *name;
const struct pnp_card_id *id_table; const struct pnp_card_device_id *id_table;
unsigned int flags; 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); void (*remove) (struct pnp_card *card);
struct device_driver driver; struct device_driver driver;
}; };
......
...@@ -2983,14 +2983,14 @@ static struct pnp_dev *activate_dev(char *devname, char *resname, struct pnp_dev ...@@ -2983,14 +2983,14 @@ static struct pnp_dev *activate_dev(char *devname, char *resname, struct pnp_dev
{ {
int err; int err;
/* Device already active? Let's use it */ err = pnp_device_attach(dev);
if(dev->active) if (err < 0)
return(dev); return(NULL);
if((err = pnp_activate_dev(dev,NULL)) < 0) { if((err = pnp_activate_dev(dev,NULL)) < 0) {
printk(KERN_ERR "ad1848: %s %s config failed (out of resources?)[%d]\n", devname, resname, err); 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); return(NULL);
} }
...@@ -3006,12 +3006,11 @@ static struct pnp_dev *ad1848_init_generic(struct pnp_card *bus, struct address_ ...@@ -3006,12 +3006,11 @@ static struct pnp_dev *ad1848_init_generic(struct pnp_card *bus, struct address_
{ {
if((ad1848_dev = activate_dev(ad1848_isapnp_list[slot].name, "ad1848", ad1848_dev))) if((ad1848_dev = activate_dev(ad1848_isapnp_list[slot].name, "ad1848", ad1848_dev)))
{ {
get_device(&ad1848_dev->dev); hw_config->io_base = pnp_port_start(ad1848_dev, ad1848_isapnp_list[slot].mss_io);
hw_config->io_base = ad1848_dev->resource[ad1848_isapnp_list[slot].mss_io].start; hw_config->irq = pnp_irq(ad1848_dev, ad1848_isapnp_list[slot].irq);
hw_config->irq = ad1848_dev->irq_resource[ad1848_isapnp_list[slot].irq].start; hw_config->dma = pnp_dma(ad1848_dev, ad1848_isapnp_list[slot].dma);
hw_config->dma = ad1848_dev->dma_resource[ad1848_isapnp_list[slot].dma].start;
if(ad1848_isapnp_list[slot].dma2 != -1) 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 else
hw_config->dma2 = -1; hw_config->dma2 = -1;
hw_config->card_subtype = ad1848_isapnp_list[slot].type; hw_config->card_subtype = ad1848_isapnp_list[slot].type;
...@@ -3032,7 +3031,7 @@ static int __init ad1848_isapnp_init(struct address_info *hw_config, struct pnp_ ...@@ -3032,7 +3031,7 @@ static int __init ad1848_isapnp_init(struct address_info *hw_config, struct pnp_
if(ad1848_init_generic(bus, hw_config, slot)) { if(ad1848_init_generic(bus, hw_config, slot)) {
/* We got it. */ /* 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, busname,
hw_config->io_base, hw_config->irq, hw_config->dma, hw_config->io_base, hw_config->irq, hw_config->dma,
hw_config->dma2); hw_config->dma2);
...@@ -3122,8 +3121,7 @@ static void __exit cleanup_ad1848(void) ...@@ -3122,8 +3121,7 @@ static void __exit cleanup_ad1848(void)
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
if(ad1848_dev){ if(ad1848_dev){
if(audio_activated) if(audio_activated)
pnp_disable_dev(ad1848_dev); pnp_device_detach(ad1848_dev);
put_device(&ad1848_dev->dev);
} }
#endif #endif
} }
......
...@@ -357,7 +357,7 @@ MODULE_PARM_DESC(isapnp,"Enable ISAPnP probing (default 1)"); ...@@ -357,7 +357,7 @@ MODULE_PARM_DESC(isapnp,"Enable ISAPnP probing (default 1)");
/* All cs4232 based cards have the main ad1848 card either as CSC0000 or /* All cs4232 based cards have the main ad1848 card either as CSC0000 or
* CSC0100. */ * CSC0100. */
static const struct pnp_id cs4232_pnp_table[] = { static const struct pnp_device_id cs4232_pnp_table[] = {
{ .id = "CSC0100", .driver_data = 0 }, { .id = "CSC0100", .driver_data = 0 },
{ .id = "CSC0000", .driver_data = 0 }, { .id = "CSC0000", .driver_data = 0 },
/* Guillemot Turtlebeach something appears to be cs4232 compatible /* Guillemot Turtlebeach something appears to be cs4232 compatible
...@@ -366,9 +366,9 @@ static const struct pnp_id cs4232_pnp_table[] = { ...@@ -366,9 +366,9 @@ static const struct pnp_id cs4232_pnp_table[] = {
{ .id = ""} { .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; struct address_info *isapnpcfg;
...@@ -376,30 +376,31 @@ static int cs4232_pnp_probe(struct pnp_dev *dev, const struct pnp_id *card_id, c ...@@ -376,30 +376,31 @@ static int cs4232_pnp_probe(struct pnp_dev *dev, const struct pnp_id *card_id, c
if (!isapnpcfg) if (!isapnpcfg)
return -ENOMEM; return -ENOMEM;
isapnpcfg->irq = dev->irq_resource[0].start; isapnpcfg->irq = pnp_irq(dev, 0);
isapnpcfg->dma = dev->dma_resource[0].start; isapnpcfg->dma = pnp_dma(dev, 0);
isapnpcfg->dma2 = dev->dma_resource[1].start; isapnpcfg->dma2 = pnp_dma(dev, 1);
isapnpcfg->io_base = dev->resource[0].start; isapnpcfg->io_base = pnp_port_start(dev, 0);
if (probe_cs4232(isapnpcfg,TRUE) == 0) { if (probe_cs4232(isapnpcfg,TRUE) == 0) {
printk(KERN_ERR "cs4232: ISA PnP card found, but not detected?\n"); printk(KERN_ERR "cs4232: ISA PnP card found, but not detected?\n");
kfree(isapnpcfg); kfree(isapnpcfg);
return -ENODEV; return -ENODEV;
} }
attach_cs4232(isapnpcfg); attach_cs4232(isapnpcfg);
pci_set_drvdata(dev,isapnpcfg); pnp_set_drvdata(dev,isapnpcfg);
return 0; return 0;
} }
static void cs4232_pnp_remove(struct pnp_dev *dev) static void cs4232_pnp_remove(struct pnp_dev *dev)
{ {
struct address_info *cfg = (struct address_info*) dev->driver_data; struct address_info *cfg = pnp_get_drvdata(dev);
if (cfg) if (cfg) {
unload_cs4232(cfg); unload_cs4232(cfg);
kfree(cfg);
}
} }
static struct pnp_driver cs4232_driver = { static struct pnp_driver cs4232_driver = {
.name = "cs4232", .name = "cs4232",
.card_id_table = NULL,
.id_table = cs4232_pnp_table, .id_table = cs4232_pnp_table,
.probe = cs4232_pnp_probe, .probe = cs4232_pnp_probe,
.remove = cs4232_pnp_remove, .remove = cs4232_pnp_remove,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment