[MTD] MAPS: esb2rom: use hotplug safe interfaces

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sat Oct 21 11:59:02 EDT 2006


Commit:     c7438d02b384e82261e28fc280167f4e7a65e822
Parent:     f33686b5a79674bec0e1aa553d420485e3a12899
commit c7438d02b384e82261e28fc280167f4e7a65e822
Author:     Alan Cox <alan at lxorguk.ukuu.org.uk>
AuthorDate: Fri Oct 20 14:41:06 2006 -0700
Commit:     David Woodhouse <dwmw2 at infradead.org>
CommitDate: Sat Oct 21 16:22:58 2006 +0100

    [MTD] MAPS: esb2rom: use hotplug safe interfaces
    
    Fairly self explanatory.  Keep a reference initially, drop it when we free up
    the driver resources.
    
    Signed-off-by: Alan Cox <alan at redhat.com>
    Signed-off-by: Andrew Morton <akpm at osdl.org>
    Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
---
 drivers/mtd/maps/esb2rom.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/maps/esb2rom.c b/drivers/mtd/maps/esb2rom.c
index e1c7814..a9d808a 100644
--- a/drivers/mtd/maps/esb2rom.c
+++ b/drivers/mtd/maps/esb2rom.c
@@ -140,8 +140,8 @@ static void esb2rom_cleanup(struct esb2r
 		window->virt = NULL;
 		window->phys = 0;
 		window->size = 0;
-		window->pdev = NULL;
 	}
+	pci_dev_put(window->pdev);
 }
 
 static int __devinit esb2rom_init_one(struct pci_dev *pdev,
@@ -164,7 +164,7 @@ static int __devinit esb2rom_init_one(st
 	 * Also you can page firmware hubs if an 8MiB window isn't enough
 	 * but don't currently handle that case either.
 	 */
-	window->pdev = pdev;
+	window->pdev = pci_dev_get(pdev);
 
 	/* RLG:  experiment 2.  Force the window registers to the widest values */
 
@@ -418,7 +418,7 @@ static int __init init_esb2rom(void)
 	pdev = NULL;
 	for (id = esb2rom_pci_tbl; id->vendor; id++) {
 		printk(KERN_DEBUG "device id = %x\n", id->device);
-		pdev = pci_find_device(id->vendor, id->device, NULL);
+		pdev = pci_get_device(id->vendor, id->device, NULL);
 		if (pdev) {
 			printk(KERN_DEBUG "matched device = %x\n", id->device);
 			break;
@@ -427,6 +427,7 @@ static int __init init_esb2rom(void)
 	if (pdev) {
 		printk(KERN_DEBUG "matched device id %x\n", id->device);
 		retVal = esb2rom_init_one(pdev, &esb2rom_pci_tbl[0]);
+		pci_dev_put(pdev);
 		printk(KERN_DEBUG "retVal = %d\n", retVal);
 		return retVal;
 	}



More information about the linux-mtd-cvs mailing list