Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757256AbbEETXG (ORCPT ); Tue, 5 May 2015 15:23:06 -0400 Received: from terminus.zytor.com ([198.137.202.10]:58969 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752952AbbEETXC (ORCPT ); Tue, 5 May 2015 15:23:02 -0400 Date: Tue, 5 May 2015 12:22:04 -0700 From: tip-bot for Denys Vlasenko Message-ID: Cc: ddutile@redhat.com, m.szyprowski@samsung.com, tglx@linutronix.de, dvlasenk@redhat.com, andi@firstfloor.org, hpa@zytor.com, mingo@kernel.org, dwmw2@infradead.org, linux-kernel@vger.kernel.org, konrad.wilk@oracle.com Reply-To: linux-kernel@vger.kernel.org, konrad.wilk@oracle.com, dwmw2@infradead.org, tglx@linutronix.de, dvlasenk@redhat.com, ddutile@redhat.com, m.szyprowski@samsung.com, mingo@kernel.org, hpa@zytor.com, andi@firstfloor.org In-Reply-To: <1428926075-28796-2-git-send-email-dvlasenk@redhat.com> References: <1428926075-28796-2-git-send-email-dvlasenk@redhat.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/cleanups] x86: Deinline dma_alloc_attrs() Git-Commit-ID: 0c7965ff22472f60d5cf07308cb59f3a118feb8a X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3690 Lines: 113 Commit-ID: 0c7965ff22472f60d5cf07308cb59f3a118feb8a Gitweb: http://git.kernel.org/tip/0c7965ff22472f60d5cf07308cb59f3a118feb8a Author: Denys Vlasenko AuthorDate: Mon, 13 Apr 2015 13:54:32 +0200 Committer: Thomas Gleixner CommitDate: Tue, 5 May 2015 20:48:02 +0200 x86: Deinline dma_alloc_attrs() Reduces kernel size by 68739 bytes on allyesconfig build: text data bss dec hex filename 82662736 22255384 20627456 125545576 77bac68 vmlinux0 82594029 22255352 20627456 125476837 77a9fe5 vmlinux1 Signed-off-by: Denys Vlasenko Cc: Marek Szyprowski Cc: Konrad Rzeszutek Wilk Cc: David Woodhouse Cc: Don Dutile Cc: Andi Kleen Cc: x86@kernel.org Link: http://lkml.kernel.org/r/1428926075-28796-2-git-send-email-dvlasenk@redhat.com Signed-off-by: Thomas Gleixner --- arch/x86/include/asm/dma-mapping.h | 28 ++-------------------------- arch/x86/kernel/pci-dma.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h index 808dae6..6339320 100644 --- a/arch/x86/include/asm/dma-mapping.h +++ b/arch/x86/include/asm/dma-mapping.h @@ -127,33 +127,9 @@ static inline gfp_t dma_alloc_coherent_gfp_flags(struct device *dev, gfp_t gfp) #define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL) -static inline void * +void * dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle, - gfp_t gfp, struct dma_attrs *attrs) -{ - struct dma_map_ops *ops = get_dma_ops(dev); - void *memory; - - gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32); - - if (dma_alloc_from_coherent(dev, size, dma_handle, &memory)) - return memory; - - if (!dev) - dev = &x86_dma_fallback_dev; - - if (!is_device_dma_capable(dev)) - return NULL; - - if (!ops->alloc) - return NULL; - - memory = ops->alloc(dev, size, dma_handle, - dma_alloc_coherent_gfp_flags(dev, gfp), attrs); - debug_dma_alloc_coherent(dev, size, *dma_handle, memory); - - return memory; -} + gfp_t gfp, struct dma_attrs *attrs); #define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL) diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c index a25e202..f9f7656 100644 --- a/arch/x86/kernel/pci-dma.c +++ b/arch/x86/kernel/pci-dma.c @@ -140,6 +140,34 @@ void dma_generic_free_coherent(struct device *dev, size_t size, void *vaddr, free_pages((unsigned long)vaddr, get_order(size)); } +void *dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle, + gfp_t gfp, struct dma_attrs *attrs) +{ + struct dma_map_ops *ops = get_dma_ops(dev); + void *memory; + + gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32); + + if (dma_alloc_from_coherent(dev, size, dma_handle, &memory)) + return memory; + + if (!dev) + dev = &x86_dma_fallback_dev; + + if (!is_device_dma_capable(dev)) + return NULL; + + if (!ops->alloc) + return NULL; + + memory = ops->alloc(dev, size, dma_handle, + dma_alloc_coherent_gfp_flags(dev, gfp), attrs); + debug_dma_alloc_coherent(dev, size, *dma_handle, memory); + + return memory; +} +EXPORT_SYMBOL(dma_alloc_attrs); + /* * See for the iommu kernel * parameter documentation. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/