* aic7xxx driver large integer warning
@ 2004-12-06 0:23 Miguel Angel Flores
2004-12-06 13:31 ` Alan Cox
0 siblings, 1 reply; 4+ messages in thread
From: Miguel Angel Flores @ 2004-12-06 0:23 UTC (permalink / raw)
To: linux-kernel
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: aic7xxx driver large integer warning
2004-12-06 0:23 aic7xxx driver large integer warning Miguel Angel Flores
@ 2004-12-06 13:31 ` Alan Cox
2004-12-06 17:30 ` Miguel Angel Flores
0 siblings, 1 reply; 4+ messages in thread
From: Alan Cox @ 2004-12-06 13:31 UTC (permalink / raw)
To: Miguel Angel Flores; +Cc: Linux Kernel Mailing List
On Llu, 2004-12-06 at 00:23, Miguel Angel Flores wrote:
> drivers/scsi/aic7xxx/aic7xxx_osm_pci.c:229: warning: large integer
> implicitly truncated to unsigned type
> ---
Add (dma_addr_t) casts and it will go away. The compiler just wants to
know you mean it.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: aic7xxx driver large integer warning
2004-12-06 13:31 ` Alan Cox
@ 2004-12-06 17:30 ` Miguel Angel Flores
2004-12-07 12:58 ` Alan Cox
0 siblings, 1 reply; 4+ messages in thread
From: Miguel Angel Flores @ 2004-12-06 17:30 UTC (permalink / raw)
To: Alan Cox; +Cc: Linux Kernel Mailing List
Alan Cox wrote:
>Add (dma_addr_t) casts and it will go away. The compiler just wants to
>know you mean it.
>
>
Sure, but the 39 bit variable is only used when the type of dma_addr_t
is u64. I think that is more clean to put this assignement inside the if
block, like the rest of the CONFIG_HIGHMEM64G code. Anyway the
(dma_addr_t) cast can be added too.
¿how you would solve this?
Cheers,
MaF
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: aic7xxx driver large integer warning
2004-12-06 17:30 ` Miguel Angel Flores
@ 2004-12-07 12:58 ` Alan Cox
0 siblings, 0 replies; 4+ messages in thread
From: Alan Cox @ 2004-12-07 12:58 UTC (permalink / raw)
To: Miguel Angel Flores; +Cc: Linux Kernel Mailing List
On Llu, 2004-12-06 at 17:30, Miguel Angel Flores wrote:
> Sure, but the 39 bit variable is only used when the type of dma_addr_t
> is u64. I think that is more clean to put this assignement inside the if
> block, like the rest of the CONFIG_HIGHMEM64G code. Anyway the
> (dma_addr_t) cast can be added too.
>
> ¿how you would solve this?
I'd just add the cast. The compiler will truncate it to FFFFFFFF if
appropriate.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-12-07 14:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-06 0:23 aic7xxx driver large integer warning Miguel Angel Flores
2004-12-06 13:31 ` Alan Cox
2004-12-06 17:30 ` Miguel Angel Flores
2004-12-07 12:58 ` Alan Cox
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).