From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932500AbdGXR3o (ORCPT ); Mon, 24 Jul 2017 13:29:44 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:35726 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756322AbdGXR3c (ORCPT ); Mon, 24 Jul 2017 13:29:32 -0400 From: Robin Murphy To: hch@lst.de, m.szyprowski@samsung.com Cc: linux-kernel@vger.kernel.org Subject: [PATCH] dma-mapping: Reduce dma_mapping_error() inline bloat Date: Mon, 24 Jul 2017 18:29:27 +0100 Message-Id: <6a23eacf6603e75e995f8720c24b54c4fc2926f5.1500917215.git.robin.murphy@arm.com> X-Mailer: git-send-email 2.12.2.dirty Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- include/linux/dma-mapping.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 843ab866e0f4..239e53d12ee8 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -541,10 +541,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; } -- 2.12.2.dirty