linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mpt2sas: use correct pci_resource_flag for comparison with device pci ,resource
@ 2010-03-12 23:27 Richard A Lary
  2010-03-30 10:48 ` Desai, Kashyap
  0 siblings, 1 reply; 2+ messages in thread
From: Richard A Lary @ 2010-03-12 23:27 UTC (permalink / raw)
  To: linux-scsi

From: Richard A Lary <rlary@linux.vnet.ibm.com>

This patch replaces incorrect  base address space flag with correct IO 
resource
flag.  Also, performs check of memory resource to validate resource before
using.

Signed-off-by: Richard A Lary <rlary@linux.vnet.ibm.com>

---

Index: b/drivers/scsi/mpt2sas/mpt2sas_base.c
===================================================================
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -1253,7 +1253,7 @@ mpt2sas_base_map_resources(struct MPT2SA
  	}

  	for (i = 0, memap_sz = 0, pio_sz = 0 ; i < DEVICE_COUNT_RESOURCE; i++) {
-		if (pci_resource_flags(pdev, i) & PCI_BASE_ADDRESS_SPACE_IO) {
+		if (pci_resource_flags(pdev, i) & IORESOURCE_IO) {
  			if (pio_sz)
  				continue;
  			pio_chip = (u64)pci_resource_start(pdev, i);
@@ -1261,15 +1261,18 @@ mpt2sas_base_map_resources(struct MPT2SA
  		} else {
  			if (memap_sz)
  				continue;
-			ioc->chip_phys = pci_resource_start(pdev, i);
-			chip_phys = (u64)ioc->chip_phys;
-			memap_sz = pci_resource_len(pdev, i);
-			ioc->chip = ioremap(ioc->chip_phys, memap_sz);
-			if (ioc->chip == NULL) {
-				printk(MPT2SAS_ERR_FMT "unable to map adapter "
-				    "memory!\n", ioc->name);
-				r = -EINVAL;
-				goto out_fail;
+			/* verify memory resource is valid before using */
+			if (pci_resource_flags(pdev, i) & IORESOURCE_MEM) {
+				ioc->chip_phys = pci_resource_start(pdev, i);
+				chip_phys = (u64)ioc->chip_phys;
+				memap_sz = pci_resource_len(pdev, i);
+				ioc->chip = ioremap(ioc->chip_phys, memap_sz);
+				if (ioc->chip == NULL) {
+					printk(MPT2SAS_ERR_FMT "unable to map "
+					    "adapter memory!\n", ioc->name);
+					r = -EINVAL;
+					goto out_fail;
+				}
  			}
  		}
  	}


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

* RE: [PATCH] mpt2sas: use correct pci_resource_flag for comparison with device pci ,resource
  2010-03-12 23:27 [PATCH] mpt2sas: use correct pci_resource_flag for comparison with device pci ,resource Richard A Lary
@ 2010-03-30 10:48 ` Desai, Kashyap
  0 siblings, 0 replies; 2+ messages in thread
From: Desai, Kashyap @ 2010-03-30 10:48 UTC (permalink / raw)
  To: Richard A Lary, linux-scsi@vger.kernel.org

After reviewing your patch, your patch looks ok to me. Similar changes I will post it for mptfusion also.

Please consider this patch as an Acked.

-- Kashyap

> -----Original Message-----
> From: linux-scsi-owner@vger.kernel.org [mailto:linux-scsi-
> owner@vger.kernel.org] On Behalf Of Richard A Lary
> Sent: Saturday, March 13, 2010 4:57 AM
> To: linux-scsi@vger.kernel.org
> Subject: [PATCH] mpt2sas: use correct pci_resource_flag for comparison
> with device pci ,resource
> 
> From: Richard A Lary <rlary@linux.vnet.ibm.com>
> 
> This patch replaces incorrect  base address space flag with correct IO
> resource
> flag.  Also, performs check of memory resource to validate resource
> before
> using.
> 
> Signed-off-by: Richard A Lary <rlary@linux.vnet.ibm.com>
> 
> ---
> 
> Index: b/drivers/scsi/mpt2sas/mpt2sas_base.c
> ===================================================================
> --- a/drivers/scsi/mpt2sas/mpt2sas_base.c
> +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
> @@ -1253,7 +1253,7 @@ mpt2sas_base_map_resources(struct MPT2SA
>   	}
> 
>   	for (i = 0, memap_sz = 0, pio_sz = 0 ; i < DEVICE_COUNT_RESOURCE;
> i++) {
> -		if (pci_resource_flags(pdev, i) &
> PCI_BASE_ADDRESS_SPACE_IO) {
> +		if (pci_resource_flags(pdev, i) & IORESOURCE_IO) {
>   			if (pio_sz)
>   				continue;
>   			pio_chip = (u64)pci_resource_start(pdev, i);
> @@ -1261,15 +1261,18 @@ mpt2sas_base_map_resources(struct MPT2SA
>   		} else {
>   			if (memap_sz)
>   				continue;
> -			ioc->chip_phys = pci_resource_start(pdev, i);
> -			chip_phys = (u64)ioc->chip_phys;
> -			memap_sz = pci_resource_len(pdev, i);
> -			ioc->chip = ioremap(ioc->chip_phys, memap_sz);
> -			if (ioc->chip == NULL) {
> -				printk(MPT2SAS_ERR_FMT "unable to map adapter "
> -				    "memory!\n", ioc->name);
> -				r = -EINVAL;
> -				goto out_fail;
> +			/* verify memory resource is valid before using */
> +			if (pci_resource_flags(pdev, i) & IORESOURCE_MEM) {
> +				ioc->chip_phys = pci_resource_start(pdev, i);
> +				chip_phys = (u64)ioc->chip_phys;
> +				memap_sz = pci_resource_len(pdev, i);
> +				ioc->chip = ioremap(ioc->chip_phys, memap_sz);
> +				if (ioc->chip == NULL) {
> +					printk(MPT2SAS_ERR_FMT "unable to map "
> +					    "adapter memory!\n", ioc->name);
> +					r = -EINVAL;
> +					goto out_fail;
> +				}
>   			}
>   		}
>   	}
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi"
> in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2010-03-30 10:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-12 23:27 [PATCH] mpt2sas: use correct pci_resource_flag for comparison with device pci ,resource Richard A Lary
2010-03-30 10:48 ` Desai, Kashyap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).