Re: [PATCH v3 07/37] lib/dma-virt: Add dma_virt_ops

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

 



On Mon, 2017-01-23 at 17:03 +0100, Joerg Roedel wrote:
> On Fri, Jan 20, 2017 at 01:04:07PM -0800, Bart Van Assche wrote:
> > +static void *dma_virt_alloc(struct device *dev, size_t size,
> > +			    dma_addr_t *dma_handle, gfp_t gfp,
> > +			    unsigned long attrs)
> > +{
> > +	void *ret;
> > +
> > +	ret = (void *)__get_free_pages(gfp, get_order(size));
> > +	if (ret)
> > +		*dma_handle = (uintptr_t)ret;
> 
> Why do you cast to uintptr_t everywhere in this patch before assigning
> to a dma_addr_t when you can cast directly to dma_addr_t?

Hello Joerg,

There is at least one Linux architecture for which pointers are 64 bits
wide and dma_addr_t is 32 bits wide. As you know casting a 64-bit pointer
to a 32-bit integer type triggers a compiler warning. That's why I used
uintptr_t instead of dma_addr_t.

Bart.--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux