]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/char/moxa.c
[PATCH] md: do not freeze md threads for suspend
[linux-2.6-omap-h63xx.git] / drivers / char / moxa.c
index b401383808c26ac4c16ce38f15fc129b4dafd56a..96cb1f07332b68e5fb5b77dfb68a74d6356c6b64 100644 (file)
@@ -130,6 +130,7 @@ static moxa_isa_board_conf moxa_isa_boards[] =
 typedef struct _moxa_pci_devinfo {
        ushort busNum;
        ushort devNum;
+       struct pci_dev *pdev;
 } moxa_pci_devinfo;
 
 typedef struct _moxa_board_conf {
@@ -324,6 +325,9 @@ static int moxa_get_PCI_conf(struct pci_dev *p, int board_type, moxa_board_conf
        board->busType = MOXA_BUS_TYPE_PCI;
        board->pciInfo.busNum = p->bus->number;
        board->pciInfo.devNum = p->devfn >> 3;
+       board->pciInfo.pdev = p;
+       /* don't lose the reference in the next pci_get_device iteration */
+       pci_dev_get(p);
 
        return (0);
 }
@@ -493,6 +497,11 @@ static void __exit moxa_exit(void)
        if (tty_unregister_driver(moxaDriver))
                printk("Couldn't unregister MOXA Intellio family serial driver\n");
        put_tty_driver(moxaDriver);
+
+       for (i = 0; i < MAX_BOARDS; i++)
+               if (moxa_boards[i].busType == MOXA_BUS_TYPE_PCI)
+                       pci_dev_put(moxa_boards[i].pciInfo.pdev);
+
        if (verbose)
                printk("Done\n");
 }