From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752039AbcFJOty (ORCPT ); Fri, 10 Jun 2016 10:49:54 -0400 Received: from mx2.suse.de ([195.135.220.15]:54528 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751440AbcFJOtw (ORCPT ); Fri, 10 Jun 2016 10:49:52 -0400 Date: Fri, 10 Jun 2016 16:49:47 +0200 From: "Luis R. Rodriguez" To: Krzysztof Kozlowski Cc: Andrew Morton , hch@infradead.org, Bartlomiej Zolnierkiewicz , Jonathan Corbet , Russell King , Robin Murphy , Marek Szyprowski , Doug Anderson , Will Deacon , Joerg Roedel , Christian Borntraeger , Zhen Lei , "Michael S. Tsirkin" , Andy Lutomirski , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 01/44] dma-mapping: Use unsigned long for dma_attrs Message-ID: <20160610144947.GD11948@wotan.suse.de> References: <1465553521-27303-1-git-send-email-k.kozlowski@samsung.com> <1465553521-27303-2-git-send-email-k.kozlowski@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1465553521-27303-2-git-send-email-k.kozlowski@samsung.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 10, 2016 at 12:11:18PM +0200, Krzysztof Kozlowski wrote: > The dma-mapping core and the implementations do not change the > DMA attributes passed by pointer. Thus the pointer can point to const > data. However the attributes do not have to be a bitfield. Instead > unsigned long will do fine: > > 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. Do we not expect the number of argument to grow ? This "cleanup" would do away with such possibilities, and then require adding the API later, and this requiring a full set of collateral evolutions again when this is needed. What was the original motivation for using this instead of the approach you are suggesting ? If the concern is the const data, why not require const struct dma_attr for the APIs that we know can and should use const ? Luis