From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.bootlin.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fIUUw-0001EH-Bo for linux-mtd@lists.infradead.org; Tue, 15 May 2018 07:35:52 +0000 Date: Tue, 15 May 2018 09:35:25 +0200 From: Boris Brezillon To: Andy Shevchenko Cc: Shreeya Patel , Masahiro Yamada , Jane Wan , Miquel Raynal , Linux Kernel Mailing List , Marek Vasut , ties.bos@nokia.com, prabhakar.kushwaha@nxp.com, "open list:MEMORY TECHNOLOGY..." , jagdish.gediya@nxp.com, Richard Weinberger , Shawn Guo , Brian Norris , David Woodhouse Subject: Re: [PATCH v5 2/2] mtd: rawnand: use bit-wise majority to recover the contents of ONFI parameter Message-ID: <20180515093525.051856dd@bbrezillon> In-Reply-To: References: <1525920400-11392-1-git-send-email-Jane.Wan@nokia.com> <20180510140311.02805561@bbrezillon> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Mon, 14 May 2018 20:54:36 +0300 Andy Shevchenko wrote: > On Thu, May 10, 2018 at 3:03 PM, Boris Brezillon > wrote: > > >> +#define GET_BIT(bit, val) (((val) >> (bit)) & 0x01) > > > > Not sure we need that macro, see below. > > +1. We have too many nice helpers for bit manipulations > (for_each_set_bit() as an example). > > > > for (k = 0; k < nbufs; k++) { > > const u8 *srcbuf = srcbufs[j]; > > > > if (srcbuf[i] & BIT(k)) > > m++; > > } > > ...which is effectively hweightXX(). No it's not.