Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1653499

Re: [PATCH v2 4/7] gpio: mockup: improve readability

From Andy Shevchenko <andy.shevchenko@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 4/7] gpio: mockup: improve readability
Date 2017-05-30 21:00 +0200
Message-ID <tMUx4-2xi-23@gated-at.bofh.it> (permalink)
References <tMLaq-54b-5@gated-at.bofh.it> <tMLar-54b-35@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, May 30, 2017 at 11:58 AM, Bartosz Golaszewski <brgl@bgdev.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.

-- 
With Best Regards,
Andy Shevchenko

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 4/7] gpio: mockup: improve readability Bartosz Golaszewski <brgl@bgdev.pl> - 2017-05-30 11:00 +0200
  Re: [PATCH v2 4/7] gpio: mockup: improve readability Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-05-30 21:00 +0200
    Re: [PATCH v2 4/7] gpio: mockup: improve readability Bartosz Golaszewski <brgl@bgdev.pl> - 2017-05-31 13:00 +0200
      Re: [PATCH v2 4/7] gpio: mockup: improve readability Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-05-31 17:00 +0200
        Re: [PATCH v2 4/7] gpio: mockup: improve readability Bartosz Golaszewski <brgl@bgdev.pl> - 2017-05-31 17:10 +0200

csiph-web