Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751465Ab3FQETA (ORCPT ); Mon, 17 Jun 2013 00:19:00 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:54616 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750750Ab3FQES6 (ORCPT ); Mon, 17 Jun 2013 00:18:58 -0400 X-AuditID: cbfee68e-b7f276d000002279-26-51be8e31dfa5 From: YoungJun Cho To: linux-arm-kernel@lists.infradead.org, linux@arm.linux.org.uk, m.szyprowski@samsung.com Cc: linux-kernel@vger.kernel.org, hdoyu@nvidia.com, kyungmin.park@samsung.com, yj44.cho@samsung.com Subject: [PATCH] ARM: dma-mapping: Get pages if the cpu_addr is out of atomic_pool Date: Mon, 17 Jun 2013 13:18:52 +0900 Message-id: <1371442732-15088-1-git-send-email-yj44.cho@samsung.com> X-Mailer: git-send-email 1.7.4.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFLMWRmVeSWpSXmKPExsVy+t8zHV3Dvn2BBus7eC0+Xp7NbHG26Q27 xabH11gtLu+aw2Zx+zKvxdojd9kt9u6czOjA7tHS3MPmsXlJvUdv8zs2j74tqxg9Pm+SC2CN 4rJJSc3JLEst0rdL4Mq4fPsoa8Etropd+5ezNzC+5+hi5OSQEDCROLD5PTOELSZx4d56ti5G Lg4hgWWMEptb3rDAFF1o62YHsYUEpjNKvN7gD2E3M0lcfMUIYrMJaEo8/7iDFcQWEYiROHxw F1g9s0CqxJ9HDWALhAVCJOYePgZUz8HBIqAqsfx3EkiYV8BF4tqjLqhVChIL7r0Fu0FC4Deb xKSl7WwgCRYBAYlvkw+xgPRKCMhKbDoAdbOkxMEVN1gmMAouYGRYxSiaWpBcUJyUXmSkV5yY W1yal66XnJ+7iRESrn07GG8esD7EmAw0biKzlGhyPjDc80riDY3NjCxMTUyNjcwtzUgTVhLn VWuxDhQSSE8sSc1OTS1ILYovKs1JLT7EyMTBKdXAWH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 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1575 Lines: 45 In __iommu_get_pages(), the cpu_addr is checked wheather in atomic_pool range or not. So if the cpu_addr is in atomic_pool range, it does not need to check twice. Signed-off-by: YoungJun Cho Signed-off-by: Kyungmin Park --- arch/arm/mm/dma-mapping.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index ef3e0f3..1d158c2 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -1372,16 +1372,17 @@ static int arm_iommu_mmap_attrs(struct device *dev, struct vm_area_struct *vma, void arm_iommu_free_attrs(struct device *dev, size_t size, void *cpu_addr, dma_addr_t handle, struct dma_attrs *attrs) { - struct page **pages = __iommu_get_pages(cpu_addr, attrs); + struct page **pages; size = PAGE_ALIGN(size); - if (!pages) { - WARN(1, "trying to free invalid coherent area: %p\n", cpu_addr); + if (__in_atomic_pool(cpu_addr, size)) { + __iommu_free_atomic(dev, cpu_addr, handle, size); return; } - if (__in_atomic_pool(cpu_addr, size)) { - __iommu_free_atomic(dev, cpu_addr, handle, size); + pages = __iommu_get_pages(cpu_addr, attrs); + if (!pages) { + WARN(1, "trying to free invalid coherent area: %p\n", cpu_addr); return; } -- 1.7.4.1 -- 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/