All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Mathieu Othacehe <m.othacehe@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald <pmeerw@pmeerw.net>,
	linux-iio <linux-iio@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 2/4] iio: vcnl4000: Add event support for VCNL4010/20.
Date: Tue, 21 Apr 2020 14:24:30 +0300	[thread overview]
Message-ID: <CAHp75Veqp=tb0Z9h2cey5DE_KpNBp3Jdmh2gLzSoo-N5CsGpvw@mail.gmail.com> (raw)
In-Reply-To: <20200421075532.19192-3-m.othacehe@gmail.com>

On Tue, Apr 21, 2020 at 10:57 AM Mathieu Othacehe <m.othacehe@gmail.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

  reply	other threads:[~2020-04-21 11:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-21  7:55 [PATCH v4 0/4] iio: vcnl: Add interrupts support for VCNL4010/20 Mathieu Othacehe
2020-04-21  7:55 ` [PATCH v4 1/4] iio: vcnl4000: Factorize data reading and writing Mathieu Othacehe
2020-04-21  7:55 ` [PATCH v4 2/4] iio: vcnl4000: Add event support for VCNL4010/20 Mathieu Othacehe
2020-04-21 11:24   ` Andy Shevchenko [this message]
2020-04-22  8:02     ` Mathieu Othacehe
2020-04-22  8:25       ` Andy Shevchenko
2020-04-25 19:47   ` Jonathan Cameron
2020-04-21  7:55 ` [PATCH v4 3/4] iio: vcnl4000: Add sampling frequency " Mathieu Othacehe
2020-04-21 12:22   ` Andy Shevchenko
2020-04-25 15:52     ` Jonathan Cameron
2020-04-25 17:14       ` Andy Shevchenko
2020-04-25 19:49   ` Jonathan Cameron
2020-04-21  7:55 ` [PATCH v4 4/4] iio: vcnl4000: Add buffer " Mathieu Othacehe
2020-04-21 12:27   ` Andy Shevchenko
2020-04-22  8:14     ` Mathieu Othacehe
2020-04-25 16:09       ` Jonathan Cameron
2020-04-25 15:57     ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHp75Veqp=tb0Z9h2cey5DE_KpNBp3Jdmh2gLzSoo-N5CsGpvw@mail.gmail.com' \
    --to=andy.shevchenko@gmail.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.othacehe@gmail.com \
    --cc=pmeerw@pmeerw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.