[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRc=MfdX+XMuUfpW33Qc7Xi4kKkJfCQLp0TaShijQbOUC4+vA@mail.gmail.com>
Date: Wed, 31 May 2017 12:53:06 +0200
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Linus Walleij <linus.walleij@...aro.org>,
Alexandre Courbot <gnurou@...il.com>,
Bamvor Jian Zhang <bamvor.zhangjian@...aro.org>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 4/7] gpio: mockup: improve readability
2017-05-30 20:55 GMT+02:00 Andy Shevchenko <andy.shevchenko@...il.com>:
> On Tue, May 30, 2017 at 11:58 AM, Bartosz Golaszewski <brgl@...ev.pl> wrote:
>> We currently shift bits here and there without actually explaining
>> what we're doing. Add some helper variables with names indicating
>> their purpose to improve the code readability.
>
>> + /* Each chip is described by two values. */
>> + num_chips = gpio_mockup_params_nr / 2;
>> +
>> + chips = devm_kzalloc(dev, sizeof(*chips) * num_chips, GFP_KERNEL);
>
> It's effectively
> devm_kcalloc()
> or
> devm_kmalloc_array()
> depending on the requirement of zeroing a memory chunks.
>
Is there any advantage to using one of these here?
Thanks,
Bartosz
Powered by blists - more mailing lists