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: <CAHp75Veqp=tb0Z9h2cey5DE_KpNBp3Jdmh2gLzSoo-N5CsGpvw@mail.gmail.com>
Date:   Tue, 21 Apr 2020 14:24:30 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Mathieu Othacehe <m.othacehe@...il.com>
Cc:     Jonathan Cameron <jic23@...nel.org>,
        Hartmut Knaack <knaack.h@....de>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Peter Meerwald <pmeerw@...erw.net>,
        linux-iio <linux-iio@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 2/4] iio: vcnl4000: Add event support for VCNL4010/20.

On Tue, Apr 21, 2020 at 10:57 AM Mathieu Othacehe <m.othacehe@...il.com> wrote:
>
> The VCNL4010 and VCNL4020 chips are able to raise interrupts on proximity
> threshold events. Add support for threshold rising and falling events for
> those two chips.

Some nitpicks below (up to you and maintainer to address)

...

> +static bool vcnl4010_in_periodic_mode(struct vcnl4000_data *data)

Since it's boolean I would name it ..._is_in_prediodic_mode().

>  {
> +       int ret;
>
> +       ret = i2c_smbus_read_byte_data(data->client, VCNL4000_COMMAND);
> +       if (ret < 0)
> +               return false;
>

> +       return (ret & VCNL4000_SELF_TIMED_EN) > 0;

This > 0  for bitmasked values looks slightly strange. And actually if
a sign bit is included, potentially wrong.

I would rather go without any comparison, or do !!(foo & BAR).

> +}

...

> +static bool vcnl4010_thr_enabled(struct vcnl4000_data *data)

_is_thr_enabled() ?

> +{
> +       int ret;
> +
> +       ret = i2c_smbus_read_byte_data(data->client, VCNL4010_INT_CTRL);
> +       if (ret < 0)
> +               return false;
> +

> +       return (ret & VCNL4010_INT_THR_EN) > 0;

Ditto.

> +}

...

> +               ret = devm_request_threaded_irq(&client->dev, client->irq,
> +                                               NULL, vcnl4010_irq_thread,
> +                                               IRQF_TRIGGER_FALLING |

> +                                               IRQF_ONESHOT,

Isn't it by default when threaded IRQ is asked with NULL for hw handler?

> +                                               "vcnl4010_irq",
> +                                               indio_dev);


-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ