public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 4/4] pmc551 pci cleanup
@ 2006-09-18 22:47 Jiri Slaby
  2006-09-19  6:50 ` Rolf Eike Beer
  0 siblings, 1 reply; 2+ messages in thread
From: Jiri Slaby @ 2006-09-18 22:47 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mtd, linux-kernel, Mark Ferrell

pmc551 pci cleanup

use pci_get_device -- refcounting, release it by pci_dev_put. Use
pci_resource_start for getting start of regions.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

---
commit 6fe18c54c93d38eec34ca0776da60fc355968f6b
tree 5bf3cf8fe213de770c7c7a1279eafb3937f4c386
parent 912ff3e53f760cb166988fcd46fc173f8e4c22e7
author Jiri Slaby <xslaby@anemoi.localdomain> Tue, 19 Sep 2006 00:39:08 +0200
committer Jiri Slaby <xslaby@anemoi.localdomain> Tue, 19 Sep 2006 00:39:08 +0200

 drivers/mtd/devices/pmc551.c |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/mtd/devices/pmc551.c b/drivers/mtd/devices/pmc551.c
index 5f5de9c..d1ba4b9 100644
--- a/drivers/mtd/devices/pmc551.c
+++ b/drivers/mtd/devices/pmc551.c
@@ -563,7 +563,7 @@ #ifdef CONFIG_MTD_PMC551_DEBUG
 		size >> 10 : size >> 20,
 		(size < 1024) ? 'B' : (size < 1048576) ? 'K' : 'M', size,
 		((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));
 
 	/*
@@ -693,13 +693,13 @@ static int __init init_pmc551(void)
 	 */
 	for (count = 0; count < MAX_MTD_DEVICES; count++) {
 
-		if ((PCI_Device = pci_find_device(PCI_VENDOR_ID_V3_SEMI,
-						  PCI_DEVICE_ID_V3_SEMI_V370PDC,
-						  PCI_Device)) == NULL)
+		if ((PCI_Device = pci_get_device(PCI_VENDOR_ID_V3_SEMI,
+				PCI_DEVICE_ID_V3_SEMI_V370PDC,
+				PCI_Device)) == NULL)
 			break;
 
 		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
@@ -711,6 +711,7 @@ static int __init init_pmc551(void)
 		 */
 		if ((length = fixup_pmc551(PCI_Device)) <= 0) {
 			printk(KERN_NOTICE "pmc551: Cannot init SDRAM\n");
+			pci_dev_put(PCI_Device);
 			break;
 		}
 
@@ -729,6 +730,7 @@ static int __init init_pmc551(void)
 		if (!mtd) {
 			printk(KERN_NOTICE "pmc551: Cannot allocate new MTD "
 				"device.\n");
+			pci_dev_put(PCI_Device);
 			break;
 		}
 
@@ -737,6 +739,7 @@ static int __init init_pmc551(void)
 			printk(KERN_NOTICE "pmc551: Cannot allocate new MTD "
 				"device.\n");
 			kfree(mtd);
+			pci_dev_put(PCI_Device);
 			break;
 		}
 		mtd->priv = priv;
@@ -755,14 +758,14 @@ static int __init init_pmc551(void)
 				"size %dM\n", asize >> 20);
 			priv->asize = asize;
 		}
-		priv->start = ioremap(((PCI_Device->resource[0].start)
-					& PCI_BASE_ADDRESS_MEM_MASK),
-				      priv->asize);
+		priv->start = ioremap(pci_resource_start(PCI_Device, 0) &
+				PCI_BASE_ADDRESS_MEM_MASK, priv->asize);
 
 		if (!priv->start) {
 			printk(KERN_NOTICE "pmc551: Unable to map IO space\n");
 			kfree(mtd->priv);
 			kfree(mtd);
+			pci_dev_put(PCI_Device);
 			break;
 		}
 #ifdef CONFIG_MTD_PMC551_DEBUG
@@ -801,6 +804,7 @@ #endif
 			iounmap(priv->start);
 			kfree(mtd->priv);
 			kfree(mtd);
+			pci_dev_put(PCI_Device);
 			break;
 		}
 		printk(KERN_NOTICE "Registered pmc551 memory device.\n");
@@ -844,6 +848,7 @@ static void __exit cleanup_pmc551(void)
 			iounmap(priv->start);
 		}
 
+		pci_dev_put(priv->dev);
 		kfree(mtd->priv);
 		del_mtd_device(mtd);
 		kfree(mtd);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 4/4] pmc551 pci cleanup
  2006-09-18 22:47 [PATCH 4/4] pmc551 pci cleanup Jiri Slaby
@ 2006-09-19  6:50 ` Rolf Eike Beer
  0 siblings, 0 replies; 2+ messages in thread
From: Rolf Eike Beer @ 2006-09-19  6:50 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: Andrew Morton, linux-mtd, linux-kernel, Mark Ferrell

[-- Attachment #1: Type: text/plain, Size: 1901 bytes --]

Am Dienstag, 19. September 2006 00:47 schrieb Jiri Slaby:
> pmc551 pci cleanup
>
> use pci_get_device -- refcounting, release it by pci_dev_put. Use
> pci_resource_start for getting start of regions.
>
> Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
>
> ---
> commit 6fe18c54c93d38eec34ca0776da60fc355968f6b
> tree 5bf3cf8fe213de770c7c7a1279eafb3937f4c386
> parent 912ff3e53f760cb166988fcd46fc173f8e4c22e7
> author Jiri Slaby <xslaby@anemoi.localdomain> Tue, 19 Sep 2006 00:39:08
> +0200 committer Jiri Slaby <xslaby@anemoi.localdomain> Tue, 19 Sep 2006
> 00:39:08 +0200

You should change your .git/config and add a user section to get the mail 
address correct I think.

>  drivers/mtd/devices/pmc551.c |   21 +++++++++++++--------
>  1 files changed, 13 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/mtd/devices/pmc551.c b/drivers/mtd/devices/pmc551.c
> index 5f5de9c..d1ba4b9 100644
> --- a/drivers/mtd/devices/pmc551.c
> +++ b/drivers/mtd/devices/pmc551.c
> @@ -563,7 +563,7 @@ #ifdef CONFIG_MTD_PMC551_DEBUG
>  		size >> 10 : size >> 20,
>  		(size < 1024) ? 'B' : (size < 1048576) ? 'K' : 'M', size,
>  		((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));
>
>  	/*

The last part is unneeded in both versions, when resource[n].start is set the 
PCI core already does the masking.

> @@ -755,14 +758,14 @@ static int __init init_pmc551(void)
>  				"size %dM\n", asize >> 20);
>  			priv->asize = asize;
>  		}
> -		priv->start = ioremap(((PCI_Device->resource[0].start)
> -					& PCI_BASE_ADDRESS_MEM_MASK),
> -				      priv->asize);
> +		priv->start = ioremap(pci_resource_start(PCI_Device, 0) &
> +				PCI_BASE_ADDRESS_MEM_MASK, priv->asize);

pci_iomap(PCI_Device, 0, priv->asize);

Eike

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-09-19  6:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-18 22:47 [PATCH 4/4] pmc551 pci cleanup Jiri Slaby
2006-09-19  6:50 ` Rolf Eike Beer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox