mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-24 09:50:04 +00:00
[PATCH] mxser: PCI refcounts
Switch to pci ref counts for mxser when handling PCI devices. Use pci_get_device and drop the reference when we finish and unload. Signed-off-by: Alan Cox <alan@redhat.com> Cc: Greg KH <greg@kroah.com> Cc: <jirislaby@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
ae25f8ecdf
commit
1187ece3db
1 changed files with 6 additions and 2 deletions
|
@ -515,6 +515,7 @@ static void __exit mxser_module_exit(void)
|
||||||
if (pdev != NULL) { /* PCI */
|
if (pdev != NULL) { /* PCI */
|
||||||
release_region(pci_resource_start(pdev, 2), pci_resource_len(pdev, 2));
|
release_region(pci_resource_start(pdev, 2), pci_resource_len(pdev, 2));
|
||||||
release_region(pci_resource_start(pdev, 3), pci_resource_len(pdev, 3));
|
release_region(pci_resource_start(pdev, 3), pci_resource_len(pdev, 3));
|
||||||
|
pci_dev_put(pdev);
|
||||||
} else {
|
} else {
|
||||||
release_region(mxsercfg[i].ioaddr[0], 8 * mxsercfg[i].ports);
|
release_region(mxsercfg[i].ioaddr[0], 8 * mxsercfg[i].ports);
|
||||||
release_region(mxsercfg[i].vector, 1);
|
release_region(mxsercfg[i].vector, 1);
|
||||||
|
@ -839,7 +840,7 @@ static int mxser_init(void)
|
||||||
index = 0;
|
index = 0;
|
||||||
b = 0;
|
b = 0;
|
||||||
while (b < n) {
|
while (b < n) {
|
||||||
pdev = pci_find_device(mxser_pcibrds[b].vendor,
|
pdev = pci_get_device(mxser_pcibrds[b].vendor,
|
||||||
mxser_pcibrds[b].device, pdev);
|
mxser_pcibrds[b].device, pdev);
|
||||||
if (pdev == NULL) {
|
if (pdev == NULL) {
|
||||||
b++;
|
b++;
|
||||||
|
@ -893,6 +894,9 @@ static int mxser_init(void)
|
||||||
if (mxser_initbrd(m, &hwconf) < 0)
|
if (mxser_initbrd(m, &hwconf) < 0)
|
||||||
continue;
|
continue;
|
||||||
m++;
|
m++;
|
||||||
|
/* Keep an extra reference if we succeeded. It will
|
||||||
|
be returned at unload time */
|
||||||
|
pci_dev_get(pdev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue