lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vf9+=rie5oqmAp7yW3_AirGuvBtxGS=6y9UBHzjpvD9ww@mail.gmail.com>
Date:   Tue, 13 Mar 2018 18:04:33 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     William Breathitt Gray <vilhelm.gray@...il.com>
Cc:     Linus Walleij <linus.walleij@...aro.org>,
        "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        linux-iio@...r.kernel.org
Subject: Re: [PATCH 3/8] gpio: pci-idio-16: Implement get_multiple callback

On Mon, Mar 12, 2018 at 10:49 PM, William Breathitt Gray
<vilhelm.gray@...il.com> wrote:

> +static int idio_16_gpio_get_multiple(struct gpio_chip *chip,
> +       unsigned long *mask, unsigned long *bits)
> +{


> +       /* clear bits array to a clean slate */
> +       for (i = 0; i < chip->ngpio; i += BITS_PER_LONG)
> +               bits[i / BITS_PER_LONG] = 0;

bitmap_clear() or bitmap_zero()

> +       /* get bits are evaluated a gpio register size at a time */
> +       for (i = 0; i < chip->ngpio; i += gpio_reg_size) {
> +               bit_word_offset = i % BITS_PER_LONG;
> +               bits_mask = mask[BIT_WORD(i)] & (reg_mask << bit_word_offset);
> +               if (!bits_mask) {
> +                       /* no get bits in this register so skip to next one */
> +                       continue;
> +               }

for_each_set_bit() ?

> +               /* store acquired bits */
> +               bits[BIT_WORD(i)] |= port_state << bit_word_offset;

__set_bit()
__clear_bit()

We have bitmap API for *ages*. Is it too hard to check?

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ