You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
[PATCH] Char: correct pci_get_device changes
Commits881a8c120aandefe1ec2783corrects pci device matching in only one way; it no longer oopses/crashes, despite hotplug is not solved in these changes. Whenever pci_find_device -> pci_get_device change is performed, also pci_dev_get and pci_dev_put should be in most cases called to properly handle hotplug. This patch does exactly this thing -- increase refcount to let kernel know, that we are using this piece of HW just now. It affects moxa and rio char drivers. Cc: <R.E.Wolff@BitWizard.nl> Acked-by: Amit Gud <gud@eth.net> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
7b7fc708b5
commit
86fbf1486a
@@ -44,6 +44,7 @@
|
||||
** the host.
|
||||
*/
|
||||
struct Host {
|
||||
struct pci_dev *pdev;
|
||||
unsigned char Type; /* RIO_EISA, RIO_MCA, ... */
|
||||
unsigned char Ivec; /* POLLED or ivec number */
|
||||
unsigned char Mode; /* Control stuff */
|
||||
|
||||
@@ -1017,6 +1017,10 @@ static int __init rio_init(void)
|
||||
rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum);
|
||||
|
||||
fix_rio_pci(pdev);
|
||||
|
||||
p->RIOHosts[p->RIONumHosts].pdev = pdev;
|
||||
pci_dev_get(pdev);
|
||||
|
||||
p->RIOLastPCISearch = 0;
|
||||
p->RIONumHosts++;
|
||||
found++;
|
||||
@@ -1066,6 +1070,9 @@ static int __init rio_init(void)
|
||||
((readb(&p->RIOHosts[p->RIONumHosts].Unique[1]) & 0xFF) << 8) | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[2]) & 0xFF) << 16) | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[3]) & 0xFF) << 24);
|
||||
rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum);
|
||||
|
||||
p->RIOHosts[p->RIONumHosts].pdev = pdev;
|
||||
pci_dev_get(pdev);
|
||||
|
||||
p->RIOLastPCISearch = 0;
|
||||
p->RIONumHosts++;
|
||||
found++;
|
||||
@@ -1181,6 +1188,8 @@ static void __exit rio_exit(void)
|
||||
}
|
||||
/* It is safe/allowed to del_timer a non-active timer */
|
||||
del_timer(&hp->timer);
|
||||
if (hp->Type == RIO_PCI)
|
||||
pci_dev_put(hp->pdev);
|
||||
}
|
||||
|
||||
if (misc_deregister(&rio_fw_device) < 0) {
|
||||
|
||||
Reference in New Issue
Block a user