[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VcET7PZYfeRkmiP=n_xCnDzEFYS98ZLjszc1fHjdfDF2A@mail.gmail.com>
Date: Mon, 14 May 2018 20:54:36 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Boris Brezillon <boris.brezillon@...tlin.com>
Cc: Jane Wan <Jane.Wan@...ia.com>,
Miquel Raynal <miquel.raynal@...tlin.com>,
David Woodhouse <dwmw2@...radead.org>,
Brian Norris <computersforpeace@...il.com>,
Richard Weinberger <richard@....at>,
Marek Vasut <marek.vasut@...il.com>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
prabhakar.kushwaha@....com, Shawn Guo <shawnguo@...nel.org>,
jagdish.gediya@....com,
Shreeya Patel <shreeya.patel23498@...il.com>,
"open list:MEMORY TECHNOLOGY..." <linux-mtd@...ts.infradead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
ties.bos@...ia.com
Subject: Re: [PATCH v5 2/2] mtd: rawnand: use bit-wise majority to recover the
contents of ONFI parameter
On Thu, May 10, 2018 at 3:03 PM, Boris Brezillon
<boris.brezillon@...tlin.com> 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().
>> - p = kzalloc(sizeof(*p), GFP_KERNEL);
>> + p = kzalloc((sizeof(*p) * 3), GFP_KERNEL);
>> if (!p)
>> return -ENOMEM;
...which is kcalloc().
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists