aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/rio/rio_linux.c
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2006-10-21 13:24:01 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-21 16:35:05 -0400
commit86fbf1486a44a4bce4fdcbe3665a7d8a62ba958a (patch)
tree3b49c582fe07b8d82045e494cd3b0779c661f4b8 /drivers/char/rio/rio_linux.c
parent7b7fc708b568a258595e1fa911b930a75ac07b48 (diff)
[PATCH] Char: correct pci_get_device changes
Commits 881a8c120acf7ec09c90289e2996b7c70f51e996 and efe1ec27837d6639eae82e1f5876910ba6433c3f corrects 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>
Diffstat (limited to 'drivers/char/rio/rio_linux.c')
-rw-r--r--drivers/char/rio/rio_linux.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c
index c382df0f82f6..7ac68cb3bedd 100644
--- a/drivers/char/rio/rio_linux.c
+++ b/drivers/char/rio/rio_linux.c
@@ -1017,6 +1017,10 @@ static int __init rio_init(void)
1017 rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); 1017 rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum);
1018 1018
1019 fix_rio_pci(pdev); 1019 fix_rio_pci(pdev);
1020
1021 p->RIOHosts[p->RIONumHosts].pdev = pdev;
1022 pci_dev_get(pdev);
1023
1020 p->RIOLastPCISearch = 0; 1024 p->RIOLastPCISearch = 0;
1021 p->RIONumHosts++; 1025 p->RIONumHosts++;
1022 found++; 1026 found++;
@@ -1066,6 +1070,9 @@ static int __init rio_init(void)
1066 ((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); 1070 ((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);
1067 rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); 1071 rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum);
1068 1072
1073 p->RIOHosts[p->RIONumHosts].pdev = pdev;
1074 pci_dev_get(pdev);
1075
1069 p->RIOLastPCISearch = 0; 1076 p->RIOLastPCISearch = 0;
1070 p->RIONumHosts++; 1077 p->RIONumHosts++;
1071 found++; 1078 found++;
@@ -1181,6 +1188,8 @@ static void __exit rio_exit(void)
1181 } 1188 }
1182 /* It is safe/allowed to del_timer a non-active timer */ 1189 /* It is safe/allowed to del_timer a non-active timer */
1183 del_timer(&hp->timer); 1190 del_timer(&hp->timer);
1191 if (hp->Type == RIO_PCI)
1192 pci_dev_put(hp->pdev);
1184 } 1193 }
1185 1194
1186 if (misc_deregister(&rio_fw_device) < 0) { 1195 if (misc_deregister(&rio_fw_device) < 0) {