Re: [PATCH] alpha: Add DMA_ERROR_CODE defn to avert compiler error in drm

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

 



On Wed, 4 May 2011 17:59:29 -0400
Matt Turner <mattst88@xxxxxxxxx> wrote:

> Other architectures define this differently.
> 
> arch/ia64/include/asm/dma-mapping.h:#define DMA_ERROR_CODE 0
> arch/microblaze/include/asm/dma-mapping.h:#define DMA_ERROR_CODE
>          (~(dma_addr_t)0x0)
> arch/powerpc/include/asm/dma-mapping.h:#define DMA_ERROR_CODE
>  (~(dma_addr_t)0x0)
> arch/sparc/include/asm/dma-mapping.h:#define DMA_ERROR_CODE
> (~(dma_addr_t)0x0)
> arch/x86/include/asm/dma-mapping.h:#define DMA_ERROR_CODE       0
> 
> Any idea what the reason is?

Because an invalid DMA address is architecture specific. To be exact,
an invalid DMA address is DMA operation specific.

As I wrote in another mail, this patch is wrong.

Architectures don't need to define DMA_ERROR_CODE.

Some architectures need multiple dma_mapping_error functions. You
could use DMA_ERROR_CODE in order to avoid duplicated code like
this. That is, you define only for dma_map_ops that needs the own
mapping_error function.

static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
{
	struct dma_map_ops *ops = get_dma_ops(dev);
	if (ops->mapping_error)
		return ops->mapping_error(dev, dma_addr);

	return (dma_addr == DMA_ERROR_CODE);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-alpha" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux