Commit 98aacdfd authored by Jiri Slaby's avatar Jiri Slaby Committed by David Woodhouse

[MTD] pmc551 pci cleanup

Use pci_resource_start for getting start of regions and pci_iomap to not
doing this directly by using dev->resource... (Thanks to Rolf Eike Beer)
Signed-off-by: default avatarJiri Slaby <jirislaby@gmail.com>
Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
parent 7fefb924
...@@ -568,8 +568,7 @@ static u32 fixup_pmc551(struct pci_dev *dev) ...@@ -568,8 +568,7 @@ static u32 fixup_pmc551(struct pci_dev *dev)
size >> 10 : size >> 20, size >> 10 : size >> 20,
(size < 1024) ? 'B' : (size < 1048576) ? 'K' : 'M', size, (size < 1024) ? 'B' : (size < 1048576) ? 'K' : 'M', size,
((dcmd & (0x1 << 3)) == 0) ? "non-" : "", ((dcmd & (0x1 << 3)) == 0) ? "non-" : "",
(unsigned long long)((dev->resource[0].start) & (unsigned long long)pci_resource_start(dev, 0));
PCI_BASE_ADDRESS_MEM_MASK));
/* /*
* Check to see the state of the memory * Check to see the state of the memory
...@@ -705,7 +704,7 @@ static int __init init_pmc551(void) ...@@ -705,7 +704,7 @@ static int __init init_pmc551(void)
} }
printk(KERN_NOTICE "pmc551: Found PCI V370PDC at 0x%llx\n", printk(KERN_NOTICE "pmc551: Found PCI V370PDC at 0x%llx\n",
(unsigned long long)PCI_Device->resource[0].start); (unsigned long long)pci_resource_start(PCI_Device, 0));
/* /*
* The PMC551 device acts VERY weird if you don't init it * The PMC551 device acts VERY weird if you don't init it
...@@ -762,9 +761,7 @@ static int __init init_pmc551(void) ...@@ -762,9 +761,7 @@ static int __init init_pmc551(void)
"size %dM\n", asize >> 20); "size %dM\n", asize >> 20);
priv->asize = asize; priv->asize = asize;
} }
priv->start = ioremap(((PCI_Device->resource[0].start) priv->start = pci_iomap(PCI_Device, 0, priv->asize);
& PCI_BASE_ADDRESS_MEM_MASK),
priv->asize);
if (!priv->start) { if (!priv->start) {
printk(KERN_NOTICE "pmc551: Unable to map IO space\n"); printk(KERN_NOTICE "pmc551: Unable to map IO space\n");
...@@ -805,7 +802,7 @@ static int __init init_pmc551(void) ...@@ -805,7 +802,7 @@ static int __init init_pmc551(void)
if (add_mtd_device(mtd)) { if (add_mtd_device(mtd)) {
printk(KERN_NOTICE "pmc551: Failed to register new " printk(KERN_NOTICE "pmc551: Failed to register new "
"device\n"); "device\n");
iounmap(priv->start); pci_iounmap(PCI_Device, priv->start);
kfree(mtd->priv); kfree(mtd->priv);
kfree(mtd); kfree(mtd);
break; break;
...@@ -856,7 +853,7 @@ static void __exit cleanup_pmc551(void) ...@@ -856,7 +853,7 @@ static void __exit cleanup_pmc551(void)
if (priv->start) { if (priv->start) {
printk(KERN_DEBUG "pmc551: unmapping %dM starting at " printk(KERN_DEBUG "pmc551: unmapping %dM starting at "
"0x%p\n", priv->asize >> 20, priv->start); "0x%p\n", priv->asize >> 20, priv->start);
iounmap(priv->start); pci_iounmap(priv->dev, priv->start);
} }
pci_dev_put(priv->dev); pci_dev_put(priv->dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment