From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-we0-f177.google.com ([74.125.82.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SKaoU-00071i-UH for linux-mtd@lists.infradead.org; Wed, 18 Apr 2012 19:45:15 +0000 Received: by werp11 with SMTP id p11so6026244wer.36 for ; Wed, 18 Apr 2012 12:45:11 -0700 (PDT) Date: Wed, 18 Apr 2012 22:43:56 +0300 From: Shmulik Ladkani To: Brian Norris Subject: Re: [PATCH 2/2] mtd: nand: nand_do_{read,write}_ops - pass OOB buffer through Message-ID: <20120418224356.0709fc40@halley> In-Reply-To: <4F8EE832.3090002@gmail.com> References: <1334615755-15418-1-git-send-email-computersforpeace@gmail.com> <1334615755-15418-3-git-send-email-computersforpeace@gmail.com> <20120418145232.6ba77552@pixies.home.jungo.com> <4F8EE832.3090002@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Viresh Kumar , Artem Bityutskiy , Nicolas Ferre , Vipin Kumar , linux-mtd@lists.infradead.org, Laurent Pinchart , Florian Fainelli , Jamie Iles , Mike Dunn , Bastian Hecht , Dmitry Eremin-Solenikov , Kevin Cernekee , Lei Wen , Axel Lin , Li Yang , Jean-Christophe PLAGNIOL-VILLARD , Armando Visconti , Thomas Gleixner , Scott Branden , Artem Bityutskiy , Wolfram Sang , Huang Shijie , Jiandong Zheng , David Woodhouse List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Hi Brian, On Wed, 18 Apr 2012 09:13:38 -0700 Brian Norris wrote: > > So the 'oob' parameter is more of a boolean than an actual buffer to be > > used by the various ecc.{read,write}_page implementors. > > Yes, I suppose so. I naturally used 'oob' as a buffer, since that's very > straightforward and logical from a 'layers' perspective and because my > driver doesn't need any buffer when oob is not required. But I see that > it essentially would become a boolean flag for many of the other > interfaces, and so a boolean can work just as well. > > > Any reason not to pass a boolean instead? > > Only reason I'm thinking of: a cleaner interface. > > To me, the interface is rather non-obvious and ugly when data is > constantly shuttled back and forth behind the scenes (i.e., not via > function arguments or ret values) by using chip->oob_poi. > > However, this sense of "ugliness" competes with the ugliness of needing > a buffer even when the interface might otherwise say "no OOB." Many > {read,write}_page functions would need something like: > > uint8_t *oobbuf = oob ? oob : chip->oob_poi; > > which is not pretty. > > I'm open to either way, I guess, but I'm now leaning a little toward > 'oob' as a boolean. Yes, both approaches aren't perfect. However a 'int has_user_oob' (or 'has_oob') has a precise, consistent meaning: the mtd user explicitly provided an OOB buffer (or in the read case, the mtd user expects the OOB to be returned). (need help with the boolean's name, though) Also, I think it will result in less changes (makes the whole s/oob/oobbuf/ collateral damage of 1st patch irrelevant). So IMO a boolean is better. Regards, Shmulik