Re: [PATCH 2/2] staging: et131x: Fix 64bit tx dma address handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 18, 2012 at 10:59:56AM +0100, Alan Cox wrote:
> > > +                                                         skb_headlen(skb),
> > > +                                                         DMA_TO_DEVICE);
> > > +                               desc[frag].addr_lo = dma_addr & 0xFFFFFFFF;
> > > +                               desc[frag].addr_hi = dma_addr >> 32;
> > 
> > Maybe use macros defined in kernel.h instead:
> > 
> > desc[frag].addr_lo = lower_32_bits(dma_addr);
> > desc[frag].addr_hi = upper_32_bits(dma_addr);
> > 
> > A few more instances below.
> 
> This is actually important because >> 32 of a 32bit value is undefined in
> C. The compiler is free to do what it likes with this. While the results
> are usually sane some architectures do generate the equivalent of
> 
> 		x >> (n % wordsize);
> 
> Alan

Thanks for the comments both. I'll send an updated patch this evening.

The intention is to eventually store this value as a dma_addr_t anyway,
but some more work needs to be done to copy the address correctly to the
desc ring.

Cheers,

Mark
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux