Skip to contentSkip to conversation

fix compile warning about dma_addr_t in aic7xxx driver

PATCH New James Bottomley 1 participant 1 message Nov 16, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix compile warning about dma_addr_t in aic7xxx driver

an aic compile is giving this:

drivers/scsi/aic7xxx/aic7xxx_osm_pci.c: In function `ahc_linux_pci_dev_probe':
drivers/scsi/aic7xxx/aic7xxx_osm_pci.c:229: warning: large integer implicitly truncated to unsigned type

The reason is that mask_39bit is defined as dma_addr_t, so mask_39bit = 0x7FFFFFFFFFULL; is warning if dma_addr_t is only 32 bits.

The attached patch converts all the dma masks in the driver to be their proper u64 type (or uint64_t to be consistent with aic style).

James

===== drivers/scsi/aic7xxx/aic79xx_osm.h 1.40 vs edited =====

drivers/scsi/aic7xxx/aic79xx_osm.h +1 -1
@@ -540,7 +540,7 @@
 	uint32_t		 irq;		/* IRQ for this adapter */
 	uint32_t		 bios_address;
 	uint32_t		 mem_busaddr;	/* Mem Base Addr */
-	dma_addr_t		 hw_dma_mask;
+	uint64_t		 hw_dma_mask;
 	ahd_linux_softc_flags	 flags;
 };
 

===== drivers/scsi/aic7xxx/aic79xx_osm_pci.c 1.17 vs edited =====

drivers/scsi/aic7xxx/aic79xx_osm_pci.c +6 -8
@@ -170,24 +170,22 @@
 
 	if (sizeof(dma_addr_t) > 4) {
 		uint64_t   memsize;
-		dma_addr_t mask_64bit;
-		dma_addr_t mask_39bit;
+		const uint64_t mask_39bit = 0x7FFFFFFFFFULL;
 
 		memsize = ahd_linux_get_memsize();
-		mask_64bit = (dma_addr_t)0xFFFFFFFFFFFFFFFFULL;
-		mask_39bit = (dma_addr_t)0x7FFFFFFFFFULL;
+
 		if (memsize >= 0x8000000000ULL
-	 	 && pci_set_dma_mask(pdev, mask_64bit) == 0) {
+	 	 && pci_set_dma_mask(pdev, DMA_64BIT_MASK) == 0) {
 			ahd->flags |= AHD_64BIT_ADDRESSING;
-			ahd->platform_data->hw_dma_mask = mask_64bit;
+			ahd->platform_data->hw_dma_mask = DMA_64BIT_MASK;
 		} else if (memsize > 0x80000000
 			&& pci_set_dma_mask(pdev, mask_39bit) == 0) {
 			ahd->flags |= AHD_39BIT_ADDRESSING;
 			ahd->platform_data->hw_dma_mask = mask_39bit;
 		}
 	} else {
-		pci_set_dma_mask(pdev, 0xFFFFFFFF);
-		ahd->platform_data->hw_dma_mask = 0xFFFFFFFF;
+		pci_set_dma_mask(pdev, DMA_32BIT_MASK);
+		ahd->platform_data->hw_dma_mask = DMA_32BIT_MASK;
 	}
 	ahd->dev_softc = pci;
 	error = ahd_pci_config(ahd, entry);

===== drivers/scsi/aic7xxx/aic7xxx_osm.h 1.57 vs edited =====

drivers/scsi/aic7xxx/aic7xxx_osm.h +1 -1
@@ -545,7 +545,7 @@
 	uint32_t		 irq;		/* IRQ for this adapter */
 	uint32_t		 bios_address;
 	uint32_t		 mem_busaddr;	/* Mem Base Addr */
-	dma_addr_t		 hw_dma_mask;
+	uint64_t		 hw_dma_mask;
 	ahc_linux_softc_flags	 flags;
 };
 

===== drivers/scsi/aic7xxx/aic7xxx_osm_pci.c 1.19 vs edited =====

drivers/scsi/aic7xxx/aic7xxx_osm_pci.c +3 -4
@@ -175,7 +175,7 @@
 ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 	char		 buf[80];
-	dma_addr_t	 mask_39bit;
+	const uint64_t	 mask_39bit = 0x7FFFFFFFFFULL;
 	struct		 ahc_softc *ahc;
 	ahc_dev_softc_t	 pci;
 	struct		 ahc_pci_identity *entry;
@@ -226,18 +226,17 @@
 	}
 	pci_set_master(pdev);
 
-	mask_39bit = 0x7FFFFFFFFFULL;
 	if (sizeof(dma_addr_t) > 4
 	 && ahc_linux_get_memsize() > 0x80000000
 	 && pci_set_dma_mask(pdev, mask_39bit) == 0) {
 		ahc->flags |= AHC_39BIT_ADDRESSING;
 		ahc->platform_data->hw_dma_mask = mask_39bit;
 	} else {
-		if (pci_set_dma_mask(pdev, 0xFFFFFFFF)) {
+		if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
 			printk(KERN_WARNING "aic7xxx: No suitable DMA available.\n");
                 	return (-ENODEV);
 		}
-		ahc->platform_data->hw_dma_mask = 0xFFFFFFFF;
+		ahc->platform_data->hw_dma_mask = DMA_32BIT_MASK;
 	}
 #endif
 	ahc->dev_softc = pci;