lkml.org 
[lkml]   [2016]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] arm64: dma-mapping: fix dma_to_phys API for IOMMU attached devices
Date
On Thursday 17 March 2016 12:36:28 Sinan Kaya wrote:
>
> The first solution that comes to my mind is to implement a weak function in
> swiotlb.c with these contents
>
> dma_addr_t __weak swio_phys_to_dma(struct device *dev, phys_addr_t paddr)
> {
> return paddr;
> }
>
>
> phys_addr_t __weak swio_dma_to_phys(struct device *dev, dma_addr_t daddr)
> {
> return daddr;
> }
>
> then clean up all the duplicates in dma-mapping.h for all ARCHs that have
> identical code.
>
> For others move the implementation to some source file.
>
>

Sounds ok to me, but I'd prefer using a macro instead of a __weak symbol:

#ifndef swiotlb_phys_to_dma
static inline dma_addr_t swiotlb_phys_to_dma(struct device *dev, phys_addr_t paddr)
{
return paddr;
}
#endif

and then let the architectures that override it provide a self-referencing
macro:

#define swiotlb_phys_to_dma swiotlb_phys_to_dma

Also note swiotlb instead of swio, to match the existing naming.

Arnd

\
 
 \ /
  Last update: 2016-03-17 18:41    [W:0.423 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site