Skip to content

Commit

Permalink
dma-mapping: reduce dma_mapping_error inline bloat
Browse files Browse the repository at this point in the history
Thanks to the nested inlining, all drivers correctly calling
dma_mapping_error() after a mapping a page or single buffer generate two
calls to get_arch_dma_ops() per callsite, which all adds up to a fair
old chunk of useless code, e.g. ~3KB for an arm64 defconfig plus extras:

   text	   data	    bss	    dec	    hex	filename
13051391	1503898	 327768	14883057	 e318f1	vmlinux.o.old
13050751	1503898	 327768	14882417	 e31671	vmlinux.o.new

Give the compiler a hand by making it clear we want the same ops.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
  • Loading branch information
Robin Murphy authored and Christoph Hellwig committed Aug 25, 2017
1 parent ee7b1f3 commit 5237e95
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions include/linux/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -565,10 +565,11 @@ static inline void dma_free_noncoherent(struct device *dev, size_t size,

static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
{
debug_dma_mapping_error(dev, dma_addr);
const struct dma_map_ops *ops = get_dma_ops(dev);

if (get_dma_ops(dev)->mapping_error)
return get_dma_ops(dev)->mapping_error(dev, dma_addr);
debug_dma_mapping_error(dev, dma_addr);
if (ops->mapping_error)
return ops->mapping_error(dev, dma_addr);
return 0;
}

Expand Down

0 comments on commit 5237e95

Please sign in to comment.