aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/moxa.c9
-rw-r--r--drivers/char/rio/host.h1
-rw-r--r--drivers/char/rio/rio_linux.c9
3 files changed, 19 insertions, 0 deletions
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c
index b401383808c2..96cb1f07332b 100644
--- a/drivers/char/moxa.c
+++ b/drivers/char/moxa.c
@@ -130,6 +130,7 @@ static moxa_isa_board_conf moxa_isa_boards[] =
130typedef struct _moxa_pci_devinfo { 130typedef struct _moxa_pci_devinfo {
131 ushort busNum; 131 ushort busNum;
132 ushort devNum; 132 ushort devNum;
133 struct pci_dev *pdev;
133} moxa_pci_devinfo; 134} moxa_pci_devinfo;
134 135
135typedef struct _moxa_board_conf { 136typedef struct _moxa_board_conf {
@@ -324,6 +325,9 @@ static int moxa_get_PCI_conf(struct pci_dev *p, int board_type, moxa_board_conf
324 board->busType = MOXA_BUS_TYPE_PCI; 325 board->busType = MOXA_BUS_TYPE_PCI;
325 board->pciInfo.busNum = p->bus->number; 326 board->pciInfo.busNum = p->bus->number;
326 board->pciInfo.devNum = p->devfn >> 3; 327 board->pciInfo.devNum = p->devfn >> 3;
328 board->pciInfo.pdev = p;
329 /* don't lose the reference in the next pci_get_device iteration */
330 pci_dev_get(p);
327 331
328 return (0); 332 return (0);
329} 333}
@@ -493,6 +497,11 @@ static void __exit moxa_exit(void)
493 if (tty_unregister_driver(moxaDriver)) 497 if (tty_unregister_driver(moxaDriver))
494 printk("Couldn't unregister MOXA Intellio family serial driver\n"); 498 printk("Couldn't unregister MOXA Intellio family serial driver\n");
495 put_tty_driver(moxaDriver); 499 put_tty_driver(moxaDriver);
500
501 for (i = 0; i < MAX_BOARDS; i++)
502 if (moxa_boards[i].busType == MOXA_BUS_TYPE_PCI)
503 pci_dev_put(moxa_boards[i].pciInfo.pdev);
504
496 if (verbose) 505 if (verbose)
497 printk("Done\n"); 506 printk("Done\n");
498} 507}
diff --git a/drivers/char/rio/host.h b/drivers/char/rio/host.h
index ee2ddea7a63a..23d0681fe491 100644
--- a/drivers/char/rio/host.h
+++ b/drivers/char/rio/host.h
@@ -44,6 +44,7 @@
44** the host. 44** the host.
45*/ 45*/
46struct Host { 46struct Host {
47 struct pci_dev *pdev;
47 unsigned char Type; /* RIO_EISA, RIO_MCA, ... */ 48 unsigned char Type; /* RIO_EISA, RIO_MCA, ... */
48 unsigned char Ivec; /* POLLED or ivec number */ 49 unsigned char Ivec; /* POLLED or ivec number */
49 unsigned char Mode; /* Control stuff */ 50 unsigned char Mode; /* Control stuff */
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) {