aic7xxx driver large integer warning

From: Miguel Angel Flores
Date: Sun Dec 05 2004 - 19:21:52 EST


Hi list.

As I said yesterday, the 2.6.10rc3 kernel warns compiling the aic7xxxx SCSI driver:

---
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
---

[aic7xxx_osm_pci.c]
mask_39bit = 0x7FFFFFFFFFULL;

mask_39bit type is dma_addr_t. However the length of dma_addr_t is defined in types.h.

[types.h]
#ifdef CONFIG_HIGHMEM64G
typedef u64 dma_addr_t;
#else
typedef u32 dma_addr_t;
#endif
typedef u64 dma64_addr_t;

I think the correct solution is to make the assignement only if CONFIG_HIGHMEM64G is defined:

[aic7xxx_osm_pci.c]
mask_39bit = 0x7FFFFFFFFFULL; //assignement
if (sizeof(dma_addr_t) > 4 //CONFIG_HIGHMEM64G is defined
&& ahc_linux_get_memsize() > 0x80000000
&& pci_set_dma_mask(pdev, mask_39bit) == 0) {

/* the correct position of the assignement IMHO */

ahc->flags |= AHC_39BIT_ADDRESSING;
ahc->platform_data->hw_dma_mask = mask_39bit;
} else {
if (pci_set_dma_mask(pdev, 0xFFFFFFFF)) {
printk(KERN_WARNING "aic7xxx: No suitable DMA available.\n");
return (-ENODEV);
}
ahc->platform_data->hw_dma_mask = 0xFFFFFFFF;

Before I post a new patch, I wish to know your opinion.

Thanks,
MaF

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/