Fix for PCI crash on unload for 2.2.x PCI systems.

This commit is contained in:
solomon 2002-09-26 12:45:52 +00:00
parent 6ac7a23951
commit fc3dad7b14
3 changed files with 34 additions and 2 deletions

View File

@ -41,6 +41,8 @@
* Intersil Corporation as part of PRISM(R) chipset product development.
*
* --------------------------------------------------------------------
- Finally fix the 'crash on unload' problem for 2.2.x kernels with PCI.
Turns out the kcompat24 code wasn't quite complete. (Matthew Rush)
- Cleaned up our usage of __FUNCTION__ to make gcc 3.x happy.
- Fix a typo in the prism2 makefile.
0.1.15

1
THANKS
View File

@ -92,6 +92,7 @@ Derek Atkins <warlord@mit.edu>
Michael Beattie <mjb@debian.org>
Joey Hess <joey@kitenet.net>
Clay Jones <cjones1@email.com>
Matthew Rush <matthew@42.co.nz>
[Many, many more. If I've overlooked you and you want to be listed here,
send me e-mail and I'll fix it. I _know_ a bunch of linux-wlan contributors

View File

@ -247,6 +247,7 @@ static struct pci_driver_mapping drvmap [PCI_MAX_MAPPINGS] = { { NULL, } , };
static int pci_register_driver(struct pci_driver *drv);
static void pci_unregister_driver(struct pci_driver *drv);
static int pci_populate_drvmap (struct pci_dev *dev, struct pci_driver *drv);
static void *pci_get_drvdata (struct pci_dev *dev);
static void pci_set_drvdata (struct pci_dev *dev, void *driver_data);
@ -705,14 +706,41 @@ static int pci_register_driver(struct pci_driver *drv)
/* Collect the pci_device structure */
pdev = pci_find_slot(pci_bus, pci_device_fn);
/* Call the driver probe function */
(*(drv->probe))(pdev, &(id_tbl[idx]));
/* Set the driver for this device in the drvmap */
if (pci_populate_drvmap(pdev, drv) == 0) {
/* Call the driver probe function */
(*(drv->probe))(pdev, &(id_tbl[idx]));
}
}
}
DBFEXIT;
return nfound;
}
static int pci_populate_drvmap (struct pci_dev *dev, struct pci_driver *drv)
{
int i;
int vacant = -1;
for (i = 0; i < PCI_MAX_MAPPINGS; i++){
if (drvmap[i].dev == dev) {
drvmap[i].drv = drv;
return 0;
} else if(vacant < 0 && drvmap[i].dev == NULL) {
vacant = i;
}
}
if(vacant >= 0){
drvmap[vacant].dev = dev;
drvmap[vacant].drv = drv;
return 0;
} else {
return -1;
}
}
static void * pci_get_drvdata (struct pci_dev *dev)
{
int i;
@ -749,6 +777,7 @@ static void pci_unregister_driver(struct pci_driver *drv)
if (drv->remove)
drv->remove(dev);
drvmap[i].dev = NULL;
drvmap[i].drv = NULL;
}
}