From patchwork Tue May 24 06:28:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 9132839 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5CC7C6075E for ; Tue, 24 May 2016 06:30:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 52B862823B for ; Tue, 24 May 2016 06:30:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 473002824F; Tue, 24 May 2016 06:30:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C93F12823B for ; Tue, 24 May 2016 06:30:51 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b55q3-0007Yk-Pl; Tue, 24 May 2016 06:29:11 +0000 Received: from mailout4.w1.samsung.com ([210.118.77.14]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b55pd-0007Rk-Nr for linux-arm-kernel@lists.infradead.org; Tue, 24 May 2016 06:28:46 +0000 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O7O00E4P4N7EG90@mailout4.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Tue, 24 May 2016 07:28:19 +0100 (BST) X-AuditID: cbfec7f5-f792a6d000001302-5e-5743f4839620 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 5F.88.04866.384F3475; Tue, 24 May 2016 07:28:19 +0100 (BST) Received: from AMDC2174.DIGITAL.local ([106.120.53.17]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O7O00BQ04N2WW40@eusync4.samsung.com>; Tue, 24 May 2016 07:28:19 +0100 (BST) From: Krzysztof Kozlowski To: Russell King , Stefano Stabellini , Catalin Marinas , Will Deacon , Joerg Roedel , Konrad Rzeszutek Wilk , Andrew Morton , Marek Szyprowski , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, iommu@lists.linux-foundation.org Subject: [PATCH 2/4] ARM: dma-mapping: Constify attrs passed to internal functions Date: Tue, 24 May 2016 08:28:08 +0200 Message-id: <1464071290-15948-3-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1464071290-15948-1-git-send-email-k.kozlowski@samsung.com> References: <1464071290-15948-1-git-send-email-k.kozlowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrELMWRmVeSWpSXmKPExsVy+t/xa7rNX5zDDVqXylvMWb+GzWLjjPWs Fu+X9TBaLNhvbdE5ewO7xesXhhbLFj9ltNj0+BqrxeVdc9gsDk3dy2ix9shddovV6+ItXn48 wWLxfctkJgc+jycH5zF5rJm3htHj8rWLzB6bVnWyeZyY8ZvFY/OSeo/JN5Yzehz+cIXF4+PT WywefVtWMXp83iQXwB3FZZOSmpNZllqkb5fAlTG5azVjQZ98xa4Dc5kbGD9LdDFyckgImEhc efCQCcIWk7hwbz1bFyMXh5DAUkaJTx+bWSCcRiaJpqbDYFVsAsYSm5cvAasSEXjILHFm1l8W kASzQKZE59657CC2sECIxLbL28DiLAKqEg+mtbKC2LwC7hI/T+5nh1gnJ3Hy2GSwOKeAh0Tj 6QNg9UJANdNmX2SfwMi7gJFhFaNoamlyQXFSeq6RXnFibnFpXrpecn7uJkZISH/dwbj0mNUh RgEORiUe3hWFzuFCrIllxZW5hxglOJiVRHgZgREhxJuSWFmVWpQfX1Sak1p8iFGag0VJnHfm rvchQgLpiSWp2ampBalFMFkmDk6pBsaDbCLm1QL96tvE2XY/cVkdFLSWQd7i4O5+lvbwVdKd zFvLI89nGPKx58dFHdr261+qG/fp+N1rZsh5m60ov7jo7eoT5/xNSz9qGDzzPx0ZWdg7/6mJ 3O7vm0OnqO18Oz/AwGth07SV3RIeidYS3xtcCyOvJBo/6/slwNt8J9rh/oqmHbe6dJRYijMS DbWYi4oTAeoin+1lAgAA X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160523_232845_950872_AACAE21D X-CRM114-Status: GOOD ( 19.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Some of the non-exported functions do not modify passed dma_attrs so the pointer can point to const data. Signed-off-by: Krzysztof Kozlowski Acked-by: Russell King --- arch/arm/mm/dma-mapping.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index ff7ed5697d3e..4abc50952451 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -621,7 +621,7 @@ static void __free_from_contiguous(struct device *dev, struct page *page, dma_release_from_contiguous(dev, page, size >> PAGE_SHIFT); } -static inline pgprot_t __get_dma_pgprot(struct dma_attrs *attrs, pgprot_t prot) +static inline pgprot_t __get_dma_pgprot(const struct dma_attrs *attrs, pgprot_t prot) { prot = dma_get_attr(DMA_ATTR_WRITE_COMBINE, attrs) ? pgprot_writecombine(prot) : @@ -732,7 +732,7 @@ static struct arm_dma_allocator remap_allocator = { static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp, pgprot_t prot, bool is_coherent, - struct dma_attrs *attrs, const void *caller) + const struct dma_attrs *attrs, const void *caller) { u64 mask = get_coherent_dma_mask(dev); struct page *page = NULL; @@ -878,7 +878,7 @@ int arm_dma_mmap(struct device *dev, struct vm_area_struct *vma, * Free a buffer as defined by the above mapping. */ static void __arm_dma_free(struct device *dev, size_t size, void *cpu_addr, - dma_addr_t handle, struct dma_attrs *attrs, + dma_addr_t handle, const struct dma_attrs *attrs, bool is_coherent) { struct page *page = pfn_to_page(dma_to_pfn(dev, handle)); @@ -1253,7 +1253,8 @@ static inline void __free_iova(struct dma_iommu_mapping *mapping, static const int iommu_order_array[] = { 9, 8, 4, 0 }; static struct page **__iommu_alloc_buffer(struct device *dev, size_t size, - gfp_t gfp, struct dma_attrs *attrs) + gfp_t gfp, + const struct dma_attrs *attrs) { struct page **pages; int count = size >> PAGE_SHIFT; @@ -1342,7 +1343,7 @@ error: } static int __iommu_free_buffer(struct device *dev, struct page **pages, - size_t size, struct dma_attrs *attrs) + size_t size, const struct dma_attrs *attrs) { int count = size >> PAGE_SHIFT; int i; @@ -1439,7 +1440,8 @@ static struct page **__atomic_get_pages(void *addr) return (struct page **)page; } -static struct page **__iommu_get_pages(void *cpu_addr, struct dma_attrs *attrs) +static struct page **__iommu_get_pages(void *cpu_addr, + const struct dma_attrs *attrs) { struct vm_struct *area; @@ -1633,8 +1635,8 @@ static int __dma_direction_to_prot(enum dma_data_direction dir) */ static int __map_sg_chunk(struct device *dev, struct scatterlist *sg, size_t size, dma_addr_t *handle, - enum dma_data_direction dir, struct dma_attrs *attrs, - bool is_coherent) + enum dma_data_direction dir, + const struct dma_attrs *attrs, bool is_coherent) { struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev); dma_addr_t iova, iova_base; @@ -1676,8 +1678,8 @@ fail: } static int __iommu_map_sg(struct device *dev, struct scatterlist *sg, int nents, - enum dma_data_direction dir, struct dma_attrs *attrs, - bool is_coherent) + enum dma_data_direction dir, + const struct dma_attrs *attrs, bool is_coherent) { struct scatterlist *s = sg, *dma = sg, *start = sg; int i, count = 0; @@ -1758,8 +1760,8 @@ int arm_iommu_map_sg(struct device *dev, struct scatterlist *sg, } static void __iommu_unmap_sg(struct device *dev, struct scatterlist *sg, - int nents, enum dma_data_direction dir, struct dma_attrs *attrs, - bool is_coherent) + int nents, enum dma_data_direction dir, + const struct dma_attrs *attrs, bool is_coherent) { struct scatterlist *s; int i;