From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933156AbcE3LyX (ORCPT ); Mon, 30 May 2016 07:54:23 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:59004 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932915AbcE3LyV (ORCPT ); Mon, 30 May 2016 07:54:21 -0400 X-AuditID: cbfec7f5-f792a6d000001302-bc-574c29e9081c From: Krzysztof Kozlowski To: Russell King , Catalin Marinas , Will Deacon , Joerg Roedel , Andrew Morton , Marek Szyprowski , Michal Hocko , Mel Gorman , Arnd Bergmann , Andy Lutomirski , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, xen-devel@lists.xenproject.org, dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, iommu@lists.linux-foundation.org Cc: hch@infradead.org, sstabellini@kernel.org, Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [RFC v2] Change dma_attrs from bitfield to unsigned long Date: Mon, 30 May 2016 13:54:05 +0200 Message-id: <1464609246-6948-1-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHLMWRmVeSWpSXmKPExsVy+t/xy7ovNX3CDZa3GVvMWb+GzeLvpGPs FhtnrGe1eL+sh9Hiytf3bBanJyxisliw39qic/YGdovXLwwtNj2+xmqxsG0Ji8XlXXPYLGac 38dkcWjqXkaL87vWslqsPXKX3WLHUqDY/T4Hi9Xr4i1efjzBYvF9y2QmB1GPJwfnMXmsmbeG 0ePytYvMHr9/TWL02LxCy2PTqk42jxMzfrN43O8+zuSxeUm9x+Qbyxk9Dn+4wuLRt2UVo8f6 LVdZPLb+svP4vEkugD+KyyYlNSezLLVI3y6BK+PmtxamgpOCFVvnn2FuYDzM08XIySEhYCJx 6ewcNghbTOLCvfVANheHkMBSRokZ9+awQDiNTBLXeo8xgVSxCRhLbF6+BKxKROA9i8TX9TdZ QRLMAtMYJfZuEAexhQUcJfYt/AM2lkVAVeLrov3MIDavgJtE4/0TrBDr5CROHpvMOoGRewEj wypG0dTS5ILipPRcI73ixNzi0rx0veT83E2MkFj4uoNx6TGrQ4wCHIxKPLwFmt7hQqyJZcWV uYcYJTiYlUR4d6r5hAvxpiRWVqUW5ccXleakFh9ilOZgURLnnbnrfYiQQHpiSWp2ampBahFM lomDU6qB0Z/na9v7ksPiK44x7W3cWpgh8TjbNF/b7NGH2fNbHxo4L/t6Jf3L6sPM/dPlvtwL +BP9RX5lgGv0yXihLdriUSbKHNsrIwsYrYSWXX7py/o5StEy+4Eo051CLtOCvCsTz329pNiU wz65svVSgcaaeP5NtZsz9zxc/Fr+1LkTHBvWPo2UZIozV2Ipzkg01GIuKk4EANQdIZ2BAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, This is second attempt to bring some safeness to dma_attrs. In v1 [0] I added const to data pointed by attrs. However Christoph Hellwig suggested getting rid of struct dma_attrs in favor of some simpler data type. Benefits of unsigned long for dma_attrs: 1. This is just simpler. Both in terms of reading the code and setting attributes. Instead of initializing local attributes on the stack and passing pointer to it to dma_set_attr(), just set the bits. 2. It brings safeness and checking for const correctness because the attributes are passed by value. The problem is that the patch touches the dma-mapping API so all the users have to be converted (ARM and ARM64 as of now). Any ideas to split it per smaller patches? The work is not finished yet, I would rather get some feedback before progressing further. Best regards, Krzysztof Krzysztof Kozlowski (1): dma-mapping: Use unsigned long for dma_attrs Documentation/DMA-API.txt | 2 +- Documentation/DMA-attributes.txt | 2 +- arch/arm/include/asm/dma-mapping.h | 13 ++-- arch/arm/include/asm/xen/page-coherent.h | 16 ++--- arch/arm/mm/dma-mapping.c | 82 +++++++++++------------ arch/arm/xen/mm.c | 4 +- arch/arm64/mm/dma-mapping.c | 57 ++++++++-------- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_g2d.c | 1 - drivers/gpu/drm/exynos/exynos_drm_gem.c | 20 +++--- drivers/gpu/drm/exynos/exynos_drm_gem.h | 2 +- drivers/iommu/dma-iommu.c | 6 +- drivers/xen/swiotlb-xen.c | 14 ++-- include/linux/dma-attrs.h | 71 -------------------- include/linux/dma-iommu.h | 6 +- include/linux/dma-mapping.h | 105 +++++++++++++++++------------- include/linux/swiotlb.h | 10 +-- include/xen/swiotlb-xen.h | 12 ++-- lib/dma-noop.c | 9 +-- lib/swiotlb.c | 13 ++-- 20 files changed, 195 insertions(+), 252 deletions(-) delete mode 100644 include/linux/dma-attrs.h -- 1.9.1